RTI Connext .Net APIs  Version 5.2.0
 All Classes Namespaces Functions Variables Enumerations Properties Groups Pages
DDS::TypeCode Class 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...

#include <managed_typecode.h>

Public Member Functions

TCKind kind ()
 Gets the ::DDS::TCKind value of a type code.
 
ExtensibilityKind extensibility_kind ()
 Gets the ::DDS::ExtensibilityKind value of a type code.
 
System::Boolean equal (TypeCode^ tc)
 Compares two DDS::TypeCode objects for equality.
 
System::String^ name ()
 Retrieves the simple name identifying this DDS::TypeCode object within its enclosing scope.
 
System::UInt32 member_count ()
 Returns the number of members of the type code.
 
System::String^ member_name (System::UInt32 index)
 Returns the name of a type code member identified by the given index.
 
System::UInt32 find_member_by_name (System::String^ name)
 Get the index of the member of the given name.
 
DDS::TypeCodemember_type (System::UInt32 index)
 Retrieves the DDS::TypeCode object describing the type of the member identified by the given index.
 
System::UInt32 member_label_count (System::UInt32 index)
 Returns the number of labels associated to the index-th union member.
 
System::Int32 member_label (System::UInt32 member_index, System::UInt32 label_index)
 Return the label_index-th label associated to the member_index-th member.
 
System::Int32 member_ordinal (System::UInt32 index)
 Returns the ordinal that corresponds to the index-th enum value.
 
System::Boolean is_member_key (System::UInt32 index)
 Function that tells if a member is a key or not.
 
System::Boolean is_member_required (System::UInt32 index)
 Indicates whether a given member of a type is required to be present in every sample of that type.
 
System::Boolean is_member_pointer (System::UInt32 index)
 Function that tells if a member is a pointer or not.
 
System::Boolean is_member_bitfield (System::UInt32 index)
 Function that tells if a member is a bitfield or not.
 
System::Int16 member_bitfield_bits (System::UInt32 index)
 Returns the number of bits of a bitfield member.
 
Visibility member_visibility (System::UInt32 index)
 Returns the constant that indicates the visibility of the index-th member.
 
TypeCodediscriminator_type ()
 Returns the discriminator type code.
 
System::UInt32 length ()
 Returns the number of elements in the type described by this type code.
 
System::UInt32 array_dimension_count ()
 This function returns the number of dimensions of an array type code.
 
System::UInt32 array_dimension (System::UInt32 index)
 This function returns the index-th dimension of an array type code.
 
System::UInt32 element_count ()
 The number of elements in an array.
 
DDS::TypeCodecontent_type ()
 Returns the DDS::TypeCode object representing the type for the members of the object described by this DDS::TypeCode object.
 
System::Boolean is_alias_pointer ()
 Function that tells if an alias is a pointer or not.
 
System::Int32 default_index ()
 Returns the index of the default member, or -1 if there is no default member.
 
DDS::TypeCodeconcrete_base_type ()
 Returns the DDS::TypeCode that describes the concrete base type of the value type that this DDS::TypeCode object describes.
 
ValueModifier type_modifier ()
 Returns a constant indicating the modifier of the value type that this DDS::TypeCode object describes.
 
System::Int32 member_id (System::UInt32 index)
 Returns the ID of the TypeCode member identified by the given index.
 
System::UInt32 find_member_by_id (System::Int32 id)
 Get the index of the member of the given ID.
 
System::UInt32 add_member_to_enum (System::String^ name, System::Int32 ordinal)
 Add a new enumerated constant to this enum DDS::TypeCode.
 
System::UInt32 add_member_to_union (System::String^ name, System::Int32 id, IntSeq^ labels, DDS::TypeCode^ tc, System::Boolean is_pointer)
 Add a new member to a union DDS::TypeCode.
 
System::UInt32 add_member (System::String^ name, System::Int32 id, DDS::TypeCode^ tc, System::Byte member_flags)
 Add a new member to this DDS::TypeCode.
 
System::UInt32 add_member_ex (System::String^ name, System::Int32 id, DDS::TypeCode^ tc, System::Byte member_flags, Visibility visibility, System::Boolean is_pointer, System::Int16 bits)
 Add a new member to this DDS::TypeCode.
 
System::UInt32 get_type_object_serialized_size ()
 Gets the serialized size of the TypeObject created from this DDS::TypeCode.
 
