RTI Connext Traditional C++ API Version 7.2.0
DDS_TypeCodeFactory Struct Reference

A singleton factory for creating, copying, and deleting data type definitions dynamically. More...

Public Member Functions

DDS_TypeCodeclone_tc (const DDS_TypeCode *tc, DDS_ExceptionCode_t &ex)
 Creates and returns a copy of the input DDS_TypeCode. More...
 
void delete_tc (DDS_TypeCode *tc, DDS_ExceptionCode_t &ex)
 Deletes the input DDS_TypeCode. More...
 
const DDS_TypeCodeget_primitive_tc (DDS_TCKind tc_kind)
 Get the DDS_TypeCode for a primitive type (integers, floating point values, etc.) identified by the given DDS_TCKind. More...
 
DDS_TypeCodecreate_struct_tc (const char *name, const DDS_StructMemberSeq &members, DDS_ExceptionCode_t &ex)
 Constructs a DDS_TK_STRUCT DDS_TypeCode. More...
 
DDS_TypeCodecreate_struct_tc (const char *name, DDS_ExtensibilityKind extensibility_kind, const DDS_StructMemberSeq &members, DDS_ExceptionCode_t &ex)
 Constructs a DDS_TK_STRUCT DDS_TypeCode. More...
 
DDS_TypeCodecreate_value_tc (const char *name, DDS_ValueModifier type_modifier, const DDS_TypeCode *concrete_base, const DDS_ValueMemberSeq &members, DDS_ExceptionCode_t &ex)
 Constructs a DDS_TK_VALUE DDS_TypeCode. More...
 
DDS_TypeCodecreate_value_tc (const char *name, DDS_ExtensibilityKind extensibility_kind, DDS_ValueModifier type_modifier, const DDS_TypeCode *concrete_base, const DDS_ValueMemberSeq &members, DDS_ExceptionCode_t &ex)
 Constructs a DDS_TK_VALUE DDS_TypeCode. More...
 
DDS_TypeCodecreate_union_tc (const char *name, const DDS_TypeCode *discriminator_type, DDS_Long default_index, const DDS_UnionMemberSeq &members, DDS_ExceptionCode_t &ex)
 Constructs a DDS_TK_UNION DDS_TypeCode. More...
 
DDS_TypeCodecreate_union_tc (const char *name, DDS_ExtensibilityKind extensibility_kind, const DDS_TypeCode *discriminator_type, DDS_Long default_index, const DDS_UnionMemberSeq &members, DDS_ExceptionCode_t &ex)
 Constructs a DDS_TK_UNION DDS_TypeCode. More...
 
DDS_TypeCodecreate_enum_tc (const char *name, const DDS_EnumMemberSeq &members, DDS_ExceptionCode_t &ex)
 Constructs a DDS_TK_ENUM DDS_TypeCode. More...
 
DDS_TypeCodecreate_enum_tc (const char *name, DDS_ExtensibilityKind extensibility_kind, const DDS_EnumMemberSeq &members, DDS_ExceptionCode_t &ex)
 Constructs a DDS_TK_ENUM DDS_TypeCode. More...
 
DDS_TypeCodecreate_alias_tc (const char *name, const DDS_TypeCode *original_type, DDS_Boolean is_pointer, DDS_ExceptionCode_t &ex)
 Constructs a DDS_TK_ALIAS (typedef) DDS_TypeCode. More...
 
DDS_TypeCodecreate_string_tc (DDS_UnsignedLong bound, DDS_ExceptionCode_t &ex)
 Constructs a DDS_TK_STRING DDS_TypeCode. More...
 
DDS_TypeCodecreate_wstring_tc (DDS_UnsignedLong bound, DDS_ExceptionCode_t &ex)
 Constructs a DDS_TK_WSTRING DDS_TypeCode. More...
 
DDS_TypeCodecreate_sequence_tc (DDS_UnsignedLong bound, const DDS_TypeCode *element_type, DDS_ExceptionCode_t &ex)
 Constructs a DDS_TK_SEQUENCE DDS_TypeCode. More...
 
