RTI Connext Traditional C++ API Version 7.2.0

<<interface>> <<generic>> User data type specific interface. More...

Inheritance diagram for FooTypeSupport:
DDSTypeSupport

Static Public Member Functions

static DDS_ReturnCode_t register_type (DDSDomainParticipant *participant, const char *type_name)
 Allows an application to communicate to RTI Connext the existence of a data type. More...
 
static DDS_ReturnCode_t unregister_type (DDSDomainParticipant *participant, const char *type_name)
 <<extension>> Allows an application to unregister a data type from RTI Connext. After calling unregister_type, no further communication using that type is possible. More...
 
static Foocreate_data (const DDS_TypeAllocationParams_t &alloc_params=DDS_TYPE_ALLOCATION_PARAMS_DEFAULT)
 <<extension>> Create a data type and initialize it. More...
 
static Foocreate_data_ex (DDS_Boolean allocatePointers)
 <<extension>> Create a data type and initialize it. More...
 
static DDS_ReturnCode_t copy_data (Foo *dst_data, const Foo *src_data)
 <<extension>> Copy data type. More...
 
static DDS_ReturnCode_t delete_data (Foo *a_data, const DDS_TypeDeallocationParams_t &dealloc_params=DDS_TYPE_DEALLOCATION_PARAMS_DEFAULT)
 <<extension>> Destroy a user data type instance. More...
 
static DDS_ReturnCode_t delete_data_ex (Foo *a_data, DDS_Boolean deletePointers)
 <<extension>> Destroy a user data type instance. More...
 
static DDS_ReturnCode_t initialize_data (Foo *a_data, const DDS_TypeAllocationParams_t &alloc_params=DDS_TYPE_ALLOCATION_PARAMS_DEFAULT)
 <<extension>> Initialize data type. More...
 
static DDS_ReturnCode_t initialize_data_ex (Foo *a_data, DDS_Boolean allocatePointers)
 <<extension>> Initialize data type. More...
 
static DDS_ReturnCode_t finalize_data (Foo *a_data, const DDS_TypeDeallocationParams_t &dealloc_params=DDS_TYPE_DEALLOCATION_PARAMS_DEFAULT)
 <<extension>> Finalize data type. More...
 
static DDS_ReturnCode_t finalize_data_ex (Foo *a_data, DDS_Boolean deletePointers)
 <<extension>> Finalize data type. More...
 
static const char * get_type_name ()
 Get the default name for this type. More...
 
static void print_data (const Foo *a_data)
 <<extension>> Print value of data type to standard out. More...
 
static DDS_ReturnCode_t serialize_data_to_cdr_buffer (char *buffer, unsigned int &length, const Foo *a_data)
 <<extension>> Serializes the input sample into a CDR buffer of octets. More...
 
static DDS_ReturnCode_t serialize_data_to_cdr_buffer_ex (char *buffer, unsigned int &length, const Foo *a_data, DDS_DataRepresentationId_t representation)
 <<extension>> Serializes the input sample into a buffer of octets. More...
 
static DDS_ReturnCode_t deserialize_data_from_cdr_buffer (Foo *sample, const char *buffer, unsigned int length)
 <<extension>> Deserializes a sample from a buffer of octets. More...
 
static DDS_ReturnCode_t data_to_string (Foo *sample, char *str, DDS_UnsignedLong &str_size, DDS_PrintFormatProperty &property)
 <<extension>> Transforms a data sample into a human-readable string representation. More...
 
static DDS_TypeCodeget_typecode ()
 <<extension>> Retrieves the TypeCode for the Type. More...
 

Detailed Description

<<interface>> <<generic>> User data type specific interface.

Defines the user data type specific interface generated for each application class.

The concrete user data type automatically generated by the implementation is an incarnation of this class.

See also
DDS_TYPESUPPORT_CPP
the Code Generator User's Manual

Member Function Documentation

◆ register_type()

static DDS_ReturnCode_t FooTypeSupport::register_type ( DDSDomainParticipant participant,
const char *  type_name 
)
static

Allows an application to communicate to RTI Connext the existence of a data type.

The generated implementation of the operation embeds all the knowledge that has to be communicated to the middleware in order to make it able to manage the contents of data of that type. This includes in particular the key definition that will allow RTI Connext to distinguish different instances of the same type.