void print_IDL (System::UInt32 indent)
 Prints a DDS::TypeCode in a pseudo-IDL notation.
 

Public Attributes

TypeCodeTC_NULL
 Basic null type.
 
TypeCodeTC_LONG
 Basic 32-bit signed integer type.
 
TypeCodeTC_USHORT
 Basic unsigned 16-bit integer type.
 
TypeCodeTC_ULONG
 Basic unsigned 32-bit integer type.
 
TypeCodeTC_FLOAT
 Basic 32-bit floating point type.
 
TypeCodeTC_DOUBLE
 Basic 64-bit floating point type.
 
TypeCodeTC_BOOLEAN
 Basic Boolean type.
 
TypeCodeTC_CHAR
 Basic single-byte character type.
 
TypeCodeTC_OCTET
 Basic octet/byte type.
 
TypeCodeTC_LONGLONG
 Basic 64-bit integer type.
 
TypeCodeTC_ULONGLONG
 Basic unsigned 64-bit integer type.
 
TypeCodeTC_LONGDOUBLE
 Basic 128-bit floating point type.
 
TypeCodeTC_WCHAR
 Basic four-byte character type.
 
System::Int32 MEMBER_ID_INVALID
 A sentinel indicating an invalid DDS::TypeCode member ID.
 
System::UInt32 INDEX_INVALID
 A sentinel indicating an invalid DDS::TypeCode member index.
 
System::Int16 NOT_BITFIELD
 Indicates that a member of a type is not a bitfield.
 
System::Byte NONKEY_MEMBER
 A flag indicating that a type member is optional and not part of the key.
 
System::Byte KEY_MEMBER
 A flag indicating that a type member is part of the key for that type, and therefore required.
 
System::Byte NONKEY_REQUIRED_MEMBER
 A flag indicating that a type member is not part of the key but is nevertheless required.
 

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.
Examples:
HelloWorld.cpp, and HelloWorldSupport.cpp.

Member Function Documentation

TCKind DDS::TypeCode::kind ( )

Gets the ::DDS::TCKind value of a type code.

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.
ExtensibilityKind DDS::TypeCode::extensibility_kind ( )

Gets the ::DDS::ExtensibilityKind value of a type code.

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::TCKind::TK_STRUCT, ::DDS::TCKind::TK_UNION, ::DDS::TCKind::TK_VALUE, and ::DDS::TCKind::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.
System::Boolean DDS::TypeCode::equal ( TypeCode tc)

Compares two DDS::TypeCode objects for equality.

MT Safety:
SAFE.

For equality and assignability purposes, ::DDS::TCKind::TK_STRUCT and ::DDS::TCKind::TK_VALUE are considered equivalent.

The DDS::TypeCode of structs inheriting from other structs has a ::DDS::TCKind::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::TCKind::TK_VALUE kind.

Parameters
tc<<in>> Type code that will be compared with this DDS::TypeCode.
Exceptions
::DDS::ExceptionCode_t::BAD_PARAM_SYSTEM_EXCEPTION_CODEif tc is null.
Returns
true if the type codes are equal. Otherwise, false.
System::String ^ DDS::TypeCode::name ( )

Retrieves the simple name identifying this DDS::TypeCode object within its enclosing scope.

Precondition
self kind is ::DDS::TCKind::TK_STRUCT, ::DDS::TCKind::TK_UNION, ::DDS::TCKind::TK_ENUM, ::DDS::TCKind::TK_VALUE, or ::DDS::TCKind::TK_ALIAS.
MT Safety:
SAFE.
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
Returns
Name of the type code if no errors.
System::UInt32 DDS::TypeCode::member_count ( )

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::TCKind::TK_STRUCT, ::DDS::TCKind::TK_UNION, ::DDS::TCKind::TK_ENUM or ::DDS::TCKind::TK_VALUE.
MT Safety:
SAFE.
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
Returns
The number of members constituting the type described by this DDS::TypeCode object if no errors.
System::String ^ DDS::TypeCode::member_name ( System::UInt32  index)

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::TCKind::TK_STRUCT, ::DDS::TCKind::TK_UNION, ::DDS::TCKind::TK_ENUM or ::DDS::TCKind::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)].
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
::DDS::ExceptionCode_t::BOUNDS_USER_EXCEPTION_CODE- if the index parameter/s are out of range.
Returns
Name of the member if no errors.
System::UInt32 DDS::TypeCode::find_member_by_name ( System::String^  name)