DDS_TypeCodecreate_array_tc (const DDS_UnsignedLongSeq &dimensions, const DDS_TypeCode *element_type, DDS_ExceptionCode_t &ex)
 Constructs a DDS_TK_ARRAY DDS_TypeCode. More...
 
DDS_TypeCodecreate_array_tc (DDS_UnsignedLong length, const DDS_TypeCode *element_type, DDS_ExceptionCode_t &ex)
 Constructs a DDS_TK_ARRAY DDS_TypeCode for a single-dimensional array. More...
 

Static Public Member Functions

static DDS_TypeCodeFactoryget_instance ()
 Gets the singleton instance of this class. More...
 

Detailed Description

A singleton factory for creating, copying, and deleting data type definitions dynamically.

You can access the singleton with the DDS_TypeCodeFactory::get_instance method.

If you want to publish and subscribe to data of types that are not known to you at system design time, this class will be your starting point. After creating a data type definition with this class, you will modify that definition using the DDS_TypeCode class and then register it with the Dynamic Data API.

The methods of this class fall into several categories:

Getting definitions for primitive types:
Type definitions for primitive types (e.g. integers, floating point values, etc.) are pre-defined; your application only needs to get them, not create them.

Creating definitions for strings, arrays, and sequences:
Type definitions for strings, arrays, and sequences (i.e. variables-size lists) must be created as you need them, because the type definition includes the maximum length of those containers.

Creating definitions for structured types:
Structured types include structures, value types, and unions.

Creating definitions for other types:
The type system also supports enumerations and aliases (i.e. typedefs in C and C++).

Deleting type definitions:
When you're finished using a type definition, you should delete it. (Note that you only need to delete a DDS_TypeCode that you created; if you got the object from DDS_TypeCodeFactory::get_primitive_tc, you must not delete it.)

Copying type definitions:
You can also create deep copies of type definitions:

Member Function Documentation

◆ get_instance()

static DDS_TypeCodeFactory * DDS_TypeCodeFactory::get_instance ( )
static

Gets the singleton instance of this class.

Returns
The DDS_TypeCodeFactory instance if no errors. Otherwise, NULL.
MT Safety:
UNSAFE. In VxWorks, it is unsafe to call this method while another thread may be simultaneously calling DDSDomainParticipantFactory::get_instance, DDSDomainParticipantFactory::finalize_instance, DDS_TypeCodeFactory::get_instance, NDDSUtilityNetworkCapture::enable, or NDDSUtilityNetworkCapture::disable.

◆ clone_tc()

DDS_TypeCode * DDS_TypeCodeFactory::clone_tc ( const DDS_TypeCode tc,
DDS_ExceptionCode_t ex 
)

Creates and returns a copy of the input DDS_TypeCode.

Parameters
tc<<in>> Type code that will be copied. Cannot be NULL.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A clone of tc.

◆ delete_tc()

void DDS_TypeCodeFactory::delete_tc ( DDS_TypeCode tc,
DDS_ExceptionCode_t ex 
)

Deletes the input DDS_TypeCode.

All the type codes created through the DDS_TypeCodeFactory must be deleted using this method.

Parameters
tc<<inout>> Type code that will be deleted. Cannot be NULL.
ex<<out>> Parameter for error indications. The values that can take are:

◆ get_primitive_tc()

const DDS_TypeCode * DDS_TypeCodeFactory::get_primitive_tc ( DDS_TCKind  tc_kind)

Get the DDS_TypeCode for a primitive type (integers, floating point values, etc.) identified by the given DDS_TCKind.

This method is equivalent to, and replaces, the DDS_g_tc_* constants.

See also
DDS_g_tc_long
DDS_g_tc_ulong
DDS_g_tc_short
DDS_g_tc_ushort
DDS_g_tc_float
DDS_g_tc_double
DDS_g_tc_longdouble
DDS_g_tc_octet
DDS_g_tc_boolean
DDS_g_tc_char
DDS_g_tc_wchar

