Is there any available function to create a TypeCode from a XML definition (in C++)?
Preferably without creating any other DDS entities (I do not want a Reader/Writer involved at this point).
I whould like to be able to do something like this, where HelloWorld.xml is the generated XML output of rtiddsgen -convertToXml:
DDS::TypeCode* tc = XMLtoTypeCode( "HelloWorld.xml" );
DDS::DynamicData data( tc, DDS_DYNAMIC_DATA_TYPE_PROPERTY_DEFAULT );
Regards
Micke
Hi Micke,
If you have the XML definition in a file, you can use the following method:
You will need to get an instance of the
TypeCodeFactory
viaTypeCodeFactory::get_instance()
, then you will need to construct a string of include paths in which you probably only need to include an element with the path to the file that contains the XML, get the filename and the typename and pass in the unbounded string and sequence maximum length. The exception code will let you know what is going on in case of an error.Let me know if this solution works for you.
Fernando.
Thank you, this was exactly what I was looking for :-) Don't know how I could have missed it when I was grepping the docs.
Works great even without any include paths.
Regards
/Micke
is there an equivalent function in C? as far as I've seen there is nothing similar in the C API documentation.
regards,
marko
Hi Marko,
There is a C equivalent function in C, but it does not seem to be publicly documented. Here is how to use it:
You will need to provide in an instance of the
DDS_TypeCodeFactory
in the self argument. In C, you ca get a pointer to the factory using the following function:Please, let me know if you need help using these functions.
Thanks,
Fernando.
Hi Fernando,
It's a bit late but can you provide a concrete example of how to use the create_tc_from_xml_file() function?
Thanks.