Get the index of the member of the given name.

MT Safety:
SAFE.
DDS::TypeCode ^ DDS::TypeCode::member_type ( System::UInt32  index)

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::TCKind::TK_STRUCT, ::DDS::TCKind::TK_UNION or ::DDS::TCKind::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)].
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
::DDS::ExceptionCode_t::BOUNDS_USER_EXCEPTION_CODE- if the index parameter/s are out of range.
Returns
The DDS::TypeCode object describing the member at the given index if no errors.
System::UInt32 DDS::TypeCode::member_label_count ( System::UInt32  index)

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::TCKind::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)].
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
::DDS::ExceptionCode_t::BOUNDS_USER_EXCEPTION_CODE- if the index parameter/s are out of range.
Returns
Number of labels if no errors.
System::Int32 DDS::TypeCode::member_label ( System::UInt32  member_index,
System::UInt32  label_index 
)

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::TCKind::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.
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
::DDS::ExceptionCode_t::BOUNDS_USER_EXCEPTION_CODE- if the index parameter/s are out of range.
Returns
The evaluated value of the label if no errors.
System::Int32 DDS::TypeCode::member_ordinal ( System::UInt32  index)

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::TCKind::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)].
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
::DDS::ExceptionCode_t::BOUNDS_USER_EXCEPTION_CODE- if the index parameter/s are out of range.
Returns
Ordinal that corresponds to the index-th enumerator if no errors.
System::Boolean DDS::TypeCode::is_member_key ( System::UInt32  index)

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::TCKind::TK_STRUCT or ::DDS::TCKind::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)].
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
::DDS::ExceptionCode_t::BOUNDS_USER_EXCEPTION_CODE- if the index parameter/s are out of range.
Returns
true if the member is a key. Otherwise, false.
System::Boolean DDS::TypeCode::is_member_required ( System::UInt32  index)

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.
System::Boolean DDS::TypeCode::is_member_pointer ( System::UInt32  index)

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::TCKind::TK_STRUCT, ::DDS::TCKind::TK_UNION or ::DDS::TCKind::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.
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
::DDS::ExceptionCode_t::BOUNDS_USER_EXCEPTION_CODE- if the index parameter/s are out of range.
Returns
true if the member is a pointer. Otherwise, false.
System::Boolean DDS::TypeCode::is_member_bitfield ( System::UInt32  index)

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::TCKind::TK_STRUCT or ::DDS::TCKind::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)].
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
::DDS::ExceptionCode_t::BOUNDS_USER_EXCEPTION_CODE- if the index parameter/s are out of range.
Returns
true if the member is a bitfield. Otherwise, false.
System::Int16 DDS::TypeCode::member_bitfield_bits ( System::UInt32  index)

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::TCKind::TK_STRUCT or ::DDS::TCKind::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)].
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
::DDS::ExceptionCode_t::BOUNDS_USER_EXCEPTION_CODE- if the index parameter/s are out of range.
Returns
The number of bits of the bitfield or DDS::TypeCode::NOT_BITFIELD if the member is not a bitfield.
Visibility DDS::TypeCode::member_visibility ( System::UInt32  index)

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

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

For ::DDS::TCKind::TK_STRUCT, this method always returns ::DDS::Visibility::PUBLIC_MEMBER.

Parameters
index<<in>> Member index in the interval [0,(member count-1)].
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
::DDS::ExceptionCode_t::BOUNDS_USER_EXCEPTION_CODE- if the index parameter/s are out of range.
Returns
One of the following constants: ::DDS::Visibility::PRIVATE_MEMBER or ::DDS::Visibility::PUBLIC_MEMBER.
TypeCode ^ DDS::TypeCode::discriminator_type ( )

Returns the discriminator type code.

The method discriminator_type can be invoked only on union DDS::TypeCode objects.