The same DDSTypeSupport can be registered multiple times with a DDSDomainParticipant using the same or different values for the type_name. If register_type is called multiple times on the same DDSTypeSupport with the same DDSDomainParticipant and type_name, the second (and subsequent) registrations are ignored but the operation returns DDS_RETCODE_OK.

Precondition
Cannot use the same type_name to register two different DDSTypeSupport with the same DDSDomainParticipant, or else the operation will fail and DDS_RETCODE_PRECONDITION_NOT_MET will be returned.
Parameters
participant<<in>> the DDSDomainParticipant to register the data type Foo with. Cannot be NULL.
type_name<<in>> the type name under with the data type Foo is registered with the participant; this type name is used when creating a new DDSTopic. (See DDSDomainParticipant::create_topic.) The name may not be NULL or longer than 255 characters.
Exceptions
Oneof the Standard Return Codes, DDS_RETCODE_PRECONDITION_NOT_MET or DDS_RETCODE_OUT_OF_RESOURCES.
MT Safety:
UNSAFE on the FIRST call. It is not safe for two threads to simultaneously make the first call to register a type. Subsequent calls are thread safe.
See also
DDSDomainParticipant::create_topic

◆ unregister_type()

static DDS_ReturnCode_t FooTypeSupport::unregister_type ( DDSDomainParticipant participant,
const char *  type_name 
)
static

<<extension>> Allows an application to unregister a data type from RTI Connext. After calling unregister_type, no further communication using that type is possible.

The generated implementation of the operation removes all the information about a type from RTI Connext. No further communication using that type is possible.

Precondition
A type with type_name is registered with the participant and all DDSTopic objects referencing the type have been destroyed. If any DDSTopic is associated with the type, the operation will fail with DDS_RETCODE_ERROR.
Postcondition
All information about the type is removed from RTI Connext. No further communication using this type is possible.
Parameters
participant<<in>> the DDSDomainParticipant to unregister the data type Foo from. Cannot be NULL.
type_name<<in>> the type name under with the data type Foo is registered with the participant. The name should match a name that has been previously used to register a type with the participant. Cannot be NULL.
Exceptions
Oneof the Standard Return Codes, DDS_RETCODE_BAD_PARAMETER or DDS_RETCODE_ERROR
MT Safety:
SAFE.
See also
FooTypeSupport::register_type

◆ create_data()

static Foo * FooTypeSupport::create_data ( const DDS_TypeAllocationParams_t alloc_params = DDS_TYPE_ALLOCATION_PARAMS_DEFAULT)
static

<<extension>> Create a data type and initialize it.

The generated implementation of the operation knows how to instantiate a data type and initialize it properly.

By default all memory for the type is deeply allocated, except for optional members.

Parameters
alloc_params<<in>> Whether or not to recursively allocate pointers and/or optional members
Returns
Newly created data type, or NULL on failure.
See also
FooTypeSupport::delete_data_ex

◆ create_data_ex()

static Foo * FooTypeSupport::create_data_ex ( DDS_Boolean  allocatePointers)
static

<<extension>> Create a data type and initialize it.

The generated implementation of the operation knows how to instantiate a data type and initialize it properly.

When allocatePointers is DDS_BOOLEAN_TRUE, all the references (pointers) in the type are recursively allocated.

Parameters
allocatePointers<<in>> Whether or not to recursively allocate pointers.
Returns
Newly created data type, or NULL on failure.
See also
FooTypeSupport::delete_data_ex

◆ copy_data()

static DDS_ReturnCode_t FooTypeSupport::copy_data ( Foo dst_data,
const Foo src_data 
)
static

<<extension>> Copy data type.

The generated implementation of the operation knows how to copy value of a data type.

Parameters
dst_data<<inout>> Data type to copy value to. Cannot be NULL.
src_data<<in>> Data type to copy value from. Cannot be NULL.
Exceptions
Oneof the Standard Return Codes

◆ delete_data()

static DDS_ReturnCode_t FooTypeSupport::delete_data ( Foo a_data,
const DDS_TypeDeallocationParams_t dealloc_params = DDS_TYPE_DEALLOCATION_PARAMS_DEFAULT 
)
static

<<extension>> Destroy a user data type instance.

The generated implementation of the operation knows how to destroy a data type and return all resources.

Parameters
a_data<<in>> Cannot be NULL.
dealloc_params<<in>> Whether or not to destroy pointers and/or optional members. By default they are deleted.
Exceptions
Oneof the Standard Return Codes
See also
FooTypeSupport::create_data

