DDS::TypeCode Class Reference
[Type Code Support]

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>

List of all members.

Public Member Functions

TCKind kind ()
 Gets the DDS::TCKind 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 a sparse type code 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 (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.
void print_IDL (System::UInt32 indent)
 Prints a DDS::TypeCode in a pseudo-IDL notation.

Public Attributes

TypeCodeTC_NULL
 Basic null type.
TypeCodeTC_NULL
 Basic 16-bit signed integer 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.


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.

System::Boolean DDS::TypeCode::equal ( TypeCode^   tc  ) 

Compares two DDS::TypeCode objects for equality.

MT Safety:
SAFE.
Parameters:
tc <<in>> Type code that will be compared with this DDS::TypeCode.
Exceptions:
DDS::ExceptionCode_t::BAD_PARAM_SYSTEM_EXCEPTION_CODE if 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, DDS::TCKind::TK_SPARSE or DDS::TCKind::TK_ALIAS.
MT Safety:
SAFE.
Exceptions:
DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODE if 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, DDS::TCKind::TK_VALUE or DDS::TCKind::TK_SPARSE.
MT Safety:
SAFE.
Exceptions:
DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODE if 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, DDS::TCKind::TK_VALUE or DDS::TCKind::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)].
Exceptions:
DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODE if 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, DDS::TCKind::TK_VALUE or DDS::TCKind::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)].
Exceptions:
DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODE if 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 Data Distribution Service 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_CODE if 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 Data Distribution Service 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_CODE if 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 Data Distribution Service 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_CODE if 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 Data Distribution Service extension to the CORBA Type Code Specification.

Precondition:
self kind is DDS::TCKind::TK_STRUCT, DDS::TCKind::TK_VALUE or DDS::TCKind::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)].
Exceptions:
DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODE if 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.

Which fields are required depends on the DDS::TCKind of the type. For example, in a type of kind DDS::TCKind::TK_SPARSE, key fields are required. In DDS::TCKind::TK_STRUCT and DDS::TCKind::TK_VALUE types, all fields are required.

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 Data Distribution Service 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_CODE if 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 Data Distribution Service 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_CODE if 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 Data Distribution Service 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_CODE if 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. 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_CODE if 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_CODE if 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_CODE if 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 Data Distribution Service 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_CODE if 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 Data Distribution Service 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_CODE if 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_CODE if 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 Data Distribution Service 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_CODE if 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_CODE if 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_SPARSE.
MT Safety:
SAFE.
Exceptions:
DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODE if 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.
MT Safety:
SAFE.
Exceptions:
DDS::ExceptionCode_t::BADKIND_USER_EXCEPTION_CODE if 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 a sparse type code member identified by the given index.

The method can be invoked on sparse DDS::TypeCode objects.

This function is an RTI Data Distribution Service extension to the CORBA Type Code Specification.

Precondition:
self kind is DDS::TCKind::TK_SPARSE.
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_CODE if 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.

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 ( 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), sparse value types (DDS::TCKind::TK_SPARSE), and unions (DDS::TCKind::TK_UNION). To add a constant to an enumeration, 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.

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", 
      // If the type is sparse, specify an ID. Otherwise, use this sentinel: 
      TypeCode.MEMBER_ID_INVALID, 
      TypeCodeFactory.get_instance().get_primitive_tc(TCKind.TK_LONG), 
      // New field is not a key: 
      TypeCode.NONKEY_REQUIRED_MEMBER); 
  
  // Sequence of 10 or fewer integers: 
  myTypeCode.add_member( 
      "myFieldName", 
      // If the type is sparse, 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 not a key: 
      TypeCode.NONKEY_REQUIRED_MEMBER); 

In C++/CLI:

 // Integer: 
  myTypeCode->add_member( 
      "myFieldName", 
      // If the type is sparse, specify an ID. Otherwise, use this sentinel: 
      TypeCode::MEMBER_ID_INVALID, 
      TypeCodeFactory::get_instance()->get_primitive_tc(TCKind::TK_LONG), 
      // New field is not a key: 
      TypeCode::NONKEY_REQUIRED_MEMBER); 
  
  // Sequence of 10 or fewer integers: 
  myTypeCode->add_member( 
      "myFieldName", 
      // If the type is sparse, 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 not a key: 
      TypeCode::NONKEY_REQUIRED_MEMBER); 

MT Safety:
UNSAFE.
Parameters:
name <<in>> The name of the new member.
id <<in>> The ID of the new member. This should only be specified for members of kind DDS::TCKind::TK_SPARSE and DDS::TCKind::TK_UNION; otherwise, it should be DDS::TypeCode::MEMBER_ID_INVALID.
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.

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 ID of the new member. This should only be specified for members of kind DDS::TCKind::TK_SPARSE and DDS::TCKind::TK_UNION; otherwise, it should be DDS::TypeCode::MEMBER_ID_INVALID.
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 and DDS::TCKind::TK_SPARSE.
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::TypeCodeFactory

DDS::TypeCode::NONKEY_MEMBER

DDS::TypeCode::KEY_MEMBER

DDS::TypeCode::NONKEY_REQUIRED_MEMBER

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

Basic 16-bit signed integer type.

See also:
DDS::TypeCodeFactory::get_primitive_tc

Basic single-byte character type.

See also:
DDS::TypeCodeFactory::get_primitive_tc


RTI Data Distribution Service .Net APIs Version 4.5e Copyright © 23 Oct 2011 Real-Time Innovations, Inc