Precondition
self kind is ::DDS::TCKind::TK_UNION.
MT Safety:
SAFE.
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
Returns
DDS::TypeCode object describing the discriminator of the union type if no errors.
System::UInt32 DDS::TypeCode::length ( )

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::TCKind::TK_ARRAY, ::DDS::TCKind::TK_SEQUENCE, ::DDS::TCKind::TK_STRING or ::DDS::TCKind::TK_WSTRING.
MT Safety:
SAFE.
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
Returns
The bound for strings and sequences, or the number of elements for arrays if no errors.
System::UInt32 DDS::TypeCode::array_dimension_count ( )

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::TCKind::TK_ARRAY.
MT Safety:
SAFE.
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
Returns
Number of dimensions if no errors.
System::UInt32 DDS::TypeCode::array_dimension ( System::UInt32  index)

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::TCKind::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)].
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
::DDS::ExceptionCode_t::BOUNDS_USER_EXCEPTION_CODE- if the index parameter/s are out of range.
Returns
Requested dimension if no errors.
System::UInt32 DDS::TypeCode::element_count ( )

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 ( )

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::TCKind::TK_ARRAY, ::DDS::TCKind::TK_SEQUENCE or ::DDS::TCKind::TK_ALIAS.
MT Safety:
SAFE.
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
Returns
A DDS::TypeCode object representing the element type for sequences and arrays, and the original type for aliases.
System::Boolean DDS::TypeCode::is_alias_pointer ( )

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::TCKind::TK_ALIAS.
MT Safety:
SAFE.
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
Returns
true if an alias is a pointer to the aliased type. Otherwise, false.
System::Int32 DDS::TypeCode::default_index ( )

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::TCKind::TK_UNION
MT Safety:
SAFE.
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
Returns
The index of the default member, or -1 if there is no default member.
DDS::TypeCode ^ DDS::TypeCode::concrete_base_type ( )

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::TCKind::TK_VALUE or ::DDS::TCKind::TK_STRUCT.
MT Safety:
SAFE.

For ::DDS::TCKind::TK_STRUCT, this method always returns ::DDS::TCKind::TK_NULL.

The DDS::TypeCode of structs inheriting from other structs has a ::DDS::TCKind::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::TCKind::TK_VALUE kind.

Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
Returns
DDS::TypeCode that describes the concrete base type or null if there is no a concrete base type.
ValueModifier DDS::TypeCode::type_modifier ( )

Returns a constant indicating the modifier of the value type that this DDS::TypeCode object describes.

Precondition
self kind is ::DDS::TCKind::TK_VALUE or ::DDS::TCKind::TK_STRUCT.

For ::DDS::TCKind::TK_STRUCT, this method always returns ::DDS::ValueModifier::VM_NONE.

MT Safety:
SAFE.
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
Returns
One of the following type modifiers: ::DDS::ValueModifier::VM_NONE, ::DDS::ValueModifier::VM_ABSTRACT, ::DDS::ValueModifier::VM_CUSTOM or ::DDS::ValueModifier::VM_TRUNCATABLE.
System::Int32 DDS::TypeCode::member_id ( System::UInt32  index)

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::TCKind::TK_STRUCT, ::DDS::TCKind::TK_VALUE, or ::DDS::TCKind::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)].
Exceptions
::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODEif the method is invoked on an inappropriate kind of TypeCode object.
::DDS::ExceptionCode_t::BOUNDS_USER_EXCEPTION_CODE- if the index parameter/s are out of range.
Returns
ID of the member if no errors.
System::UInt32 DDS::TypeCode::find_member_by_id ( System::Int32  id)

Get the index of the member of the given ID.

