Retrieving Static Types from xml file rti-connext 5.3.1 (Python)

2 posts / 0 new
Last post
Offline
Last seen: 2 weeks 2 days ago
Joined: 09/07/2022
Posts: 1
Retrieving Static Types from xml file rti-connext 5.3.1 (Python)

I have an .xml file (example.xml) defining QoS types with the following valid format:

<dds>

    <types>

         <struct name="StructExample">

              <member name="MemberExample" type="nonBasic" nonBasicTypeName="Path::PATH"/>        

          </struct>

          <module name = "FOO">

              <const name="CONST_EXAMPLE" type="int32" value="12"/>

          </module>

    </types>

</dds>

While I can programmatically retrieve members from the xml file by instantiating a provider and calling type member functions:

provider = dds.QosProvider('Example.xml')

example_type = provider.type("StructExample").find_member_by_name("MemberExample")

I cannot use the same method to retrieve static types defined in the .xml file:

example_const = provider.type("FOO").find_member_by_name("CONST_EXAMPLE")

Does NOT work and results in "Failed to get DynamicType from type library"

Is there a way to retrieve the value of statically defined variables programmatically from a provider object?

 

Keywords:
Howard's picture
Offline
Last seen: 1 day 18 hours ago
Joined: 11/29/2012
Posts: 429

Unfortunately, non-struct definitions, i.e., "const", are not available/accessible from just parsing the XML.  This is the current situation (Connext 6.x and earlier) for not just Python but for all languages using the XML App Creation API.

DDS will instantiate the type objects from the definitions for "struct", but not "const".

So, this is not possible, unless you somehow configure and use an XML parser to parse the XML file (you do have access to the .dtd/.xsd) and then extract the const yourself.

Having said that, starting with our next feature release later this year, we will be supporting code generation for the Connext Python API.  This means that our next release will support using "rtiddsgen" to generate Python code from the IDL or XML defining the data types and that code will instantiate the const objects that are accessible to your own python source.

You would have to upgrade to that latest version of Connext to use that feature of course (I note you indicated that you were using a Connext 5.3.1-based installation).