RTI Connext Traditional C++ API
Version 6.0.0
|
A factory for registering a dynamically defined type and creating DDS_DynamicData objects. More...
Public Member Functions | |
DDS_Boolean | is_valid () |
Indicates whether the object was constructed properly. | |
DDS_ReturnCode_t | register_type (DDSDomainParticipant *participant, const char *type_name) |
Associate the DDS_TypeCode with the given DDSDomainParticipant under the given logical name. | |
DDS_ReturnCode_t | unregister_type (DDSDomainParticipant *participant, const char *type_name) |
Remove the definition of this type from the DDSDomainParticipant. | |
const char * | get_type_name () const |
Get the default name of this type. | |
const DDS_TypeCode * | get_data_type () const |
Get the DDS_TypeCode wrapped by this DDSDynamicDataTypeSupport. | |
DDS_DynamicData * | create_data () |
Create a new DDS_DynamicData sample initialized with the DDS_TypeCode and properties of this DDSDynamicDataTypeSupport. | |
DDS_ReturnCode_t | delete_data (DDS_DynamicData *a_data) |
Finalize and deallocate the DDS_DynamicData sample. | |
void | print_data (const DDS_DynamicData *a_data) const |
Print a string representation of the given sample to the given file. | |
DDS_ReturnCode_t | copy_data (DDS_DynamicData *dest, const DDS_DynamicData *source) const |
Deeply copy the given data samples. | |
DDSDynamicDataTypeSupport (const DDS_TypeCode *type, const struct DDS_DynamicDataTypeProperty_t &props) | |
Construct a new DDSDynamicDataTypeSupport object. | |
virtual | ~DDSDynamicDataTypeSupport () |
Delete a DDSDynamicDataTypeSupport object. | |
A factory for registering a dynamically defined type and creating DDS_DynamicData objects.
A DDSDynamicDataTypeSupport has three roles:
DDSDynamicDataTypeSupport::DDSDynamicDataTypeSupport | ( | const DDS_TypeCode * | type, |
const struct DDS_DynamicDataTypeProperty_t & | props | ||
) |
Construct a new DDSDynamicDataTypeSupport object.
This step is usually followed by type registration.
NOTE that RTI Connext does not explicitly generate any exceptions in this constructor, because C++ exception support is not consistent across all platforms on which RTI Connext runs. Therefore, to check whether construction succeeded, you must use the DDSDynamicDataTypeSupport::is_valid method.
The DDS_TypeCode object that is passed to this constructor is cloned and stored internally; no pointer is retained to the object passed in. It is therefore safe to delete the DDS_TypeCode after this method returns.
type | The DDS_TypeCode that describes the members of this type. The new object will contain a copy of this DDS_TypeCode; you may delete the argument after this constructor returns. |
props | Policies that describe how to manage the memory and other properties of the data samples created by this factory. In most cases, the default values will be appropriate; see DDS_DYNAMIC_DATA_TYPE_PROPERTY_DEFAULT. |
|
virtual |
Delete a DDSDynamicDataTypeSupport object.
A DDSDynamicDataTypeSupport cannot be deleted while it is still in use. For each DDSDomainParticipant with which the DDSDynamicDataTypeSupport is registered, either the type must be unregistered or the participant must be deleted.
DDS_Boolean DDSDynamicDataTypeSupport::is_valid | ( | ) |
Indicates whether the object was constructed properly.
This method returns DDS_BOOLEAN_TRUE if the constructor succeeded; it returns DDS_BOOLEAN_FALSE if the constructor failed for any reason, which should also have resulted in a log message.
Possible failure reasons include passing an invalid type or invalid properties to the constructor.
This method is necessary because C++ exception support is not consistent across all of the platforms on which RTI Connext runs. Therefore, the implementation does not throw any exceptions in the constructor.
DDS_ReturnCode_t DDSDynamicDataTypeSupport::register_type | ( | DDSDomainParticipant * | participant, |
const char * | type_name | ||
) |
Associate the DDS_TypeCode with the given DDSDomainParticipant under the given logical name.
Once a type has been registered, it can be referenced by name when creating a topic. Statically and dynamically defined types behave the same way in this respect.
If the type cannot be registered, this will fail with DDS_RETCODE_PRECONDITION_NOT_MET or DDS_RETCODE_OUT_OF_RESOURCES.
DDS_ReturnCode_t DDSDynamicDataTypeSupport::unregister_type | ( | DDSDomainParticipant * | participant, |
const char * | type_name | ||
) |
Remove the definition of this type from the DDSDomainParticipant.
This operation is optional; all types are automatically unregistered when a DDSDomainParticipant is deleted. Most application will not need to manually unregister types.
A type cannot be unregistered while it is still in use; that is, while any DDSTopic is still referring to it.
If the type cannot be unregistered, this will fail with DDS_RETCODE_ERROR or DDS_RETCODE_BAD_PARAMETER.
const char* DDSDynamicDataTypeSupport::get_type_name | ( | ) | const |
Get the default name of this type.
The DDS_TypeCode that is wrapped by this DDSDynamicDataTypeSupport includes a name; this operation returns that name.
This operation is useful when registering a type, because in most cases it is not necessary for the physical and logical names of the type to be different.
const DDS_TypeCode* DDSDynamicDataTypeSupport::get_data_type | ( | ) | const |
Get the DDS_TypeCode wrapped by this DDSDynamicDataTypeSupport.
DDS_DynamicData* DDSDynamicDataTypeSupport::create_data | ( | ) |
Create a new DDS_DynamicData sample initialized with the DDS_TypeCode and properties of this DDSDynamicDataTypeSupport.
You must delete your DDS_DynamicData object when you are finished with it.
DDS_ReturnCode_t DDSDynamicDataTypeSupport::delete_data | ( | DDS_DynamicData * | a_data | ) |
Finalize and deallocate the DDS_DynamicData sample.
void DDSDynamicDataTypeSupport::print_data | ( | const DDS_DynamicData * | a_data | ) | const |
Print a string representation of the given sample to the given file.
This method is equivalent to DDS_DynamicData::print.
DDS_ReturnCode_t DDSDynamicDataTypeSupport::copy_data | ( | DDS_DynamicData * | dest, |
const DDS_DynamicData * | source | ||
) | const |
Deeply copy the given data samples.