This method is applicable to DDS::TypeCode objects representing structs (::DDS::TCKind::TK_STRUCT and union (::DDS::TCKind::TK_UNION) types.

<<in>> The member ID.

Returns
The index of the member of the given ID.
MT Safety:
SAFE.
System::UInt32 DDS::TypeCode::add_member_to_enum ( System::String^  name,
System::Int32  ordinal 
)

Add a new enumerated constant to this enum DDS::TypeCode.

This method is applicable to DDS::TypeCode objects representing enumerations (::DDS::TCKind::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.
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
System::UInt32 DDS::TypeCode::add_member_to_union ( System::String^  name,
System::Int32  id,
IntSeq labels,
DDS::TypeCode tc,
System::Boolean  is_pointer 
)

Add a new member to a union DDS::TypeCode.

This method is applicable to DDS::TypeCode objects representing unions (::DDS::TCKind::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:
  • ::DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODE
  • ::DDS::ExceptionCode_t::BAD_MEMBER_NAME_USER_EXCEPTION_CODE
  • ::DDS::ExceptionCode_t::BAD_MEMBER_ID_USER_EXCEPTION_CODE
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
System::UInt32 DDS::TypeCode::add_member ( System::String^  name,
System::Int32  id,
DDS::TypeCode tc,
System::Byte  member_flags 
)

Add a new member to this DDS::TypeCode.

This method is applicable to DDS::TypeCode objects representing structures (::DDS::TCKind::TK_STRUCT), value types (::DDS::TCKind::TK_VALUE), and unions (::DDS::TCKind::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.

In C#:

// Integer:
myTypeCode.add_member(
"myFieldName",
// Optionally, specify an ID. Otherwise, use this sentinel:
TypeCode.MEMBER_ID_INVALID,
TypeCodeFactory.get_instance().get_primitive_tc(TCKind.TK_LONG),
// New field is a required non-key member:
TypeCode.NONKEY_REQUIRED_MEMBER);
// Sequence of 10 or fewer integers:
myTypeCode.add_member(
"myFieldName",
// Optionally, specify an ID. Otherwise, use this sentinel:
TypeCode.MEMBER_ID_INVALID,
TypeCodeFactory.get_instance().create_sequence_tc(
10,
TypeCodeFactory.get_instance().get_primitive_tc(TCKind.TK_LONG)),
// New field is a required non-key member:
TypeCode.NONKEY_REQUIRED_MEMBER);

In C++/CLI:

// Integer:
myTypeCode->add_member(
"myFieldName",
TypeCodeFactory::get_instance()->get_primitive_tc(TCKind::TK_LONG),
// New field is a required non-key member:
// Sequence of 10 or fewer integers:
myTypeCode->add_member(
"myFieldName",
TypeCodeFactory::get_instance()->create_sequence_tc(
10,
TypeCodeFactory::get_instance()->get_primitive_tc(TCKind::TK_LONG)),
// New field is a required non-key member:
MT Safety:
UNSAFE.
Parameters
name<<in>> The name of the new member.
id<<in>> Member ID or case value.
  • For ::DDS::TCKind::TK_STRUCT, and ::DDS::TCKind::TK_VALUE, this parameter is used to provide the member ID. For automatic assignment of the member ID specify DDS::TypeCode::MEMBER_ID_INVALID.
  • For ::DDS::TCKind::TK_UNION, this parameter is used to provide the case value associated with the member. The member ID is assigned automatically. To explicitly assign the member ID, use the API DDS::TypeCode::add_member_to_union.
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.
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
System::UInt32 DDS::TypeCode::add_member_ex ( System::String^  name,
System::Int32  id,
DDS::TypeCode tc,
System::Byte  member_flags,
Visibility  visibility,
System::Boolean  is_pointer,
System::Int16  bits 
)

Add a new member to this DDS::TypeCode.

This method is applicable to DDS::TypeCode objects representing structures (::DDS::TCKind::TK_STRUCT), value types (::DDS::TCKind::TK_VALUE), and unions (::DDS::TCKind::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.
  • For ::DDS::TCKind::TK_STRUCT and ::DDS::TCKind::TK_VALUE, this parameter is used to provide the member ID.
  • For ::DDS::TCKind::TK_STRUCT and ::DDS::TCKind::TK_VALUE only: For automatic assignment of the member ID, specify DDS::TypeCode::MEMBER_ID_INVALID.
  • For ::DDS::TCKind::TK_UNION, this parameter is used to provide the case value associated with the member. The member ID is assigned automatically. To explicitly assign the member ID, use the API DDS::TypeCode::add_member_to_union.
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::TCKind::TK_VALUE. Possible values include:
  • ::DDS::Visibility::PRIVATE_MEMBER
  • ::DDS::Visibility::PUBLIC_MEMBER
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.
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
System::UInt32 DDS::TypeCode::get_type_object_serialized_size ( )

Gets the serialized size of the TypeObject created from this DDS::TypeCode.

The default buffer size used for storing a TypeObject is 3072 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.
void DDS::TypeCode::print_IDL ( System::UInt32  indent)

Prints a DDS::TypeCode in a pseudo-IDL notation.

MT Safety:
SAFE.
Parameters
indent<<in>> Indent.

Member Data Documentation

TypeCode ^ DDS::TypeCode::TC_CHAR

Basic single-byte character type.

See Also
DDS::TypeCodeFactory::get_primitive_tc

RTI Connext .Net APIs Version 5.2.0 Copyright © Sun Jun 21 2015 Real-Time Innovations, Inc