DDSDynamicDataTypeSupport Class Reference
[Dynamic Data]

A factory for registering a dynamically defined type and creating DDS_DynamicData objects. More...

Inheritance diagram for DDSDynamicDataTypeSupport:

DDSTypeSupport

List of all members.

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_TypeCodeget_data_type () const
 Get the DDS_TypeCode wrapped by this DDSDynamicDataTypeSupport.
DDS_DynamicDatacreate_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 (DDS_TypeCode *type, const struct DDS_DynamicDataTypeProperty_t &props)
 Construct a new DDSDynamicDataTypeSupport object.
virtual ~DDSDynamicDataTypeSupport ()
 Delete a DDSDynamicDataTypeSupport object.


Detailed Description

A factory for registering a dynamically defined type and creating DDS_DynamicData objects.

A DDSDynamicDataTypeSupport has three roles:

  1. It associates a DDS_TypeCode with policies for managing objects of that type. See the constructor, DDSDynamicDataTypeSupport::DDSDynamicDataTypeSupport.
  2. It registers its type under logical names with a DDSDomainParticipant. See DDSDynamicDataTypeSupport::register_type.
  3. It creates DDS_DynamicData samples pre-initialized with the type and properties of the type support itself. See DDSDynamicDataTypeSupport::create_data.

Constructor & Destructor Documentation

DDSDynamicDataTypeSupport::DDSDynamicDataTypeSupport ( 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 Data Distribution Service does not explicitly generate any exceptions in this constructor, because C++ exception support is not consistent across all platforms on which RTI Data Distribution Service 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.

Parameters:
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.
See also:
DDSDynamicDataTypeSupport::is_valid

DDSDynamicDataTypeSupport::register_type

DDSDynamicDataTypeSupport::~DDSDynamicDataTypeSupport

virtual DDSDynamicDataTypeSupport::~DDSDynamicDataTypeSupport (  )  [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.

See also:
DDSDynamicDataTypeSupport::unregister_type

DDSDynamicDataTypeSupport::DDSDynamicDataTypeSupport


Member Function Documentation

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 Data Distribution Service runs. Therefore, the implementation does not throw any exceptions in the constructor.

See also:
DDSDynamicDataTypeSupport::DDSDynamicDataTypeSupport

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.

See also:
FooTypeSupport::register_type

DDSDomainParticipant::create_topic

DDSDynamicDataTypeSupport::unregister_type

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.

See also:
FooTypeSupport::unregister_type

DDSDynamicDataTypeSupport::register_type

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.

 myTypeSupport->register_type(myParticipant, myTypeSupport->get_type_name()); 

See also:
FooTypeSupport::get_type_name

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_DynamicData* sample = myTypeSupport->create_data(); 
  // Do something... 
  myTypeSupport->delete_data(sample); 

See also:
DDSDynamicDataTypeSupport::delete_data

FooTypeSupport::create_data

DDS_DynamicData::DDS_DynamicData

DDS_DynamicDataTypeProperty_t::data

DDS_ReturnCode_t DDSDynamicDataTypeSupport::delete_data ( DDS_DynamicData a_data  ) 

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.

See also:
DDS_DynamicData::print

DDS_ReturnCode_t DDSDynamicDataTypeSupport::copy_data ( DDS_DynamicData dest,
const DDS_DynamicData source 
) const

Deeply copy the given data samples.


RTI Data Distribution Service C++ API Version 4.5e Copyright © 23 Oct 2011 Real-Time Innovations, Inc