◆ delete_data_ex()

static DDS_ReturnCode_t FooTypeSupport::delete_data_ex ( Foo a_data,
DDS_Boolean  deletePointers 
)
static

<<extension>> Destroy a user data type instance.

The generated implementation of the operation knows how to destroy a data type and return all resources.

When deletePointers is DDS_BOOLEAN_TRUE, all the references (pointers) are destroyed as well.

Parameters
a_data<<in>> Cannot be NULL.
deletePointers<<in>> Whether or not to destroy pointers.
Exceptions
Oneof the Standard Return Codes
See also
FooTypeSupport::create_data_ex

◆ initialize_data()

static DDS_ReturnCode_t FooTypeSupport::initialize_data ( Foo a_data,
const DDS_TypeAllocationParams_t alloc_params = DDS_TYPE_ALLOCATION_PARAMS_DEFAULT 
)
static

<<extension>> Initialize data type.

The generated implementation of the operation knows how to initialize a data type. This method is typically called to initialize a data type that is allocated on the stack. Calling this method more than once will cause a memory leak.

The alloc_params determine whether or not all of the references (pointers) and optional members in the type are recursively allocated.

Parameters
a_data<<inout>> Cannot be NULL.
alloc_params<<in>> Parameters that determine whether or not to recursively allocate pointers and optional members.
Exceptions
Oneof the Standard Return Codes
See also
FooTypeSupport::finalize_data

◆ initialize_data_ex()

static DDS_ReturnCode_t FooTypeSupport::initialize_data_ex ( Foo a_data,
DDS_Boolean  allocatePointers 
)
static

<<extension>> Initialize data type.

The generated implementation of the operation knows how to initialize a data type. This method is typically called to initialize a data type that is allocated on the stack. Calling this method more than once will cause a memory leak.

When allocatePointers is DDS_BOOLEAN_TRUE, all the references (pointers) in the type are recursively allocated.

Parameters
a_data<<inout>> Cannot be NULL.
allocatePointers<<in>> Whether or not to recursively allocate pointers.
Exceptions
Oneof the Standard Return Codes
See also
FooTypeSupport::finalize_data_ex

◆ finalize_data()

static DDS_ReturnCode_t FooTypeSupport::finalize_data ( Foo a_data,
const DDS_TypeDeallocationParams_t dealloc_params = DDS_TYPE_DEALLOCATION_PARAMS_DEFAULT 
)
static

<<extension>> Finalize data type.

The generated implementation of the operation knows how to finalize a data type. This method is typically called to finalize a data type that has previouslly been initialized.

Parameters
a_data<<in>> Cannot be NULL.
dealloc_params<<in>> Whether or not to destroy pointers and/or optional members. By default they are deleted.
Exceptions
Oneof the Standard Return Codes
See also
FooTypeSupport::initialize_data

◆ finalize_data_ex()

static DDS_ReturnCode_t FooTypeSupport::finalize_data_ex ( Foo a_data,
DDS_Boolean  deletePointers 
)
static

<<extension>> Finalize data type.

The generated implementation of the operation knows how to finalize a data type. This method is typically called to finalize a data type that has previouslly been initialized.

When deletePointers is DDS_BOOLEAN_TRUE, the memory required by the references (pointers) associated to the type is freed.

Parameters
a_data<<in>> Cannot be NULL.
deletePointers<<in>> Whether or not to free memory allocated by the pointers.
Exceptions
Oneof the Standard Return Codes
See also
FooTypeSupport::initialize_data_ex

◆ get_type_name()

static const char * FooTypeSupport::get_type_name ( )
static

Get the default name for this type.

Can be used for calling FooTypeSupport::register_type or creating DDSTopic

Returns
default name for this type
See also
FooTypeSupport::register_type
DDSDomainParticipant::create_topic

◆ print_data()

static void FooTypeSupport::print_data ( const Foo a_data)
static

<<extension>> Print value of data type to standard out.

The generated implementation of the operation knows how to print value of a data type.

Parameters
a_data<<in>> Data type to be printed.

◆ serialize_data_to_cdr_buffer()

static DDS_ReturnCode_t FooTypeSupport::serialize_data_to_cdr_buffer ( char *  buffer,
unsigned int &  length,
const Foo a_data 
)
static

<<extension>> Serializes the input sample into a CDR buffer of octets.