◆ create_struct_tc() [1/2]

DDS_TypeCode * DDS_TypeCodeFactory::create_struct_tc ( const char *  name,
const DDS_StructMemberSeq members,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_STRUCT DDS_TypeCode.

Parameters
name<<in>> Name of the struct type. Cannot be NULL.
members<<in>> Initial members of the structure. This list may be empty (that is, FooSeq::length() may return zero). If the list is not empty, the elements must describe valid struct members. (For example, the names must be unique within the type.)
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a struct.

◆ create_struct_tc() [2/2]

DDS_TypeCode * DDS_TypeCodeFactory::create_struct_tc ( const char *  name,
DDS_ExtensibilityKind  extensibility_kind,
const DDS_StructMemberSeq members,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_STRUCT DDS_TypeCode.

Parameters
name<<in>> Name of the struct type. Cannot be NULL.
extensibility_kind<<in>> Type extensibility.
members<<in>> Initial members of the structure. This list may be empty (that is, FooSeq::length() may return zero). If the list is not empty, the elements must describe valid struct members. (For example, the names must be unique within the type.)
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a struct.

◆ create_value_tc() [1/2]

DDS_TypeCode * DDS_TypeCodeFactory::create_value_tc ( const char *  name,
DDS_ValueModifier  type_modifier,
const DDS_TypeCode concrete_base,
const DDS_ValueMemberSeq members,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_VALUE DDS_TypeCode.

Parameters
name<<in>> Name of the value type. Cannot be NULL.
type_modifier<<in>> One of the value type modifier constants: DDS_VM_NONE, DDS_VM_CUSTOM, DDS_VM_ABSTRACT or DDS_VM_TRUNCATABLE.
concrete_base<<in>> DDS_TypeCode object describing the concrete valuetype base. It may be NULL if the valuetype does not have a concrete base.
members<<in>> Initial members of the value type. This list may be empty. If the list is not empty, the elements must describe valid value type members. (For example, the names must be unique within the type.)
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a value.

◆ create_value_tc() [2/2]

DDS_TypeCode * DDS_TypeCodeFactory::create_value_tc ( const char *  name,
DDS_ExtensibilityKind  extensibility_kind,
DDS_ValueModifier  type_modifier,
const DDS_TypeCode concrete_base,
const DDS_ValueMemberSeq members,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_VALUE DDS_TypeCode.

Parameters
name<<in>> Name of the value type. Cannot be NULL.
extensibility_kind<<in>> Type extensibility.
type_modifier<<in>> One of the value type modifier constants: DDS_VM_NONE, DDS_VM_CUSTOM, DDS_VM_ABSTRACT or DDS_VM_TRUNCATABLE.
concrete_base<<in>> DDS_TypeCode object describing the concrete valuetype base. It may be NULL if the valuetype does not have a concrete base.
members<<in>> Initial members of the value type. This list may be empty. If the list is not empty, the elements must describe valid value type members. (For example, the names must be unique within the type.)
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a value.

◆ create_union_tc() [1/2]

DDS_TypeCode * DDS_TypeCodeFactory::create_union_tc ( const char *  name,
const DDS_TypeCode discriminator_type,
DDS_Long  default_index,
const DDS_UnionMemberSeq members,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_UNION DDS_TypeCode.

Parameters
name<<in>> Name of the union type. Cannot be NULL.
discriminator_type<<in>> Discriminator Type Code. Cannot be NULL.
default_index<<in>> Index of the default member, or -1 if there is no default member.
members<<in>> Initial members of the union. This list may be empty. If the list is not empty, the elements must describe valid struct members. (For example, the names must be unique within the type.)
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a union.

◆ create_union_tc() [2/2]

DDS_TypeCode * DDS_TypeCodeFactory::create_union_tc ( const char *  name,
DDS_ExtensibilityKind  extensibility_kind,
const DDS_TypeCode discriminator_type,
DDS_Long  default_index,
const DDS_UnionMemberSeq members,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_UNION DDS_TypeCode.

Parameters
name<<in>> Name of the union type. Cannot be NULL.
extensibility_kind<<in>> Type extensibility.
discriminator_type<<in>> Discriminator Type Code. Cannot be NULL.
default_index<<in>> Index of the default member, or -1 if there is no default member.
members<<in>> Initial members of the union. This list may be empty. If the list is not empty, the elements must describe valid struct members. (For example, the names must be unique within the type.)
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a union.

◆ create_enum_tc() [1/2]

DDS_TypeCode * DDS_TypeCodeFactory::create_enum_tc ( const char *  name,
const DDS_EnumMemberSeq members,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_ENUM DDS_TypeCode.

Parameters
name<<in>> Name of the enum type. Cannot be NULL.
members<<in>> Initial members of the enumeration. All members must have non-NULL names, and both names and ordinal values must be unique within the type. Note that it is also possible to add members later with DDS_TypeCode::add_member_to_enum.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing an enumeration.

◆ create_enum_tc() [2/2]

DDS_TypeCode * DDS_TypeCodeFactory::create_enum_tc ( const char *  name,
DDS_ExtensibilityKind  extensibility_kind,
const DDS_EnumMemberSeq members,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_ENUM DDS_TypeCode.

Parameters
name<<in>> Name of the enum type. Cannot be NULL.
extensibility_kind<<in>> Type extensibility.
members<<in>> Initial members of the enumeration. All members must have non-NULL names, and both names and ordinal values must be unique within the type. Note that it is also possible to add members later with DDS_TypeCode::add_member_to_enum.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing an enumeration.

◆ create_alias_tc()

DDS_TypeCode * DDS_TypeCodeFactory::create_alias_tc ( const char *  name,
const DDS_TypeCode original_type,
DDS_Boolean  is_pointer,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_ALIAS (typedef) DDS_TypeCode.

Parameters
name<<in>> Name of the alias. Cannot be NULL.
original_type<<in>> Aliased type code. Cannot be NULL.
is_pointer<<in>> Indicates if the alias is a pointer to the aliased type code.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing an alias.

◆ create_string_tc()

DDS_TypeCode * DDS_TypeCodeFactory::create_string_tc ( DDS_UnsignedLong  bound,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_STRING DDS_TypeCode.

Parameters
bound<<in>> Maximum length of the string.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a string.

◆ create_wstring_tc()

DDS_TypeCode * DDS_TypeCodeFactory::create_wstring_tc ( DDS_UnsignedLong  bound,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_WSTRING DDS_TypeCode.

Parameters
bound<<in>> Maximum length of the wide string.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a wide string.

◆ create_sequence_tc()

DDS_TypeCode * DDS_TypeCodeFactory::create_sequence_tc ( DDS_UnsignedLong  bound,
const DDS_TypeCode element_type,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_SEQUENCE DDS_TypeCode.

Parameters
bound<<in>> The bound for the sequence (> 0).
element_type<<in>> DDS_TypeCode object describing the sequence elements.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a sequence.

◆ create_array_tc() [1/2]

DDS_TypeCode * DDS_TypeCodeFactory::create_array_tc ( const DDS_UnsignedLongSeq dimensions,
const DDS_TypeCode element_type,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_ARRAY DDS_TypeCode.

Parameters
dimensions<<in>> Dimensions of the array. Each dimension has to be greater than 0.
element_type<<in>> DDS_TypeCode describing the array elements. Cannot be NULL.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a sequence.

◆ create_array_tc() [2/2]

DDS_TypeCode * DDS_TypeCodeFactory::create_array_tc ( DDS_UnsignedLong  length,
const DDS_TypeCode element_type,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_ARRAY DDS_TypeCode for a single-dimensional array.

Parameters
length<<in>> Length of the single-dimensional array.
element_type<<in>> DDS_TypeCode describing the array elements. Cannot be NULL.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a sequence.