RTI Connext C++ API  Version 5.1.0
DDS_TypeCode Struct Reference

The definition of a particular data type, which you can use to inspect the name, members, and other properties of types generated with rtiddsgen 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.
 
DDS_ExtensibilityKind extensibility_kind (DDS_ExceptionCode_t &ex) const
 Gets the DDS_ExtensibilityKind value of a type code.
 
DDS_Boolean equal (const DDS_TypeCode *tc, DDS_ExceptionCode_t &ex) const
 Compares two DDS_TypeCode objects for equality.
 
const char * name (DDS_ExceptionCode_t &ex) const
 Retrieves the simple name identifying this DDS_TypeCode object within its enclosing scope.
 
DDS_UnsignedLong member_count (DDS_ExceptionCode_t &ex) const
 Returns the number of members of the type code.
 
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.
 
DDS_UnsignedLong find_member_by_name (const char *name, DDS_ExceptionCode_t &ex) const
 Get the index of the member of the given name.
 
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.
 
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.
 
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.
 
DDS_Long member_ordinal (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 Returns the ordinal that corresponds to the index-th enum value.
 
DDS_Boolean is_member_key (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 Function that tells if a member is a key or not.
 
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.
 
DDS_Boolean is_member_pointer (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 Function that tells if a member is a pointer or not.
 
DDS_Boolean is_member_bitfield (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 Function that tells if a member is a bitfield or not.
 
DDS_Short member_bitfield_bits (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 Returns the number of bits of a bitfield member.
 
DDS_Visibility member_visibility (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 Returns the constant that indicates the visibility of the index-th member.
 
DDS_TypeCodediscriminator_type (DDS_ExceptionCode_t &ex) const
 Returns the discriminator type code.
 
DDS_UnsignedLong length (DDS_ExceptionCode_t &ex) const
 Returns the number of elements in the type described by this type code.
 
DDS_UnsignedLong array_dimension_count (DDS_ExceptionCode_t &ex) const
 This function returns the number of dimensions of an array type code.
 
DDS_UnsignedLong array_dimension (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 This function returns the index-th dimension of an array type code.
 
DDS_UnsignedLong element_count (DDS_ExceptionCode_t &ex) const
 The number of elements in an array.
 
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.
 
DDS_Boolean is_alias_pointer (DDS_ExceptionCode_t &ex) const
 Function that tells if an alias is a pointer or not.
 
DDS_Long default_index (DDS_ExceptionCode_t &ex) const
 Returns the index of the default member, or -1 if there is no default member.
 
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.
 
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.
 
DDS_Long member_id (DDS_UnsignedLong index, DDS_ExceptionCode_t &ex) const
 Returns the ID of the TypeCode member identified by the given index.
 
DDS_UnsignedLong find_member_by_id (DDS_Long id, DDS_ExceptionCode_t &ex) const
 Get the index of the member of the given ID.
 
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.
 
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.
 
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.
 
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.
 
void print_IDL (DDS_UnsignedLong indent, DDS_ExceptionCode_t &ex) const
 Prints a DDS_TypeCode in a pseudo-IDL notation.
 

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 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.

Member Function Documentation

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.
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>
<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.
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.
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, DDS_TK_SPARSE 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.
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, DDS_TK_VALUE or DDS_TK_SPARSE.
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.
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, DDS_TK_VALUE or DDS_TK_SPARSE.
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.
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.

MT Safety:
SAFE.
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, DDS_TK_VALUE or DDS_TK_SPARSE.
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.
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.
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.
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.
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, DDS_TK_VALUE or DDS_TK_SPARSE.
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.
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.

Which fields are required depends on the DDS_TCKind of the type. For example, in a type of kind DDS_TK_SPARSE, key fields are required. In DDS_TK_STRUCT and DDS_TK_VALUE types, all fields are required.

MT Safety:
SAFE.
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.
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.
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.
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, DDS_TK_STRUCT or DDS_TK_SPARSE. 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.
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.
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.
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.
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.
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.
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.
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.
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.
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, DDS_TK_STRUCT, or DDS_TK_SPARSE.
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.
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, DDS_TK_STRUCT, or DDS_TK_SPARSE.

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.
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_SPARSE, 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.
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 sparse value types (DDS_TK_SPARSE).

<<in>> The member ID.

Returns
The index of the member of the given ID.
MT Safety:
SAFE.
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
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.
tc<<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
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), sparse value types (DDS_TK_SPARSE), 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 not a key:
// 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 not a key:
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
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), sparse value types (DDS_TK_SPARSE), 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 and DDS_TK_SPARSE. 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
void DDS_TypeCode::print_IDL ( DDS_UnsignedLong  indent,
DDS_ExceptionCode_t ex 
) const

Prints a DDS_TypeCode in a pseudo-IDL notation.

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

RTI Connext C++ API Version 5.1.0 Copyright © Mon Feb 3 2014 Real-Time Innovations, Inc