RTI Connext Traditional C++ API Version 7.2.0

The definition of a particular data type, which you can use to inspect the name, members, and other properties of types generated with rtiddsgen (see the Code Generator User's Manual) or to modify types you define yourself at runtime. More...

Public Member Functions

DDS_TCKind kind (DDS_ExceptionCode_t &ex) const
 Gets the DDS_TCKind value of a type code. More...
 
DDS_ExtensibilityKind extensibility_kind (DDS_ExceptionCode_t &ex) const
 Gets the DDS_ExtensibilityKind value of a type code. More...
 
DDS_Boolean equal (const DDS_TypeCode *tc, DDS_ExceptionCode_t &ex) const
 Compares two DDS_TypeCode objects for equality. More...
 
const char * name (DDS_ExceptionCode_t &ex) const
 Retrieves the simple name identifying this DDS_TypeCode object within its enclosing scope. More...
 
DDS_UnsignedLong member_count (DDS_ExceptionCode_t &ex) const
 Returns the number of members of the type code. More...
 
const char * member_name (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 Returns the name of a type code member identified by the given index. More...
 
DDS_UnsignedLong find_member_by_name (const char *name, DDS_ExceptionCode_t &ex) const
 Get the index of the member of the given name. More...
 
DDS_TypeCodemember_type (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 Retrieves the DDS_TypeCode object describing the type of the member identified by the given index. More...
 
DDS_UnsignedLong member_label_count (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 Returns the number of labels associated to the index-th union member. More...
 
DDS_Long member_label (DDS_UnsignedLong member_index, DDS_UnsignedLong label_index, DDS_ExceptionCode_t &ex) const
 Return the label_index-th label associated to the member_index-th member. More...
 
DDS_Long member_ordinal (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 Returns the ordinal that corresponds to the index-th enum value. More...
 
DDS_Boolean is_member_key (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 Function that tells if a member is a key or not. More...
 
DDS_Boolean is_member_required (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 Indicates whether a given member of a type is required to be present in every sample of that type. More...
 
DDS_Boolean is_member_pointer (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 Function that tells if a member is a pointer or not. More...
 
DDS_Boolean is_member_bitfield (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 Function that tells if a member is a bitfield or not. More...
 
DDS_Short member_bitfield_bits (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 Returns the number of bits of a bitfield member. More...
 
DDS_Visibility member_visibility (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 Returns the constant that indicates the visibility of the index-th member. More...
 
DDS_TypeCodediscriminator_type (DDS_ExceptionCode_t &ex) const
 Returns the discriminator type code. More...
 
DDS_UnsignedLong length (DDS_ExceptionCode_t &ex) const
 Returns the number of elements in the type described by this type code. More...
 
DDS_UnsignedLong array_dimension_count (DDS_ExceptionCode_t &ex) const
 This function returns the number of dimensions of an array type code. More...
 
DDS_UnsignedLong array_dimension (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 This function returns the index-th dimension of an array type code. More...
 
DDS_UnsignedLong element_count (DDS_ExceptionCode_t &ex) const
 The number of elements in an array. More...
 
DDS_TypeCodecontent_type (DDS_ExceptionCode_t &ex) const
 Returns the DDS_TypeCode object representing the type for the members of the object described by this DDS_TypeCode object. More...
 
DDS_Boolean is_alias_pointer (DDS_ExceptionCode_t &ex) const
 Function that tells if an alias is a pointer or not. More...
 
DDS_Long default_index (DDS_ExceptionCode_t &ex) const
 Returns the index of the default member, or -1 if there is no default member. More...
 
DDS_TypeCodeconcrete_base_type (DDS_ExceptionCode_t &ex) const
 Returns the DDS_TypeCode that describes the concrete base type of the value type that this DDS_TypeCode object describes. More...
 
DDS_ValueModifier type_modifier (DDS_ExceptionCode_t &ex) const
 Returns a constant indicating the modifier of the value type that this DDS_TypeCode object describes. More...
 
DDS_Long member_id (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 Returns the ID of the TypeCode member identified by the given index. More...
 
DDS_UnsignedLong find_member_by_id (DDS_Long id, DDS_ExceptionCode_t &ex) const
 Get the index of the member of the given ID. More...
 
DDS_UnsignedLong get_type_object_serialized_size (DDS_ExceptionCode_t &ex) const
 Gets the serialized size of the TypeObject created from this DDS_TypeCode. More...
 
DDS_UnsignedLong get_cdr_serialized_sample_max_size (DDS_DataRepresentationId_t representation_id, DDS_ExceptionCode_t &ex) const
 [DEPRECATED] Gets the maximum serialized size of samples of this type More...
 
DDS_UnsignedLong cdr_serialized_sample_max_size (DDS_DataRepresentationId_t representation_id, DDS_ExceptionCode_t &ex) const
 Gets the maximum serialized size of samples of this type. More...
 
DDS_UnsignedLong cdr_serialized_sample_min_size (DDS_DataRepresentationId_t representation_id, DDS_ExceptionCode_t &ex) const
 Gets the minimum serialized size of samples of this type. More...
 
DDS_UnsignedLong cdr_serialized_sample_key_max_size (DDS_DataRepresentationId_t representation_id, DDS_ExceptionCode_t &ex) const
 Gets the maximum serialized size of sample keys of this type. More...
 
DDS_UnsignedLong cdr_serialized_sample_max_size (DDS_ExceptionCode_t &ex) const
 Gets the maximum serialized size of samples of this type. More...
 
DDS_UnsignedLong cdr_serialized_sample_min_size (DDS_ExceptionCode_t &ex) const
 Gets the minimum serialized size of samples of this type. More...
 
DDS_UnsignedLong cdr_serialized_sample_key_max_size (DDS_ExceptionCode_t &ex) const
 Gets the maximum serialized size of sample keys of this type. More...
 
DDS_UnsignedLong add_member_to_enum (const char *name, DDS_Long ordinal, DDS_ExceptionCode_t &ex)
 Add a new enumerated constant to this enum DDS_TypeCode. More...
 
DDS_UnsignedLong add_member_to_union (const char *name, DDS_Long id, const DDS_LongSeq &labels, const DDS_TypeCode *tc, DDS_Boolean is_pointer, DDS_ExceptionCode_t &ex)
 Add a new member to a union DDS_TypeCode. More...
 
DDS_UnsignedLong add_member (const char *name, DDS_Long id, const DDS_TypeCode *tc, DDS_Octet member_flags, DDS_ExceptionCode_t &ex)
 Add a new member to this DDS_TypeCode. More...
 
DDS_UnsignedLong add_member_ex (const char *name, DDS_Long id, const DDS_TypeCode *tc, DDS_Octet member_flags, DDS_Visibility visibility, DDS_Boolean is_pointer, DDS_Short bits, DDS_ExceptionCode_t &ex)
 Add a new member to this DDS_TypeCode. More...
 
const DDS_AnnotationParameterValuedefault_value (DDS_ExceptionCode_t &ex)
 Returns the default annotation for this DDS_TypeCode. More...
 
const DDS_AnnotationParameterValuemin_value (DDS_ExceptionCode_t &ex)
 Returns the min annotation for this DDS_TypeCode. More...
 
const DDS_AnnotationParameterValuemax_value (DDS_ExceptionCode_t &ex)
 Returns the max annotation for this DDS_TypeCode. More...
 
const DDS_AnnotationParameterValuemember_default_value (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex)
 Returns the member default annotation for this DDS_TypeCode. More...
 
const DDS_AnnotationParameterValuemember_min_value (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex)
 Returns the member min annotation for this DDS_TypeCode. More...
 
const DDS_AnnotationParameterValuemember_max_value (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex)
 Returns the member max annotation for this DDS_TypeCode. More...
 
void print_IDL (DDS_UnsignedLong indent, DDS_ExceptionCode_t &ex) const
 Prints a DDS_TypeCode in IDL notation. More...
 
void print (const DDS_TypeCodePrintFormatProperty &format, DDS_ExceptionCode_t &ex) const
 Prints a DDS_TypeCode. More...
 
void to_string (char *str, DDS_UnsignedLong &str_size, DDS_ExceptionCode_t &ex) const
 Get a string representation of this DDS_TypeCode object using the default values for DDS_TypeCodePrintFormatProperty. More...
 
void to_string (char *str, DDS_UnsignedLong &str_size, const DDS_TypeCodePrintFormatProperty &format, DDS_ExceptionCode_t &ex) const
 Get a string representation of this DDS_TypeCode object using the format described by DDS_TypeCodePrintFormatProperty. More...
 

Detailed Description

The definition of a particular data type, which you can use to inspect the name, members, and other properties of types generated with rtiddsgen (see the Code Generator User's Manual) or to modify types you define yourself at runtime.

You create DDS_TypeCode objects using the DDS_TypeCodeFactory singleton. Then you can use the methods on this class to inspect and modify the data type definition.

This class is based on a similar class from CORBA.

MT Safety:
SAFE for read-only access, UNSAFE for modification. Modifying a single DDS_TypeCode object concurrently from multiple threads is unsafe. Modifying a DDS_TypeCode from a single thread while concurrently reading the state of that DDS_TypeCode from another thread is also unsafe. However, reading the state of a DDS_TypeCode concurrently from multiple threads, without any modification, is safe.
Examples
HelloWorld.cxx, and HelloWorldPlugin.cxx.

Member Function Documentation

◆ kind()

DDS_TCKind DDS_TypeCode::kind ( DDS_ExceptionCode_t ex) const

Gets the DDS_TCKind value of a type code.

Parameters
ex<<out>> Parameter for error indications. The values that it can take are:

Retrieves the kind of this DDS_TypeCode object. The kind of a type code determines which DDS_TypeCode methods may legally be invoked on it.

MT Safety:
SAFE.
Returns
The type code kind.

◆ extensibility_kind()

DDS_ExtensibilityKind DDS_TypeCode::extensibility_kind ( DDS_ExceptionCode_t ex) const

Gets the DDS_ExtensibilityKind value of a type code.

Parameters
ex<<out>> Parameter for error indications. The values that it can take are:

Retrieves the extensibility kind of this DDS_TypeCode object.

In some cases, it is desirable for types to evolve without breaking interoperability with deployed components already using those types. For example:

  • A new set of applications to be integrated into an existing system may want to introduce additional fields into a structure. These new fields can be safely ignored by already deployed applications, but applications that do understand the new fields can benefit from their presence.

  • A new set of applications to be integrated into an existing system may want to increase the maximum size of some sequence or string in a Type. Existing applications can receive data samples from these new applications as long as the actual number of elements (or length of the strings) in the received data sample does not exceed what the receiving applications expects. If a received data sample exceeds the limits expected by the receiving application, then the sample can be safely ignored (filtered out) by the receiver.

In order to support use cases such as these, the type system introduces the concept of extensible and mutable types.

  • A type may be final, indicating that the range of its possible data values is strictly defined. In particular, it is not possible to add elements to members of collection or aggregated types while maintaining type assignability.

  • A type may be extensible, indicating that two types, where one contains all of the elements/members of the other plus additional elements/members appended to the end, may remain assignable.

  • A type may be mutable, indicating that two types may differ from one another in the additional, removal, and/or transposition of elements/members while remaining assignable.

The extensibility of DDS_TK_STRUCT, DDS_TK_UNION, DDS_TK_VALUE, and DDS_TK_ENUM can be change using the built-in "Extensibility" annotation when the type is declared.

IDL examples:

struct MyType {
long member_1;
} //@Extensibility FINAL_EXTENSIBILITY
struct MyType {
long member_1;
} //@Extensibility EXTENSIBLE_EXTENSIBILITY
struct MyType {
long member_1;
} //@Extensibility MUTABLE_EXTENSIBILITY

XML example:

<struct name="MyType" extensibility="final">
<member name="member_1" type="long"/>
</struct>
const char * name(DDS_ExceptionCode_t &ex) const
Retrieves the simple name identifying this DDS_TypeCode object within its enclosing scope.
<struct name="MyType" extensibility="extensible">
<member name="member_1" type="long"/>
</struct>
<struct name="MyType" extensibility="mutable">
<member name="member_1" type="long"/>
</struct>

XSD example:

<xsd:complexType name="MyType">
<xsd:sequence>
<xsd:element name="member_1" minOccurs="1" maxOccurs="1" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
<!-- @struct true -->
<!-- @extensibility FINAL_EXTENSIBILITY -->
<xsd:complexType name="MyType">
<xsd:sequence>
<xsd:element name="member_1" minOccurs="1" maxOccurs="1" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
<!-- @struct true -->
<!-- @extensibility EXTENSIBLE_EXTENSIBILITY -->
<xsd:complexType name="MyType">
<xsd:sequence>
<xsd:element name="member_1" minOccurs="1" maxOccurs="1" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
<!-- @struct true -->
<!-- @extensibility MUTABLE_EXTENSIBILITY -->

For TypeCodes built at run-time using the DDS_TypeCodeFactory API, the extensibility can be provided as a parameter of the following APIs:

See also
DDS_ExtensibilityKind
MT Safety:
SAFE.
Returns
The type code extensibility kind.

◆ equal()

DDS_Boolean DDS_TypeCode::equal ( const DDS_TypeCode tc,
DDS_ExceptionCode_t ex 
) const

Compares two DDS_TypeCode objects for equality.

MT Safety:
SAFE.

For equality and assignability purposes, DDS_TK_STRUCT and DDS_TK_VALUE are considered equivalent.

The DDS_TypeCode of structs inheriting from other structs has a DDS_TK_VALUE kind.

For example:

struct MyStruct: MyBaseStruct {
long member_1;
};

The code generation for the previous type will generate a DDS_TypeCode with DDS_TK_VALUE kind.

Parameters
tc<<in>> Type code that will be compared with this DDS_TypeCode.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
DDS_BOOLEAN_TRUE if the type codes are equal. Otherwise, DDS_BOOLEAN_FALSE.

◆ name()

const char * DDS_TypeCode::name ( DDS_ExceptionCode_t ex) const

Retrieves the simple name identifying this DDS_TypeCode object within its enclosing scope.

Precondition
self kind is DDS_TK_STRUCT, DDS_TK_UNION, DDS_TK_ENUM, DDS_TK_VALUE, or DDS_TK_ALIAS.
MT Safety:
SAFE.
Parameters
ex<<out>> Parameter for error indications. The values that can take are:
Returns
Name of the type code if no errors.

◆ member_count()

DDS_UnsignedLong DDS_TypeCode::member_count ( DDS_ExceptionCode_t ex) const

Returns the number of members of the type code.

The method member_count can be invoked on structure, union, and enumeration DDS_TypeCode objects.

Precondition
self kind is DDS_TK_STRUCT, DDS_TK_UNION, DDS_TK_ENUM or DDS_TK_VALUE.
MT Safety:
SAFE.
Parameters
ex<<out>> Parameter for error indications. The values that can take are:
Returns
The number of members constituting the type described by this DDS_TypeCode object if no errors.

◆ member_name()

const char * DDS_TypeCode::member_name ( DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
) const

Returns the name of a type code member identified by the given index.

The method member_name can be invoked on structure, union, and enumeration DDS_TypeCode objects.

Precondition
self kind is DDS_TK_STRUCT, DDS_TK_UNION, DDS_TK_ENUM or DDS_TK_VALUE.
The index param must be in the interval [0,(member count-1)].
MT Safety:
SAFE.
Parameters
index<<in>> Member index in the interval [0,(member count-1)].
ex<<out>> Parameter for error indications. The values that can take are:
Returns
Name of the member if no errors.

◆ find_member_by_name()

DDS_UnsignedLong DDS_TypeCode::find_member_by_name ( const char *  name,
DDS_ExceptionCode_t ex 
) const

Get the index of the member of the given name.

This method is applicable to DDS_TypeCode objects representing structs (DDS_TK_STRUCT) and union (DDS_TK_UNION) types.

Parameters
name<<in>> The member name.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
The index of the member of the given name or DDS_TYPECODE_INDEX_INVALID if the member is not found.
MT Safety:
SAFE.

◆ member_type()

DDS_TypeCode * DDS_TypeCode::member_type ( DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
) const

Retrieves the DDS_TypeCode object describing the type of the member identified by the given index.

The method member_type can be invoked on structure and union type codes.

Precondition
self kind is DDS_TK_STRUCT, DDS_TK_UNION or DDS_TK_VALUE.
The index param must be in the interval [0,(member count-1)].
MT Safety:
SAFE.
Parameters
index<<in>> Member index in the interval [0,(member count-1)].
ex<<out>> Parameter for error indications. The values that can take are:
Returns
The DDS_TypeCode object describing the member at the given index if no errors.

◆ member_label_count()

DDS_UnsignedLong DDS_TypeCode::member_label_count ( DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
) const

Returns the number of labels associated to the index-th union member.

The method can be invoked on union DDS_TypeCode objects.

This function is an RTI Connext extension to the CORBA Type Code Specification.

Precondition
self kind is DDS_TK_UNION.
The index param must be in the interval [0,(member count-1)].
MT Safety:
SAFE.
Parameters
index<<in>> Member index in the interval [0,(member count-1)].
ex<<out>> Parameter for error indications. The values that can take are:
Returns
Number of labels if no errors.

◆ member_label()

DDS_Long DDS_TypeCode::member_label ( DDS_UnsignedLong  member_index,
DDS_UnsignedLong  label_index,
DDS_ExceptionCode_t ex 
) const

Return the label_index-th label associated to the member_index-th member.

This method has been modified for RTI Connext from the CORBA Type code Specification.

Example:
  case 1: Label index 0
  case 2: Label index 1
    short short_member;

The method can be invoked on union DDS_TypeCode objects.

Precondition
self kind is DDS_TK_UNION.
The member_index param must be in the interval [0,(member count-1)].
The label_index param must be in the interval [0,(member labels count-1)].
MT Safety:
SAFE.
Parameters
member_index<<in>> Member index.
label_index<<in>> Label index.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
The evaluated value of the label if no errors.

◆ member_ordinal()

DDS_Long DDS_TypeCode::member_ordinal ( DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
) const

Returns the ordinal that corresponds to the index-th enum value.

The method can be invoked on enum DDS_TypeCode objects.

This function is an RTI Connext extension to the CORBA Type Code Specification.

Precondition
self kind is DDS_TK_ENUM.
Member index in the interval [0,(member count-1)].
MT Safety:
SAFE.
Parameters
index<<in>> Member index in the interval [0,(member count-1)].
ex<<out>> Parameter for error indications. The values that can take are:
Returns
Ordinal that corresponds to the index-th enumerator if no errors.

◆ is_member_key()

DDS_Boolean DDS_TypeCode::is_member_key ( DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
) const

Function that tells if a member is a key or not.

This function is an RTI Connext extension to the CORBA Type Code Specification.

Precondition
self kind is DDS_TK_STRUCT or DDS_TK_VALUE.
The index param must be in the interval [0,(member count-1)].
MT Safety:
SAFE.
Parameters
index<<in>> Member index in the interval [0,(member count-1)].
ex<<out>> Parameter for error indications. The values that can take are:
Returns
DDS_BOOLEAN_TRUE if the member is a key. Otherwise, DDS_BOOLEAN_FALSE.

◆ is_member_required()

DDS_Boolean DDS_TypeCode::is_member_required ( DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
) const

Indicates whether a given member of a type is required to be present in every sample of that type.

A non-key member is required if it has not been marked as optional. All key members are required.

See also
DDS_TYPECODE_NONKEY_MEMBER
DDS_TYPECODE_NONKEY_REQUIRED_MEMBER
MT Safety:
SAFE.

◆ is_member_pointer()

DDS_Boolean DDS_TypeCode::is_member_pointer ( DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
) const

Function that tells if a member is a pointer or not.

The method is_member_pointer can be invoked on union and structs type objects

This function is an RTI Connext extension to the CORBA Type Code Specification.

Precondition
self kind is DDS_TK_STRUCT, DDS_TK_UNION or DDS_TK_VALUE.
The index param must be in the interval [0,(member count-1)].
MT Safety:
SAFE.
Parameters
index<<in>> Index of the member for which type information is begin requested.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
DDS_BOOLEAN_TRUE if the member is a pointer. Otherwise, DDS_BOOLEAN_FALSE.

◆ is_member_bitfield()

DDS_Boolean DDS_TypeCode::is_member_bitfield ( DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
) const

Function that tells if a member is a bitfield or not.

The method can be invoked on struct type objects.

This function is an RTI Connext extension to the CORBA Type Code Specification.

Precondition
self kind is DDS_TK_STRUCT or DDS_TK_VALUE.
The index param must be in the interval [0,(member count-1)].
MT Safety:
SAFE.
Parameters
index<<in>> Member index in the interval [0,(member count-1)].
ex<<out>> Parameter for error indications. The values that can take are:
Returns
DDS_BOOLEAN_TRUE if the member is a bitfield. Otherwise, DDS_BOOLEAN_FALSE.

◆ member_bitfield_bits()

DDS_Short DDS_TypeCode::member_bitfield_bits ( DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
) const

Returns the number of bits of a bitfield member.

The method can be invoked on struct type objects.

This function is an RTI Connext extension to the CORBA Type Code Specification.

Precondition
self kind is DDS_TK_STRUCT or DDS_TK_VALUE.
The index param must be in the interval [0,(member count-1)].
MT Safety:
SAFE.
Parameters
index<<in>> Member index in the interval [0,(member count-1)].
ex<<out>> Parameter for error indications. The values that can take are:
Returns
The number of bits of the bitfield or DDS_TYPECODE_NOT_BITFIELD if the member is not a bitfield.

◆ member_visibility()

DDS_Visibility DDS_TypeCode::member_visibility ( DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
) const

Returns the constant that indicates the visibility of the index-th member.

Precondition
self kind is DDS_TK_VALUE or DDS_TK_STRUCT. The index param must be in the interval [0,(member count-1)].
MT Safety:
SAFE.

For DDS_TK_STRUCT, this method always returns DDS_PUBLIC_MEMBER.

Parameters
index<<in>> Member index in the interval [0,(member count-1)].
ex<<out>> Parameter for error indications. The values that can take are:
Returns
One of the following constants: DDS_PRIVATE_MEMBER or DDS_PUBLIC_MEMBER.

◆ discriminator_type()

DDS_TypeCode * DDS_TypeCode::discriminator_type ( DDS_ExceptionCode_t ex) const

Returns the discriminator type code.

The method discriminator_type can be invoked only on union DDS_TypeCode objects.

Precondition
self kind is DDS_TK_UNION.
MT Safety:
SAFE.
Parameters
ex<<out>> Parameter for error indications. The values that can take are:
Returns
DDS_TypeCode object describing the discriminator of the union type if no errors.

◆ length()

DDS_UnsignedLong DDS_TypeCode::length ( DDS_ExceptionCode_t ex) const

Returns the number of elements in the type described by this type code.

Length is:

  • The maximum length of the string for string type codes.
  • The maximum length of the sequence for sequence type codes.
  • The first dimension of the array for array type codes.
Precondition
self kind is DDS_TK_ARRAY, DDS_TK_SEQUENCE, DDS_TK_STRING or DDS_TK_WSTRING.
MT Safety:
SAFE.
Parameters
ex<<out>> Parameter for error indications. The values that can take are:
Returns
The bound for strings and sequences, or the number of elements for arrays if no errors.

◆ array_dimension_count()

DDS_UnsignedLong DDS_TypeCode::array_dimension_count ( DDS_ExceptionCode_t ex) const

This function returns the number of dimensions of an array type code.

This function is an RTI Connext extension to the CORBA Type Code Specification.

Precondition
self kind is DDS_TK_ARRAY.
MT Safety:
SAFE.
Parameters
ex<<out>> Parameter for error indications. The values that can take are:
Returns
Number of dimensions if no errors.

◆ array_dimension()

DDS_UnsignedLong DDS_TypeCode::array_dimension ( DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
) const

This function returns the index-th dimension of an array type code.

This function is an RTI Connext extension to the CORBA Type Code Specification.

Precondition
self kind is DDS_TK_ARRAY.
Dimension index in the interval [0,(dimensions count-1)].
MT Safety:
SAFE.
Parameters
index<<in>> Dimension index in the interval [0,(dimensions count-1)].
ex<<out>> Parameter for error indications. The values that can take are:
Returns
Requested dimension if no errors.

◆ element_count()

DDS_UnsignedLong DDS_TypeCode::element_count ( DDS_ExceptionCode_t ex) const

The number of elements in an array.

This operation isn't relevant for other kinds of types.

MT Safety:
SAFE.

◆ content_type()

DDS_TypeCode * DDS_TypeCode::content_type ( DDS_ExceptionCode_t ex) const

Returns the DDS_TypeCode object representing the type for the members of the object described by this DDS_TypeCode object.

For sequences and arrays, it returns the element type. For aliases, it returns the original type.

Precondition
self kind is DDS_TK_ARRAY, DDS_TK_SEQUENCE or DDS_TK_ALIAS.
MT Safety:
SAFE.
Parameters
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A DDS_TypeCode object representing the element type for sequences and arrays, and the original type for aliases.

◆ is_alias_pointer()

DDS_Boolean DDS_TypeCode::is_alias_pointer ( DDS_ExceptionCode_t ex) const

Function that tells if an alias is a pointer or not.

This function is an RTI Connext extension to the CORBA Type Code Specification.

Precondition
self kind is DDS_TK_ALIAS.
MT Safety:
SAFE.
Parameters
ex<<out>> Parameter for error indications. The values that can take are:
Returns
DDS_BOOLEAN_TRUE if an alias is a pointer to the aliased type. Otherwise, DDS_BOOLEAN_FALSE.

◆ default_index()

DDS_Long DDS_TypeCode::default_index ( DDS_ExceptionCode_t ex) const

Returns the index of the default member, or -1 if there is no default member.

The method default_index can be invoked only on union DDS_TypeCode objects.

Precondition
self kind is DDS_TK_UNION
MT Safety:
SAFE.
Parameters
ex<<out>> Parameter for error indications. The values that can take are:
Returns
The index of the default member, or -1 if there is no default member.

◆ concrete_base_type()

DDS_TypeCode * DDS_TypeCode::concrete_base_type ( DDS_ExceptionCode_t ex) const

Returns the DDS_TypeCode that describes the concrete base type of the value type that this DDS_TypeCode object describes.

Precondition
self kind is DDS_TK_VALUE or DDS_TK_STRUCT.
MT Safety:
SAFE.

For DDS_TK_STRUCT, this method always returns DDS_TK_NULL.

The DDS_TypeCode of structs inheriting from other structs has a DDS_TK_VALUE kind.

For example:

struct MyStruct: MyBaseStruct {
long member_1;
};

The code generation for the previous type will generate a DDS_TypeCode with DDS_TK_VALUE kind.

Parameters
ex<<out>> Parameter for error indications. The values that can take are:
Returns
DDS_TypeCode that describes the concrete base type or NULL if there is no a concrete base type.

◆ type_modifier()

DDS_ValueModifier DDS_TypeCode::type_modifier ( DDS_ExceptionCode_t ex) const

Returns a constant indicating the modifier of the value type that this DDS_TypeCode object describes.

Precondition
self kind is DDS_TK_VALUE or DDS_TK_STRUCT.

For DDS_TK_STRUCT, this method always returns DDS_VM_NONE.

MT Safety:
SAFE.
Parameters
ex<<out>> Parameter for error indications. The values that can take are:
Returns
One of the following type modifiers: DDS_VM_NONE, DDS_VM_ABSTRACT, DDS_VM_CUSTOM or DDS_VM_TRUNCATABLE.

◆ member_id()

DDS_Long DDS_TypeCode::member_id ( DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
) const

Returns the ID of the TypeCode member identified by the given index.

This function is an RTI Connext extension to the CORBA Type Code Specification.

The method can be invoked on aggregation DDS_TypeCode objects.

All members of aggregated types have an integral member ID that uniquely identifies them within their defining type.

In IDL, you can specify the member ID using the built-in annotation ID. For example:

struct MyType {
long member_1; //@ID 200
} //@Extensibility MUTABLE_EXTENSIBILITY

In XML, you can specify the member ID using the attribute 'id':

<struct name="MyType" extensibility="mutable" id="200">
<member name="member_1" type="long"/>
</struct>

In XSD, you can specify the member ID using the built-in annotation ID

<xsd:complexType name="MyType">
<xsd:sequence>
<xsd:element name="member_1" minOccurs="1" maxOccurs="1" type="xsd:int"/>
<!-- @id 200 -->
</xsd:sequence>
</xsd:complexType>
<!-- @extensibility MUTABLE_EXTENSIBILITY -->
Precondition
self kind is DDS_TK_STRUCT, DDS_TK_VALUE, or DDS_TK_UNION
Member index in the interval [0,(member count-1)].
MT Safety:
SAFE.
Parameters
index<<in>> Member index in the interval [0,(member count-1)].
ex<<out>> Parameter for error indications. The values that can take are:
Returns
ID of the member if no errors.

◆ find_member_by_id()

DDS_UnsignedLong DDS_TypeCode::find_member_by_id ( DDS_Long  id,
DDS_ExceptionCode_t ex 
) const

Get the index of the member of the given ID.

This method is applicable to DDS_TypeCode objects representing structs (DDS_TK_STRUCT) and union (DDS_TK_UNION) types.

Parameters
id<<in>> The member ID.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
The index of the member of the given ID or DDS_TYPECODE_INDEX_INVALID if the member is not found.
MT Safety:
SAFE.

◆ get_type_object_serialized_size()

DDS_UnsignedLong DDS_TypeCode::get_type_object_serialized_size ( DDS_ExceptionCode_t ex) const

Gets the serialized size of the TypeObject created from this DDS_TypeCode.

Parameters
ex<<out>> Parameter for error indications. The values that it can take are:

The default buffer size used for storing a TypeObject is 8192 bytes. For a large TypeObject, this API can be used to determine the size that needs to be set in DDS_DomainParticipantResourceLimitsQosPolicy::type_object_max_serialized_length

MT Safety:
SAFE.
Returns
The TypeObject serialized size.

◆ get_cdr_serialized_sample_max_size()

DDS_UnsignedLong DDS_TypeCode::get_cdr_serialized_sample_max_size ( DDS_DataRepresentationId_t  representation_id,
DDS_ExceptionCode_t ex 
) const

[DEPRECATED] Gets the maximum serialized size of samples of this type

DEPRECATED: use DDS_TypeCode::cdr_serialized_sample_max_size instead.

Obtains the maximum possible size in bytes of any serialized data sample of this type.

Precondition
The type is an aggregation type (struct, union)
Parameters
representation_idThe serialized data representation for which we calculate the maximum size.
ex<<out>> Parameter for error indications.
Returns
The maximum size

◆ cdr_serialized_sample_max_size() [1/2]

DDS_UnsignedLong DDS_TypeCode::cdr_serialized_sample_max_size ( DDS_DataRepresentationId_t  representation_id,
DDS_ExceptionCode_t ex 
) const

Gets the maximum serialized size of samples of this type.

Obtains the maximum possible size in bytes of any serialized data sample of this type.

Precondition
The type is an aggregation type (struct, union)
Parameters
representation_idThe serialized data representation for which we calculate the maximum size.
ex<<out>> Parameter for error indications.
Returns
The maximum size

◆ cdr_serialized_sample_min_size() [1/2]

DDS_UnsignedLong DDS_TypeCode::cdr_serialized_sample_min_size ( DDS_DataRepresentationId_t  representation_id,
DDS_ExceptionCode_t ex 
) const

Gets the minimum serialized size of samples of this type.

Obtains the minimum possible size in bytes of any serialized data sample of this type.

Precondition
The type is an aggregation type (struct, union)
Parameters
representation_idThe serialized data representation for which we calculate the minimum size.
ex<<out>> Parameter for error indications.
Returns
The minimum size

◆ cdr_serialized_sample_key_max_size() [1/2]

DDS_UnsignedLong DDS_TypeCode::cdr_serialized_sample_key_max_size ( DDS_DataRepresentationId_t  representation_id,
DDS_ExceptionCode_t ex 
) const

Gets the maximum serialized size of sample keys of this type.

Obtains the maximum possible size in bytes of the serialized keys of any data sample of this type

Precondition
The type is an aggregation type (struct, union)
Parameters
representation_idThe serialized data representation for which we calculate the maximum key size.
ex<<out>> Parameter for error indications.
Returns
The maximum key size

◆ cdr_serialized_sample_max_size() [2/2]

DDS_UnsignedLong DDS_TypeCode::cdr_serialized_sample_max_size ( DDS_ExceptionCode_t ex) const

Gets the maximum serialized size of samples of this type.

Obtains the maximum possible size in bytes of any serialized data sample of this type.

Assumes the DDS_DataRepresentationId_t to be DDS_AUTO_DATA_REPRESENTATION

Precondition
The type is an aggregation type (struct, union)
Parameters
ex<<out>> Parameter for error indications.
Returns
The maximum size

◆ cdr_serialized_sample_min_size() [2/2]

DDS_UnsignedLong DDS_TypeCode::cdr_serialized_sample_min_size ( DDS_ExceptionCode_t ex) const

Gets the minimum serialized size of samples of this type.

Obtains the minimum possible size in bytes of any serialized data sample of this type.

Assumes the DDS_DataRepresentationId_t to be DDS_AUTO_DATA_REPRESENTATION

Precondition
The type is an aggregation type (struct, union)
Parameters
ex<<out>> Parameter for error indications.
Returns
The minimum size

◆ cdr_serialized_sample_key_max_size() [2/2]

DDS_UnsignedLong DDS_TypeCode::cdr_serialized_sample_key_max_size ( DDS_ExceptionCode_t ex) const

Gets the maximum serialized size of sample keys of this type.

Obtains the maximum possible size in bytes of the serialized keys of any data sample of this type

Assumes the DDS_DataRepresentationId_t to be DDS_AUTO_DATA_REPRESENTATION

Precondition
The type is an aggregation type (struct, union)
Parameters
ex<<out>> Parameter for error indications.
Returns
The maximum key size

◆ add_member_to_enum()

DDS_UnsignedLong DDS_TypeCode::add_member_to_enum ( const char *  name,
DDS_Long  ordinal,
DDS_ExceptionCode_t ex 
)

Add a new enumerated constant to this enum DDS_TypeCode.

This method is applicable to DDS_TypeCode objects representing enumerations (DDS_TK_ENUM). To add a field to a structured type, see DDS_TypeCode::add_member_to_enum.

Modifying a DDS_TypeCode – such as by adding a member – is important if you are using the Dynamic Data APIs.

MT Safety:
UNSAFE.
Parameters
name<<in>> The name of the new member. This string must be unique within this type and must not be NULL.
ordinal<<in>> The relative order of the new member in this enum or a custom integer value. The value must be unique within the type.
ex<<out>> If this method fails, this argument will contain information about the failure. Possible values include:
Returns
The zero-based index of the new member relative to any other members that previously existed.
See also
DDS_TypeCode::add_member
DDS_TypeCode::add_member_ex
DDS_TypeCodeFactory

◆ add_member_to_union()

DDS_UnsignedLong DDS_TypeCode::add_member_to_union ( const char *  name,
DDS_Long  id,
const DDS_LongSeq labels,
const DDS_TypeCode tc,
DDS_Boolean  is_pointer,
DDS_ExceptionCode_t ex 
)

Add a new member to a union DDS_TypeCode.

This method is applicable to DDS_TypeCode objects representing unions (DDS_TK_UNION).

Modifying a DDS_TypeCode – such as by adding a member – is important if you are using the Dynamic Data APIs.

MT Safety:
UNSAFE.
Parameters
name<<in>> The name of the new member.
id<<in>> The member ID. For automatic assignment of the member ID specify DDS_TYPECODE_MEMBER_ID_INVALID.
labels<<in>> A sequence of labels or case values associated with the member .
tc<<in>> The type of the new member. You can get or create this DDS_TypeCode with the DDS_TypeCodeFactory.
is_pointer<<in>> Whether the data member, in its deserialized form, should be stored by pointer as opposed to by value.
ex<<out>> If this method fails, this argument will contain information about the failure.

Possible values include:

Returns
The zero-based index of the new member relative to any other members that previously existed.
See also
DDS_TypeCode::add_member
DDS_TypeCode::add_member_ex
DDS_TypeCode::add_member_to_enum
DDS_TypeCode::add_member_to_union
DDS_TypeCodeFactory
DDS_TYPECODE_NONKEY_MEMBER
DDS_TYPECODE_KEY_MEMBER
DDS_TYPECODE_NONKEY_REQUIRED_MEMBER

◆ add_member()

DDS_UnsignedLong DDS_TypeCode::add_member ( const char *  name,
DDS_Long  id,
const DDS_TypeCode tc,
DDS_Octet  member_flags,
DDS_ExceptionCode_t ex 
)

Add a new member to this DDS_TypeCode.

This method is applicable to DDS_TypeCode objects representing structures (DDS_TK_STRUCT), value types (DDS_TK_VALUE), and unions (DDS_TK_UNION). To add a constant to an enumeration, see DDS_TypeCode::add_member_to_enum.

Calling this method clones the type code passed as the tc parameter if the type code is not a builtin one. To delete this cloned type code, call DDS_TypeCodeFactory::delete_tc.

The ability to modify a DDS_TypeCode – such as by adding a member – is important if you are using the Dynamic Data APIs.

Here's a simple code example that adds two fields to a data type, one an integer and another a sequence of integers.

// Integer:
myTypeCode->add_member(
"myFieldName",
DDS_TheTypeCodeFactory->get_primitive_tc(DDS_TK_LONG),
// New field is a required non-key member:
// Sequence of 10 or fewer integers:
myTypeCode.add_member(
"myFieldName",
DDS_TheTypeCodeFactory->create_sequence_tc(
10,
DDS_TheTypeCodeFactory->get_primitive_tc(DDS_TK_LONG)),
// New field is a required non-key member:
#define DDS_TYPECODE_NONKEY_REQUIRED_MEMBER
A flag indicating that a type member is not part of the key but is nevertheless required.
Definition: typecode.ifc:355
#define DDS_TYPECODE_MEMBER_ID_INVALID
A sentinel indicating an invalid DDS_TypeCode member ID.
Definition: typecode.ifc:278
@ DDS_TK_LONG
long type.
Definition: typecode.ifc:149
MT Safety:
UNSAFE.
Parameters
name<<in>> The name of the new member.
id<<in>> Member ID or case value.
tc<<in>> The type of the new member. You can get or create this DDS_TypeCode with the DDS_TypeCodeFactory.
member_flags<<in>> Indicates whether the member is part of the key and whether it is required.
ex<<out>> If this method fails, this argument will contain information about the failure. Possible values include:
Returns
The zero-based index of the new member relative to any other members that previously existed.
See also
DDS_TypeCode::add_member_ex
DDS_TypeCode::add_member_to_enum
DDS_TypeCodeFactory
DDS_TYPECODE_NONKEY_MEMBER
DDS_TYPECODE_KEY_MEMBER
DDS_TYPECODE_NONKEY_REQUIRED_MEMBER

◆ add_member_ex()

DDS_UnsignedLong DDS_TypeCode::add_member_ex ( const char *  name,
DDS_Long  id,
const DDS_TypeCode tc,
DDS_Octet  member_flags,
DDS_Visibility  visibility,
DDS_Boolean  is_pointer,
DDS_Short  bits,
DDS_ExceptionCode_t ex 
)

Add a new member to this DDS_TypeCode.

This method is applicable to DDS_TypeCode objects representing structures (DDS_TK_STRUCT), value types (DDS_TK_VALUE), and unions (DDS_TK_UNION). To add a constant to an enumeration, see DDS_TypeCode::add_member_to_enum.

Calling this method clones the type code passed in as the tc parameter if the type code is not a builtin one. To delete this cloned type code, call DDS_TypeCodeFactory::delete_tc.

The ability to modify a DDS_TypeCode – such as by adding a member – is important if you are using the Dynamic Data APIs.

MT Safety:
UNSAFE.
Parameters
name<<in>> The name of the new member.
id<<in>> Member ID or case value.
tc<<in>> The type of the new member. You can get or create this DDS_TypeCode with the DDS_TypeCodeFactory.
member_flags<<in>> Indicates whether the member is part of the key and whether it is required.
visibility<<in>> Whether the new member is public or private. Non-public members are only relevant for types of kind DDS_TK_VALUE. Possible values include:
is_pointer<<in>> Whether the data member, in its deserialized form, should be stored by pointer as opposed to by value.
bits<<in>> The number of bits, if this new member is a bit field, or DDS_TYPECODE_NOT_BITFIELD.
ex<<out>> If this method fails, this argument will contain information about the failure. Possible values include:
Returns
The zero-based index of the new member relative to any other members that previously existed.
See also
DDS_TypeCode::add_member
DDS_TypeCode::add_member_to_enum
DDS_TypeCode::add_member_to_union
DDS_TypeCodeFactory
DDS_TYPECODE_NONKEY_MEMBER
DDS_TYPECODE_KEY_MEMBER
DDS_TYPECODE_NONKEY_REQUIRED_MEMBER

◆ default_value()

const DDS_AnnotationParameterValue * DDS_TypeCode::default_value ( DDS_ExceptionCode_t ex)

Returns the default annotation for this DDS_TypeCode.

Precondition
self kind is DDS_TK_ENUM, or DDS_TK_ALIAS.
MT Safety:
SAFE
Parameters
ex<<out>> Parameter for error indications. The values that can take are:
Returns
the default annotation for this DDS_TypeCode

◆ min_value()

const DDS_AnnotationParameterValue * DDS_TypeCode::min_value ( DDS_ExceptionCode_t ex)

Returns the min annotation for this DDS_TypeCode.

Precondition
self kind is DDS_TK_ENUM, or DDS_TK_ALIAS of a numerical kind.
MT Safety:
SAFE
Parameters
ex<<out>> Parameter for error indications. The values that can take are:
Returns
the min annotation for this DDS_TypeCode

◆ max_value()

const DDS_AnnotationParameterValue * DDS_TypeCode::max_value ( DDS_ExceptionCode_t ex)

Returns the max annotation for this DDS_TypeCode.

Precondition
self kind is DDS_TK_ENUM, or DDS_TK_ALIAS of a numerical kind.
MT Safety:
SAFE
Parameters
ex<<out>> Parameter for error indications. The values that can take are:
Returns
the max annotation for this DDS_TypeCode

◆ member_default_value()

const DDS_AnnotationParameterValue * DDS_TypeCode::member_default_value ( DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
)

Returns the member default annotation for this DDS_TypeCode.

Precondition
self kind is DDS_TK_STRUCT, or DDS_TK_UNION.
MT Safety:
SAFE
Parameters
indexindex of the target member
ex<<out>> Parameter for error indications. The values that can take are:
Returns
the member default annotation for this DDS_TypeCode

◆ member_min_value()

const DDS_AnnotationParameterValue * DDS_TypeCode::member_min_value ( DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
)

Returns the member min annotation for this DDS_TypeCode.

Precondition
self kind is DDS_TK_STRUCT, or DDS_TK_UNION.
member pointed to by index of a numerical kind.
MT Safety:
SAFE
Parameters
indexindex of the target member
ex<<out>> Parameter for error indications. The values that can take are:
Returns
the member min annotation for this DDS_TypeCode

◆ member_max_value()

const DDS_AnnotationParameterValue * DDS_TypeCode::member_max_value ( DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
)

Returns the member max annotation for this DDS_TypeCode.

Precondition
self kind is DDS_TK_STRUCT, or DDS_TK_UNION.
member pointed to by index of a numerical kind.
MT Safety:
SAFE
Parameters
indexindex of the target member
ex<<out>> Parameter for error indications. The values that can take are:
Returns
the member max annotation for this DDS_TypeCode

◆ print_IDL()

void DDS_TypeCode::print_IDL ( DDS_UnsignedLong  indent,
DDS_ExceptionCode_t ex 
) const

Prints a DDS_TypeCode in IDL notation.

MT Safety:
SAFE.
Parameters
indent<<in>> Indent.
ex<<out>> Parameter for error indications. The values that can take are:

◆ print()

void DDS_TypeCode::print ( const DDS_TypeCodePrintFormatProperty format,
DDS_ExceptionCode_t ex 
) const

Prints a DDS_TypeCode.

MT Safety:
SAFE.
Parameters
format<<in>> Format.
ex<<out>> Parameter for error indications. The values that can take are:

◆ to_string() [1/2]

void DDS_TypeCode::to_string ( char *  str,
DDS_UnsignedLong str_size,
DDS_ExceptionCode_t ex 
) const

Get a string representation of this DDS_TypeCode object using the default values for DDS_TypeCodePrintFormatProperty.

This function obtains a string representation of a DDS_TypeCode object, it creates this string using the default values of DDS_TypeCodePrintFormatProperty.

In order to calculate the required length of the string, the user can call this function with the parameter str set to NULL. In this mode, the required length of the string will be stored into the value pointed to by the parameter str_size.

If the parameter str is not equal to NULL, the string representation of the DDS_TypeCode will be stored into the parameter str. In this mode, if the size of the string is insufficient to hold the result, the parameter *ex will be set to DDS_BAD_PARAM_SYSTEM_EXCEPTION_CODE and the parameter str_size will be updated to hold the required size of the string. All string lengths include the trailing NUL byte.

Parameters
str<<out>> The char buffer that will be used to store the string representation of the DDS_TypeCode. If NULL then this function will store the required length of the buffer into the value pointed to by the str_size parameter.
str_size<<inout>> Cannot be NULL. The length of the char buffer. If the supplied buffer is NULL or insufficiently long, the value pointed to by this parameter will be updated to contain the required length.
ex<<out>> Parameter used for error indications.
See also
DDS_TypeCode::print_IDL
DDS_TypeCode::print
DDS_TypeCode::to_string

◆ to_string() [2/2]

void DDS_TypeCode::to_string ( char *  str,
DDS_UnsignedLong str_size,
const DDS_TypeCodePrintFormatProperty format,
DDS_ExceptionCode_t ex 
) const

Get a string representation of this DDS_TypeCode object using the format described by DDS_TypeCodePrintFormatProperty.

This function behaves in the same way as DDS_TypeCode::to_string but allows the user to specify the format of the string using DDS_TypeCodePrintFormatProperty.

Parameters
str<<out>> The char buffer which will hold the string representation of the DDS_TypeCode.
str_size<<inout>> Cannot be NULL. The length of the char buffer pointed to by the str parameter. If the str parameter is NULL, or too small, this parameter will be updated to hold the required length of the buffer.
format<<in>> The DDS_TypeCodePrintFormatProperty used to define the format of the string representation of the DDS_TypeCode.
ex<<out>> Parameter used for error indications.
See also
DDS_TypeCode::print_IDL
DDS_TypeCode::print
DDS_TypeCode::to_string