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.
typedef
s in C and C++).
Deleting type definitions:static DDS_TypeCodeFactory* DDS_TypeCodeFactory::get_instance | ( | ) | [static] |
Gets the singleton instance of this class.
DDS_TypeCode* DDS_TypeCodeFactory::clone_tc | ( | const DDS_TypeCode * | tc, | |
DDS_ExceptionCode_t & | ex | |||
) |
Creates and returns a copy of the input DDS_TypeCode.
tc | <<in>> Type code that will be copied. Cannot be NULL. | |
ex | <<out>> Parameter for error indications. The values that can take are: |
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.
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.
DDS_g_tc_short
DDS_g_tc_char
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.
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: |
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.
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: |
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.
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: |
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.
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: |
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.
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: |
DDS_TypeCode* DDS_TypeCodeFactory::create_string_tc | ( | DDS_UnsignedLong | bound, | |
DDS_ExceptionCode_t & | ex | |||
) |
Constructs a DDS_TK_STRING DDS_TypeCode.
bound | <<in>> Maximum length of the string. | |
ex | <<out>> Parameter for error indications. The values that can take are: |
DDS_TypeCode* DDS_TypeCodeFactory::create_wstring_tc | ( | DDS_UnsignedLong | bound, | |
DDS_ExceptionCode_t & | ex | |||
) |
Constructs a DDS_TK_WSTRING DDS_TypeCode.
bound | <<in>> Maximum length of the wide string. | |
ex | <<out>> Parameter for error indications. The values that can take are: |
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.
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: |
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.
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: |
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.
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: |
DDS_TypeCode* DDS_TypeCodeFactory::create_sparse_tc | ( | const char * | name, | |
DDS_ValueModifier | type_modifier, | |||
const DDS_TypeCode * | concrete_base, | |||
DDS_ExceptionCode_t & | ex | |||
) |
Constructs a DDS_TK_SPARSE DDS_TypeCode.
A sparse value type is similar to other value types but with one major difference: not all members need to be present in every sample.
It is not possible to generate code for sparse value types; they must be created at runtime using these APIs. You will interact with samples of sparse types using the Dynamic Data APIs.
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. | |
ex | <<out>> Parameter for error indications. The values that can take are: |