This method serializes a sample into a buffer of octets and it uses CDR as the data representation. Calling this method is equivalent to calling FooTypeSupport::serialize_data_to_cdr_buffer_ex with DDS_AUTO_DATA_REPRESENTATION as the representation.

The input buffer must be big enough to store the serialized representation of the sample. Otherwise, the method will return an error.

To determine the minimum size of the input buffer, the user must call this method with the buffer set to NULL.

Parameters
a_data<<in>>. Input sample. Cannot be NULL.
buffer<<out>>. Serialization buffer.
length<<inout>>. When buffer is set to NULL, after the method executes, length will contain a buffer size big enough to hold the serialized data. When buffer is not NULL, length must contain the size of the input buffer when the method is invoked. After the method executes, length will be updated to contain the actual size of the serialized content, which may be smaller than the size obtained when buffer is set to NULL.
Exceptions
Oneof the Standard Return Codes

◆ serialize_data_to_cdr_buffer_ex()

static DDS_ReturnCode_t FooTypeSupport::serialize_data_to_cdr_buffer_ex ( char *  buffer,
unsigned int &  length,
const Foo a_data,
DDS_DataRepresentationId_t  representation 
)
static

<<extension>> Serializes the input sample into a buffer of octets.

This method serializes a sample into a buffer of octets using the input data representation. See FooTypeSupport::serialize_data_to_cdr_buffer for details.

Parameters
a_data<<in>>. Input sample. Cannot be NULL.
buffer<<out>>. Serialization buffer.
length<<inout>>. Serialization buffer length.
representation<<in>>. Representation used to serialize the data.
Exceptions
Oneof the Standard Return Codes

◆ deserialize_data_from_cdr_buffer()

static DDS_ReturnCode_t FooTypeSupport::deserialize_data_from_cdr_buffer ( Foo sample,
const char *  buffer,
unsigned int  length 
)
static

<<extension>> Deserializes a sample from a buffer of octets.

This method deserializes a sample from a CDR buffer of octets.

The content of the buffer generated by the method FooTypeSupport::serialize_data_to_cdr_buffer can be provided to this method to get the sample back.

Parameters
sample<<in>>. Output sample. Cannot be NULL.
buffer<<in>>. Deserialization buffer. Cannot be NULL.
length<<in>>. Length of the serialized representation of the sample in the buffer.
Exceptions
Oneof the Standard Return Codes

◆ data_to_string()

static DDS_ReturnCode_t FooTypeSupport::data_to_string ( Foo sample,
char *  str,
DDS_UnsignedLong str_size,
DDS_PrintFormatProperty property 
)
static

<<extension>> Transforms a data sample into a human-readable string representation.

This method takes a data sample and creates a string representation of the data.

The input character buffer must be big enough to store the string representation of the sample. Otherwise, the method will return an error.

To determine the minimum size of the input character buffer, the user must call this method with the buffer set to NULL.

If the size of the output string is longer than the size of an unsigned 32-bit integer, this operation will fail with DDS_RETCODE_OUT_OF_RESOURCES.

This method is only provided for types that were generated with typecodes.

Parameters
sample<<in>>. The sample to get the string representation for. Cannot be NULL.
str<<out>>. Output string representing the data sample.
str_size<<inout>>. When str is set to NULL, after the method executes, str_size will contain a buffer size big enough to hold the string representation of the data. When str is not NULL, str_size must contain the size of the input buffer when the method is invoked. If the size of the input buffer is too small, after the method executes, str_size will be updated to contain the required size of the string content and the method will return DDS_RETCODE_OUT_OF_RESOURCES.
property<<in>>. Properties describing what the format of the output string should be.
Exceptions
Oneof the Standard Return Codes, DDS_RETCODE_OUT_OF_RESOURCES

◆ get_typecode()

static DDS_TypeCode * FooTypeSupport::get_typecode ( )
static

<<extension>> Retrieves the TypeCode for the Type.

This method retrieves the DDS_TypeCode for the Type. A DDS_TypeCode is a mechanism for representing a type at runtime. RTI Connext can use type codes to send type definitions on the network. A DDS_TypeCode value consists of a type code kind (represented by the DDS_TCKind enumeration) and a list of members (that is, fields). These members are recursive: each one has its own DDS_TypeCode, and in the case of complex types (structures, arrays, and so on), these contained type codes contain their own members.

Returns
The TypeCode for this type