RTI Connext C API  Version 5.0.0
Type Code Support

<<eXtension>> A DDS_TypeCode is a mechanism for representing a type at runtime. RTI Connext can use type codes to send type definitions on the network. You will need to understand this API in order to use the Dynamic Data capability or to inspect the type information you receive from remote readers and writers. More...

Data Structures

struct  DDS_TypeCode
 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...
 
struct  DDS_StructMember
 A description of a member of a struct. More...
 
struct  DDS_StructMemberSeq
 Defines a sequence of struct members. More...
 
struct  DDS_UnionMember
 A description of a member of a union. More...
 
struct  DDS_UnionMemberSeq
 Defines a sequence of union members. More...
 
struct  DDS_EnumMember
 A description of a member of an enumeration. More...
 
struct  DDS_EnumMemberSeq
 Defines a sequence of enumerator members. More...
 
struct  DDS_ValueMember
 A description of a member of a value type. More...
 
struct  DDS_ValueMemberSeq
 Defines a sequence of value members. More...
 
struct  DDS_TypeCodeFactory
 A singleton factory for creating, copying, and deleting data type definitions dynamically. More...
 

Macros

#define DDS_TYPECODE_MEMBER_ID_INVALID
 A sentinel indicating an invalid DDS_TypeCode member ID.
 
#define DDS_TYPECODE_INDEX_INVALID
 A sentinel indicating an invalid DDS_TypeCode member index.
 
#define DDS_TYPECODE_NOT_BITFIELD
 Indicates that a member of a type is not a bitfield.
 
#define DDS_VM_NONE
 Constant used to indicate that a value type has no modifiers.
 
#define DDS_VM_CUSTOM
 Constant used to indicate that a value type has the custom modifier.
 
#define DDS_VM_ABSTRACT
 Constant used to indicate that a value type has the abstract modifier.
 
#define DDS_VM_TRUNCATABLE
 Constant used to indicate that a value type has the truncatable modifier.
 
#define DDS_PRIVATE_MEMBER
 Constant used to indicate that a value type member is private.
 
#define DDS_PUBLIC_MEMBER
 Constant used to indicate that a value type member is public.
 
#define DDS_TYPECODE_NONKEY_MEMBER
 A flag indicating that a type member is optional and not part of the key.
 
#define DDS_TYPECODE_KEY_MEMBER
 A flag indicating that a type member is part of the key for that type, and therefore required.
 
#define DDS_TYPECODE_NONKEY_REQUIRED_MEMBER
 A flag indicating that a type member is not part of the key but is nevertheless required.
 

Typedefs

typedef short DDS_ValueModifier
 Modifier type for a value type.
 
typedef short DDS_Visibility
 Type to indicate the visibility of a value type member.
 

Enumerations

enum  DDS_TCKind {
  DDS_TK_NULL,
  DDS_TK_SHORT,
  DDS_TK_LONG,
  DDS_TK_USHORT,
  DDS_TK_ULONG,
  DDS_TK_FLOAT,
  DDS_TK_DOUBLE,
  DDS_TK_BOOLEAN,
  DDS_TK_CHAR,
  DDS_TK_OCTET,
  DDS_TK_STRUCT,
  DDS_TK_UNION,
  DDS_TK_ENUM,
  DDS_TK_STRING,
  DDS_TK_SEQUENCE,
  DDS_TK_ARRAY,
  DDS_TK_ALIAS,
  DDS_TK_LONGLONG,
  DDS_TK_ULONGLONG,
  DDS_TK_LONGDOUBLE,
  DDS_TK_WCHAR,
  DDS_TK_WSTRING,
  DDS_TK_VALUE,
  DDS_TK_SPARSE
}
 Enumeration type for DDS_TypeCode kinds. More...
 
enum  DDS_ExtensibilityKind {
  DDS_FINAL_EXTENSIBILITY,
  DDS_EXTENSIBLE_EXTENSIBILITY,
  DDS_MUTABLE_EXTENSIBILITY
}
 Type to indicate the extensibility of a type. More...
 

Functions

DDS_TCKind DDS_TypeCode_kind (const DDS_TypeCode *self, DDS_ExceptionCode_t *ex)
 Gets the DDS_TCKind value of a type code.
 
DDS_ExtensibilityKind DDS_TypeCode_extensibility_kind (const DDS_TypeCode *self, DDS_ExceptionCode_t *ex)
 Gets the DDS_ExtensibilityKind value of a type code.
 
DDS_Boolean DDS_TypeCode_equal (const DDS_TypeCode *self, const DDS_TypeCode *tc, DDS_ExceptionCode_t *ex)
 Compares two DDS_TypeCode objects for equality.
 
const char * DDS_TypeCode_name (const DDS_TypeCode *self, DDS_ExceptionCode_t *ex)
 Retrieves the simple name identifying this DDS_TypeCode object within its enclosing scope.
 
DDS_UnsignedLong DDS_TypeCode_member_count (const DDS_TypeCode *self, DDS_ExceptionCode_t *ex)
 Returns the number of members of the type code.
 
const char * DDS_TypeCode_member_name (const DDS_TypeCode *self, DDS_UnsignedLong index, DDS_ExceptionCode_t *ex)
 Returns the name of a type code member identified by the given index.
 
DDS_UnsignedLong DDS_TypeCode_find_member_by_name (const DDS_TypeCode *self, const char *name, DDS_ExceptionCode_t *ex)
 Get the index of the member of the given name.
 
DDS_TypeCodeDDS_TypeCode_member_type (const DDS_TypeCode *self, DDS_UnsignedLong index, DDS_ExceptionCode_t *ex)
 Retrieves the DDS_TypeCode object describing the type of the member identified by the given index.
 
DDS_UnsignedLong DDS_TypeCode_member_label_count (const DDS_TypeCode *self, DDS_UnsignedLong index, DDS_ExceptionCode_t *ex)
 Returns the number of labels associated to the index-th union member.
 
DDS_Long DDS_TypeCode_member_label (const DDS_TypeCode *self, DDS_UnsignedLong member_index, DDS_UnsignedLong label_index, DDS_ExceptionCode_t *ex)
 Return the label_index-th label associated to the member_index-th member.
 
DDS_Long DDS_TypeCode_member_ordinal (const DDS_TypeCode *self, DDS_UnsignedLong index, DDS_ExceptionCode_t *ex)
 Returns the ordinal that corresponds to the index-th enum value.
 
DDS_Boolean DDS_TypeCode_is_member_key (const DDS_TypeCode *self, DDS_UnsignedLong index, DDS_ExceptionCode_t *ex)
 Function that tells if a member is a key or not.
 
DDS_Boolean DDS_TypeCode_is_member_required (const DDS_TypeCode *self, DDS_UnsignedLong index, DDS_ExceptionCode_t *ex)
 Indicates whether a given member of a type is required to be present in every sample of that type.
 
DDS_Boolean DDS_TypeCode_is_member_pointer (const DDS_TypeCode *self, DDS_UnsignedLong index, DDS_ExceptionCode_t *ex)
 Function that tells if a member is a pointer or not.
 
DDS_Boolean DDS_TypeCode_is_member_bitfield (const DDS_TypeCode *self, DDS_UnsignedLong index, DDS_ExceptionCode_t *ex)
 Function that tells if a member is a bitfield or not.
 
DDS_Short DDS_TypeCode_member_bitfield_bits (const DDS_TypeCode *self, DDS_UnsignedLong index, DDS_ExceptionCode_t *ex)
 Returns the number of bits of a bitfield member.
 
DDS_Visibility DDS_TypeCode_member_visibility (const DDS_TypeCode *self, DDS_UnsignedLong index, DDS_ExceptionCode_t *ex)
 Returns the constant that indicates the visibility of the index-th member.
 
DDS_TypeCodeDDS_TypeCode_discriminator_type (const DDS_TypeCode *self, DDS_ExceptionCode_t *ex)
 Returns the discriminator type code.
 
DDS_UnsignedLong DDS_TypeCode_length (const DDS_TypeCode *self, DDS_ExceptionCode_t *ex)
 Returns the number of elements in the type described by this type code.
 
DDS_UnsignedLong DDS_TypeCode_array_dimension_count (const DDS_TypeCode *self, DDS_ExceptionCode_t *ex)
 This function returns the number of dimensions of an array type code.
 
DDS_UnsignedLong DDS_TypeCode_array_dimension (const DDS_TypeCode *self, DDS_UnsignedLong index, DDS_ExceptionCode_t *ex)
 This function returns the index-th dimension of an array type code.
 
DDS_UnsignedLong DDS_TypeCode_element_count (const DDS_TypeCode *self, DDS_ExceptionCode_t *ex)
 The number of elements in an array.
 
DDS_TypeCodeDDS_TypeCode_content_type (const DDS_TypeCode *self, DDS_ExceptionCode_t *ex)
 Returns the DDS_TypeCode object representing the type for the members of the object described by this DDS_TypeCode object.
 
DDS_Boolean DDS_TypeCode_is_alias_pointer (const DDS_TypeCode *self, DDS_ExceptionCode_t *ex)
 Function that tells if an alias is a pointer or not.
 
DDS_Long DDS_TypeCode_default_index (const DDS_TypeCode *self, DDS_ExceptionCode_t *ex)
 Returns the index of the default member, or -1 if there is no default member.
 
DDS_TypeCodeDDS_TypeCode_concrete_base_type (const DDS_TypeCode *self, DDS_ExceptionCode_t *ex)
 Returns the DDS_TypeCode that describes the concrete base type of the value type that this DDS_TypeCode object describes.
 
DDS_ValueModifier DDS_TypeCode_type_modifier (const DDS_TypeCode *self, DDS_ExceptionCode_t *ex)
 Returns a constant indicating the modifier of the value type that this DDS_TypeCode object describes.
 
DDS_UnsignedLong DDS_TypeCode_find_member_by_id (const DDS_TypeCode *self, DDS_Long id, DDS_ExceptionCode_t *ex)
 Get the index of the member of the given ID.
 
DDS_Long DDS_TypeCode_member_id (const DDS_TypeCode *self, DDS_UnsignedLong index, DDS_ExceptionCode_t *ex)
 Returns the ID of a sparse type code member identified by the given index.
 
DDS_UnsignedLong DDS_TypeCode_add_member_to_enum (DDS_TypeCode *self, const char *name, DDS_Long ordinal, DDS_ExceptionCode_t *ex)
 Add a new enumerated constant to this enum DDS_TypeCode.
 
DDS_UnsignedLong DDS_TypeCode_add_member (DDS_TypeCode *self, 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 DDS_TypeCode_add_member_ex (DDS_TypeCode *self, 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 DDS_TypeCode_print_IDL (const DDS_TypeCode *self, DDS_UnsignedLong indent, DDS_ExceptionCode_t *ex)
 Prints a DDS_TypeCode in a pseudo-IDL notation.
 
DDS_TypeCodeFactoryDDS_TypeCodeFactory_get_instance ()
 Gets the singleton instance of this class.
 
DDS_TypeCodeDDS_TypeCodeFactory_clone_tc (DDS_TypeCodeFactory *self, const DDS_TypeCode *tc, DDS_ExceptionCode_t *ex)
 Creates and returns a copy of the input DDS_TypeCode.
 
void DDS_TypeCodeFactory_delete_tc (DDS_TypeCodeFactory *self, DDS_TypeCode *tc, DDS_ExceptionCode_t *ex)
 Deletes the input DDS_TypeCode.
 
const DDS_TypeCodeDDS_TypeCodeFactory_get_primitive_tc (DDS_TypeCodeFactory *self, DDS_TCKind tc_kind)
 Get the DDS_TypeCode for a primitive type (integers, floating point values, etc.) identified by the given DDS_TCKind.
 
DDS_TypeCodeDDS_TypeCodeFactory_create_struct_tc (DDS_TypeCodeFactory *self, const char *name, const struct DDS_StructMemberSeq *members, DDS_ExceptionCode_t *ex)
 Constructs a DDS_TK_STRUCT DDS_TypeCode.
 
DDS_TypeCodeDDS_TypeCodeFactory_create_struct_tc_ex (DDS_TypeCodeFactory *self, const char *name, DDS_ExtensibilityKind extensibility_kind, const struct DDS_StructMemberSeq *members, DDS_ExceptionCode_t *ex)
 Constructs a DDS_TK_STRUCT DDS_TypeCode.
 
DDS_TypeCodeDDS_TypeCodeFactory_create_value_tc (DDS_TypeCodeFactory *self, const char *name, DDS_ValueModifier type_modifier, const DDS_TypeCode *concrete_base, const struct DDS_ValueMemberSeq *members, DDS_ExceptionCode_t *ex)
 Constructs a DDS_TK_VALUE DDS_TypeCode.
 
DDS_TypeCodeDDS_TypeCodeFactory_create_value_tc_ex (DDS_TypeCodeFactory *self, const char *name, DDS_ExtensibilityKind extensibility_kind, DDS_ValueModifier type_modifier, const DDS_TypeCode *concrete_base, const struct DDS_ValueMemberSeq *members, DDS_ExceptionCode_t *ex)
 Constructs a DDS_TK_VALUE DDS_TypeCode.
 
DDS_TypeCodeDDS_TypeCodeFactory_create_union_tc (DDS_TypeCodeFactory *self, const char *name, const DDS_TypeCode *discriminator_type, DDS_Long default_index, const struct DDS_UnionMemberSeq *members, DDS_ExceptionCode_t *ex)
 Constructs a DDS_TK_UNION DDS_TypeCode.
 
DDS_TypeCodeDDS_TypeCodeFactory_create_union_tc_ex (DDS_TypeCodeFactory *self, const char *name, DDS_ExtensibilityKind extensibility_kind, const DDS_TypeCode *discriminator_type, DDS_Long default_index, const struct DDS_UnionMemberSeq *members, DDS_ExceptionCode_t *ex)
 Constructs a DDS_TK_UNION DDS_TypeCode.
 
DDS_TypeCodeDDS_TypeCodeFactory_create_enum_tc (DDS_TypeCodeFactory *self, const char *name, const struct DDS_EnumMemberSeq *members, DDS_ExceptionCode_t *ex)
 Constructs a DDS_TK_ENUM DDS_TypeCode.
 
DDS_TypeCodeDDS_TypeCodeFactory_create_enum_tc_ex (DDS_TypeCodeFactory *self, const char *name, DDS_ExtensibilityKind extensibility_kind, const struct DDS_EnumMemberSeq *members, DDS_ExceptionCode_t *ex)
 Constructs a DDS_TK_ENUM DDS_TypeCode.
 
DDS_TypeCodeDDS_TypeCodeFactory_create_alias_tc (DDS_TypeCodeFactory *self, const char *name, const DDS_TypeCode *original_type, DDS_Boolean is_pointer, DDS_ExceptionCode_t *ex)
 Constructs a DDS_TK_ALIAS (typedef) DDS_TypeCode.
 
DDS_TypeCodeDDS_TypeCodeFactory_create_string_tc (DDS_TypeCodeFactory *self, DDS_UnsignedLong bound, DDS_ExceptionCode_t *ex)
 Constructs a DDS_TK_STRING DDS_TypeCode.
 
DDS_TypeCodeDDS_TypeCodeFactory_create_wstring_tc (DDS_TypeCodeFactory *self, DDS_UnsignedLong bound, DDS_ExceptionCode_t *ex)
 Constructs a DDS_TK_WSTRING DDS_TypeCode.
 
DDS_TypeCodeDDS_TypeCodeFactory_create_sequence_tc (DDS_TypeCodeFactory *self, DDS_UnsignedLong bound, const DDS_TypeCode *element_type, DDS_ExceptionCode_t *ex)
 Constructs a DDS_TK_SEQUENCE DDS_TypeCode.
 
DDS_TypeCodeDDS_TypeCodeFactory_create_array_tc (DDS_TypeCodeFactory *self, const struct DDS_UnsignedLongSeq *dimensions, const DDS_TypeCode *element_type, DDS_ExceptionCode_t *ex)
 Constructs a DDS_TK_ARRAY DDS_TypeCode.
 
DDS_TypeCodeDDS_TypeCodeFactory_create_sparse_tc (DDS_TypeCodeFactory *self, const char *name, DDS_ValueModifier type_modifier, const DDS_TypeCode *concrete_base, DDS_ExceptionCode_t *ex)
 Constructs a DDS_TK_SPARSE DDS_TypeCode.
 

Variables

DDS_TypeCode DDS_g_tc_null
 Basic NULL type.
 
DDS_TypeCode DDS_g_tc_short
 Basic 16-bit signed integer type.
 
DDS_TypeCode DDS_g_tc_long
 Basic 32-bit signed integer type.
 
DDS_TypeCode DDS_g_tc_ushort
 Basic unsigned 16-bit integer type.
 
DDS_TypeCode DDS_g_tc_ulong
 Basic unsigned 32-bit integer type.
 
DDS_TypeCode DDS_g_tc_float
 Basic 32-bit floating point type.
 
DDS_TypeCode DDS_g_tc_double
 Basic 64-bit floating point type.
 
DDS_TypeCode DDS_g_tc_boolean
 Basic Boolean type.
 
DDS_TypeCode DDS_g_tc_char
 Basic single-byte character type.
 
DDS_TypeCode DDS_g_tc_octet
 Basic octet/byte type.
 
DDS_TypeCode DDS_g_tc_longlong
 Basic 64-bit integer type.
 
DDS_TypeCode DDS_g_tc_ulonglong
 Basic unsigned 64-bit integer type.
 
DDS_TypeCode DDS_g_tc_longdouble
 Basic 128-bit floating point type.
 
DDS_TypeCode DDS_g_tc_wchar
 Basic four-byte character type.
 

Detailed Description

<<eXtension>> A DDS_TypeCode is a mechanism for representing a type at runtime. RTI Connext can use type codes to send type definitions on the network. You will need to understand this API in order to use the Dynamic Data capability or to inspect the type information you receive from remote readers and writers.

Type codes are values that are used to describe arbitrarily complex types at runtime. Type code values are manipulated via the DDS_TypeCode class, which has an analogue in CORBA.

A DDS_TypeCode value consists of a type code kind (represented by the DDS_TCKind enumeration) and a list of members (that is, fields). These members are recursive: each one has its own DDS_TypeCode, and in the case of complex types (structures, arrays, and so on), these contained type codes contain their own members.

There are a number of uses for type codes. The type code mechanism can be used to unambiguously match type representations. The DDS_TypeCode_equal function is a more reliable test than comparing the string type names, requiring equivalent definitions of the types.

Accessing a Local ::DDS_TypeCode

When generating types with rtiddsgen, type codes are enabled by default. (The -notypecode option can be used to disable generation of DDS_TypeCode information.) For these types, a DDS_TypeCode may be accessed by calling the Foo_get_typecode function for a type "Foo", which returns a DDS_TypeCode pointer.

This API also includes support for dynamic creation of DDS_TypeCode values, typically for use with the Dynamic Data API. You can create a DDS_TypeCode using the DDS_TypeCodeFactory class. You will construct the DDS_TypeCode recursively, from the outside in: start with the type codes for primitive types, then compose them into complex types like arrays, structures, and so on. You will find the following methods helpful:

Accessing a Remote ::DDS_TypeCode

In addition to being used locally, RTI Connext can transmit DDS_TypeCode on the network between participants. This information can be used to access information about types used remotely at runtime, for example to be able to publish or subscribe to topics of arbitrarily types (see Dynamic Data). This functionality is useful for a generic system monitoring tool like rtiddsspy.

Remote DDS_TypeCode information is shared during discovery over the publication and subscription built-in topics and can be accessed using the built-in readers for these topics; see Built-in Topics. Discovered DDS_TypeCode values are not cached by RTI Connext upon receipt and are therefore not available from the built-in topic data returned by DDS_DataWriter_get_matched_subscription_data or DDS_DataReader_get_matched_publication_data.

The space available locally to deserialize a discovered remote DDS_TypeCode is specified by the DDS_DomainParticipant's DDS_DomainParticipantResourceLimitsQosPolicy::type_code_max_serialized_length QoS parameter. To support especially complex type codes, it may be necessary for you to increase the value of this parameter.

See Also
DDS_TypeCode
Dynamic Data
rtiddsgen
DDS_SubscriptionBuiltinTopicData
DDS_PublicationBuiltinTopicData

Macro Definition Documentation

#define DDS_TYPECODE_MEMBER_ID_INVALID

A sentinel indicating an invalid DDS_TypeCode member ID.

#define DDS_TYPECODE_INDEX_INVALID

A sentinel indicating an invalid DDS_TypeCode member index.

#define DDS_TYPECODE_NOT_BITFIELD

Indicates that a member of a type is not a bitfield.

#define DDS_VM_NONE

Constant used to indicate that a value type has no modifiers.

See Also
DDS_ValueModifier
Examples:
HelloWorld.c.
#define DDS_VM_CUSTOM

Constant used to indicate that a value type has the custom modifier.

This modifier is used to specify whether the value type uses custom marshaling.

See Also
DDS_ValueModifier
#define DDS_VM_ABSTRACT

Constant used to indicate that a value type has the abstract modifier.

An abstract value type may not be instantiated.

See Also
DDS_ValueModifier
#define DDS_VM_TRUNCATABLE

Constant used to indicate that a value type has the truncatable modifier.

A value with a state that derives from another value with a state can be declared as truncatable. A truncatable type means the object can be truncated to the base type.

See Also
DDS_ValueModifier
#define DDS_PRIVATE_MEMBER

Constant used to indicate that a value type member is private.

See Also
DDS_Visibility
DDS_PUBLIC_MEMBER
Examples:
HelloWorld.c.
#define DDS_PUBLIC_MEMBER

Constant used to indicate that a value type member is public.

See Also
DDS_Visibility
DDS_PRIVATE_MEMBER
#define DDS_TYPECODE_NONKEY_MEMBER

A flag indicating that a type member is optional and not part of the key.

Only sparse value types (i.e. types of DDS_TCKind DDS_TK_SPARSE) support this flag. Non-key members of other type kinds should use the flag DDS_TYPECODE_NONKEY_REQUIRED_MEMBER.

If a type is used with the Dynamic Data facility, a DDS_DynamicData sample of the type will only contain a value for a DDS_TYPECODE_NONKEY_MEMBER field if one has been explicitly set (see, for example, DDS_DynamicData_set_long). The middleware will not assume any default value.

See Also
DDS_TYPECODE_KEY_MEMBER
DDS_TYPECODE_NONKEY_REQUIRED_MEMBER
DDS_TYPECODE_KEY_MEMBER
DDS_TypeCode_add_member
DDS_TypeCode_add_member_ex
DDS_TypeCode_is_member_key
DDS_TypeCode_is_member_required
DDS_StructMember::is_key
DDS_ValueMember::is_key
#define DDS_TYPECODE_KEY_MEMBER

A flag indicating that a type member is part of the key for that type, and therefore required.

If a type is used with the Dynamic Data facility, all DDS_DynamicData samples of the type will contain a value for all DDS_TYPECODE_KEY_MEMBER fields, even if the type is a sparse value type (i.e. of kind DDS_TK_SPARSE). If you do not set a value of the member explicitly (see, for example, DDS_DynamicData_set_long), the middleware will assume a default "zero" value: numeric values will be set to zero; strings and sequences will be of zero length.

See Also
DDS_TYPECODE_NONKEY_REQUIRED_MEMBER
DDS_TYPECODE_NONKEY_MEMBER
DDS_TypeCode_add_member
DDS_TypeCode_add_member_ex
DDS_TypeCode_is_member_key
DDS_TypeCode_is_member_required
DDS_StructMember::is_key
DDS_ValueMember::is_key
#define DDS_TYPECODE_NONKEY_REQUIRED_MEMBER

A flag indicating that a type member is not part of the key but is nevertheless required.

This is the most common kind of member.

If a type is used with the Dynamic Data facility, all DDS_DynamicData samples of the type will contain a value for all DDS_TYPECODE_NONKEY_REQUIRED_MEMBER fields, even if the type is a sparse value type (i.e. of kind DDS_TK_SPARSE). If you do not set a value of the member explicitly (see, for example, DDS_DynamicData_set_long), the middleware will assume a default "zero" value: numeric values will be set to zero; strings and sequences will be of zero length.

See Also
DDS_TYPECODE_KEY_MEMBER
DDS_TYPECODE_NONKEY_MEMBER
DDS_TYPECODE_KEY_MEMBER
DDS_TypeCode_add_member
DDS_TypeCode_add_member_ex
DDS_TypeCode_is_member_key
DDS_TypeCode_is_member_required
DDS_StructMember::is_key
DDS_ValueMember::is_key

Typedef Documentation

typedef short DDS_ValueModifier

Modifier type for a value type.

See Also
DDS_VM_NONE
DDS_VM_CUSTOM
DDS_VM_ABSTRACT
DDS_VM_TRUNCATABLE
typedef short DDS_Visibility

Type to indicate the visibility of a value type member.

See Also
DDS_PRIVATE_MEMBER
DDS_PUBLIC_MEMBER

Enumeration Type Documentation

enum DDS_TCKind

Enumeration type for DDS_TypeCode kinds.

Type code kinds are modeled as values of this type.

Enumerator:
DDS_TK_NULL 

Indicates that a type code does not describe anything.

DDS_TK_SHORT 

short type.

DDS_TK_LONG 

long type.

DDS_TK_USHORT 

unsigned short type.

DDS_TK_ULONG 

unsigned long type.

DDS_TK_FLOAT 

float type.

DDS_TK_DOUBLE 

double type.

DDS_TK_BOOLEAN 

boolean type.

DDS_TK_CHAR 

char type.

DDS_TK_OCTET 

octet type.

DDS_TK_STRUCT 

struct type.

DDS_TK_UNION 

union type.

DDS_TK_ENUM 

enumerated type.

DDS_TK_STRING 

string type.

DDS_TK_SEQUENCE 

sequence type.

DDS_TK_ARRAY 

array type.

DDS_TK_ALIAS 

alias (typedef) type.

DDS_TK_LONGLONG 

long long type.

DDS_TK_ULONGLONG 

unsigned long long type.

DDS_TK_LONGDOUBLE 

long double type.

DDS_TK_WCHAR 

wide char type.

DDS_TK_WSTRING 

wide string type.

DDS_TK_VALUE 

value type.

DDS_TK_SPARSE 

A sparse value type.

A sparse value type is one in which all of the fields are not necessarily sent on the network as a part of every sample.

Fields of a sparse value type fall into one of three categories:

Fields of the first two kinds must appear in every sample. These are also the only kinds of fields on which you can perform content filtering (see DDS_ContentFilteredTopic), because filter evaluation on a non-existent field is not well defined.

Type to indicate the extensibility of a type.

Enumerator:
DDS_FINAL_EXTENSIBILITY 

Specifies that a type has FINAL extensibility.

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

The following types are always final:

DDS_EXTENSIBLE_EXTENSIBILITY 

Specifies that a type has EXTENSIBLE extensibility.

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.

DDS_MUTABLE_EXTENSIBILITY 

Specifies that a type has MUTABLE extensibility.

[Not supported.]

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 following types are always mutable:

The support for type mutability in this release is limited to DDS_TK_SEQUENCE, DDS_TK_STRING, and DDS_TK_WSTRING.

Mutability in DDS_TK_STRUCT, DDS_TK_UNION, DDS_TK_VALUE, and DDS_TK_ENUM is not supported.

Function Documentation

DDS_TCKind DDS_TypeCode_kind ( const DDS_TypeCode self,
DDS_ExceptionCode_t ex 
)

Gets the DDS_TCKind value of a type code.

Parameters
self<<in>> Cannot be NULL.
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 functions may legally be invoked on it.

MT Safety:
SAFE.
Returns
The type code kind.
DDS_ExtensibilityKind DDS_TypeCode_extensibility_kind ( const DDS_TypeCode self,
DDS_ExceptionCode_t ex 
)

Gets the DDS_ExtensibilityKind value of a type code.

Parameters
self<<in>> Cannot be NULL.
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 example:

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

XML example:

<struct name="MyType" extensibility="extensible">
<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 EXTENSIBLE_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 self,
const DDS_TypeCode tc,
DDS_ExceptionCode_t ex 
)

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
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_ExceptionCode_t ex 
)

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
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_ExceptionCode_t ex 
)

Returns the number of members of the type code.

The function 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
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
)

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

The function 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
self<<in>> Cannot be NULL.
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 DDS_TypeCode self,
const char *  name,
DDS_ExceptionCode_t ex 
)

Get the index of the member of the given name.

MT Safety:
SAFE.
DDS_TypeCode* DDS_TypeCode_member_type ( const DDS_TypeCode self,
DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
)

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

The function 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
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
)

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

The function 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
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_UnsignedLong  member_index,
DDS_UnsignedLong  label_index,
DDS_ExceptionCode_t ex 
)

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

This function 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 function 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
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
)

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

The function 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
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
)

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
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
)

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 ( const DDS_TypeCode self,
DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
)

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

The function 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
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
)

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

The function 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
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
)

Returns the number of bits of a bitfield member.

The function 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
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
)

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 function always returns DDS_PUBLIC_MEMBER.

Parameters
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_ExceptionCode_t ex 
)

Returns the discriminator type code.

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

Precondition
self kind is DDS_TK_UNION.
MT Safety:
SAFE.
Parameters
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_ExceptionCode_t ex 
)

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
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_ExceptionCode_t ex 
)

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
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
)

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
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_ExceptionCode_t ex 
)

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 ( const DDS_TypeCode self,
DDS_ExceptionCode_t ex 
)

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
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_ExceptionCode_t ex 
)

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
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_ExceptionCode_t ex 
)

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

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

Precondition
self kind is DDS_TK_UNION
MT Safety:
SAFE.
Parameters
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_ExceptionCode_t ex 
)

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 function 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
self<<in>> Cannot be NULL.
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 ( const DDS_TypeCode self,
DDS_ExceptionCode_t ex 
)

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 function always returns DDS_VM_NONE.

MT Safety:
SAFE.
Parameters
self<<in>> Cannot be NULL.
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_UnsignedLong DDS_TypeCode_find_member_by_id ( const DDS_TypeCode self,
DDS_Long  id,
DDS_ExceptionCode_t ex 
)

Get the index of the member of the given ID.

MT Safety:
SAFE.
DDS_Long DDS_TypeCode_member_id ( const DDS_TypeCode self,
DDS_UnsignedLong  index,
DDS_ExceptionCode_t ex 
)

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

The function can be invoked on sparse DDS_TypeCode objects.

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

Precondition
self kind is DDS_TK_SPARSE.
Member index in the interval [0,(member count-1)].
MT Safety:
SAFE.
Parameters
self<<in>> Cannot be NULL.
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_add_member_to_enum ( DDS_TypeCode self,
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
self<<in>> Cannot be NULL.
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 ( DDS_TypeCode self,
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.

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.

// Integer:
myTypeCode,
"myFieldName",
// If the type is sparse, specify an ID. Otherwise, use this sentinel:
// New field is not a key:
// Sequence of 10 or fewer integers:
myTypeCode,
"myFieldName",
// If the type is sparse, specify an ID. Otherwise, use this sentinel:
DDS_TheTypeCodeFactory,
10,
// New field is not a key:
MT Safety:
UNSAFE.
Parameters
self<<in>> Cannot be NULL.
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_TK_SPARSE and DDS_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.
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 ( DDS_TypeCode self,
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.

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

MT Safety:
UNSAFE.
Parameters
self<<in>> Cannot be NULL.
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_TK_SPARSE and DDS_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_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_TypeCodeFactory
DDS_TYPECODE_NONKEY_MEMBER
DDS_TYPECODE_KEY_MEMBER
DDS_TYPECODE_NONKEY_REQUIRED_MEMBER
void DDS_TypeCode_print_IDL ( const DDS_TypeCode self,
DDS_UnsignedLong  indent,
DDS_ExceptionCode_t ex 
)

Prints a DDS_TypeCode in a pseudo-IDL notation.

MT Safety:
SAFE.
Parameters
self<<in>> Cannot be NULL.
indent<<in>> Indent.
ex<<out>> Parameter for error indications. The values that can take are:
DDS_TypeCodeFactory* DDS_TypeCodeFactory_get_instance ( )

Gets the singleton instance of this class.

Returns
The DDS_TypeCodeFactory instance if no errors. Otherwise, NULL.
DDS_TypeCode* DDS_TypeCodeFactory_clone_tc ( DDS_TypeCodeFactory self,
const DDS_TypeCode tc,
DDS_ExceptionCode_t ex 
)

Creates and returns a copy of the input DDS_TypeCode.

Parameters
self<<in>> Cannot be NULL.
tc<<in>> Type code that will be copied. Cannot be NULL.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A clone of tc.
void DDS_TypeCodeFactory_delete_tc ( DDS_TypeCodeFactory self,
DDS_TypeCode tc,
DDS_ExceptionCode_t ex 
)

Deletes the input DDS_TypeCode.

All the type codes created through the DDS_TypeCodeFactory must be deleted using this function.

Parameters
self<<in>> Cannot be NULL.
tc<<inout>> Type code that will be deleted. Cannot be NULL.
ex<<out>> Parameter for error indications. The values that can take are:
const DDS_TypeCode* DDS_TypeCodeFactory_get_primitive_tc ( DDS_TypeCodeFactory self,
DDS_TCKind  tc_kind 
)

Get the DDS_TypeCode for a primitive type (integers, floating point values, etc.) identified by the given DDS_TCKind.

This method is equivalent to, and replaces, the DDS_g_tc_* constants.

See Also
DDS_g_tc_long
DDS_g_tc_ulong
DDS_g_tc_short
DDS_g_tc_ushort
DDS_g_tc_float
DDS_g_tc_double
DDS_g_tc_longdouble
DDS_g_tc_octet
DDS_g_tc_boolean
DDS_g_tc_char
DDS_g_tc_wchar
DDS_TypeCode* DDS_TypeCodeFactory_create_struct_tc ( DDS_TypeCodeFactory self,
const char *  name,
const struct DDS_StructMemberSeq members,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_STRUCT DDS_TypeCode.

Parameters
self<<in>> Cannot be NULL.
name<<in>> Name of the struct type. Cannot be NULL.
members<<in>> Initial members of the structure. This list may be empty (that is, FooSeq_get_length may return zero). If the list is not empty, the elements must describe valid struct members. (For example, the names must be unique within the type.)
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a struct.
DDS_TypeCode* DDS_TypeCodeFactory_create_struct_tc_ex ( DDS_TypeCodeFactory self,
const char *  name,
DDS_ExtensibilityKind  extensibility_kind,
const struct DDS_StructMemberSeq members,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_STRUCT DDS_TypeCode.

Parameters
self<<in>> Cannot be NULL.
name<<in>> Name of the struct type. Cannot be NULL.
extensibility_kind<<in>> Type extensibility.
members<<in>> Initial members of the structure. This list may be empty (that is, FooSeq_get_length may return zero). If the list is not empty, the elements must describe valid struct members. (For example, the names must be unique within the type.)
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a struct.
DDS_TypeCode* DDS_TypeCodeFactory_create_value_tc ( DDS_TypeCodeFactory self,
const char *  name,
DDS_ValueModifier  type_modifier,
const DDS_TypeCode concrete_base,
const struct DDS_ValueMemberSeq members,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_VALUE DDS_TypeCode.

Parameters
self<<in>> Cannot be NULL.
name<<in>> Name of the value type. Cannot be NULL.
type_modifier<<in>> One of the value type modifier constants: DDS_VM_NONE, DDS_VM_CUSTOM, DDS_VM_ABSTRACT or DDS_VM_TRUNCATABLE.
concrete_base<<in>> DDS_TypeCode object describing the concrete valuetype base. It may be NULL if the valuetype does not have a concrete base.
members<<in>> Initial members of the value type. This list may be empty. If the list is not empty, the elements must describe valid value type members. (For example, the names must be unique within the type.)
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a value.
DDS_TypeCode* DDS_TypeCodeFactory_create_value_tc_ex ( DDS_TypeCodeFactory self,
const char *  name,
DDS_ExtensibilityKind  extensibility_kind,
DDS_ValueModifier  type_modifier,
const DDS_TypeCode concrete_base,
const struct DDS_ValueMemberSeq members,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_VALUE DDS_TypeCode.

Parameters
self<<in>> Cannot be NULL.
name<<in>> Name of the value type. Cannot be NULL.
extensibility_kind<<in>> Type extensibility.
type_modifier<<in>> One of the value type modifier constants: DDS_VM_NONE, DDS_VM_CUSTOM, DDS_VM_ABSTRACT or DDS_VM_TRUNCATABLE.
concrete_base<<in>> DDS_TypeCode object describing the concrete valuetype base. It may be NULL if the valuetype does not have a concrete base.
members<<in>> Initial members of the value type. This list may be empty. If the list is not empty, the elements must describe valid value type members. (For example, the names must be unique within the type.)
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a value.
DDS_TypeCode* DDS_TypeCodeFactory_create_union_tc ( DDS_TypeCodeFactory self,
const char *  name,
const DDS_TypeCode discriminator_type,
DDS_Long  default_index,
const struct DDS_UnionMemberSeq members,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_UNION DDS_TypeCode.

Parameters
self<<in>> Cannot be NULL.
name<<in>> Name of the union type. Cannot be NULL.
discriminator_type<<in>> Discriminator Type Code. Cannot be NULL.
default_index<<in>> Index of the default member, or -1 if there is no default member.
members<<in>> Initial members of the union. This list may be empty. If the list is not empty, the elements must describe valid struct members. (For example, the names must be unique within the type.)
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a union.
DDS_TypeCode* DDS_TypeCodeFactory_create_union_tc_ex ( DDS_TypeCodeFactory self,
const char *  name,
DDS_ExtensibilityKind  extensibility_kind,
const DDS_TypeCode discriminator_type,
DDS_Long  default_index,
const struct DDS_UnionMemberSeq members,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_UNION DDS_TypeCode.

Parameters
self<<in>> Cannot be NULL.
name<<in>> Name of the union type. Cannot be NULL.
extensibility_kind<<in>> Type extensibility.
discriminator_type<<in>> Discriminator Type Code. Cannot be NULL.
default_index<<in>> Index of the default member, or -1 if there is no default member.
members<<in>> Initial members of the union. This list may be empty. If the list is not empty, the elements must describe valid struct members. (For example, the names must be unique within the type.)
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a union.
DDS_TypeCode* DDS_TypeCodeFactory_create_enum_tc ( DDS_TypeCodeFactory self,
const char *  name,
const struct DDS_EnumMemberSeq members,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_ENUM DDS_TypeCode.

Parameters
self<<in>> Cannot be NULL.
name<<in>> Name of the enum type. Cannot be NULL.
members<<in>> Initial members of the enumeration. All members must have non-NULL names, and both names and ordinal values must be unique within the type. Note that it is also possible to add members later with DDS_TypeCode_add_member_to_enum.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing an enumeration.
DDS_TypeCode* DDS_TypeCodeFactory_create_enum_tc_ex ( DDS_TypeCodeFactory self,
const char *  name,
DDS_ExtensibilityKind  extensibility_kind,
const struct DDS_EnumMemberSeq members,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_ENUM DDS_TypeCode.

Parameters
self<<in>> Cannot be NULL.
name<<in>> Name of the enum type. Cannot be NULL.
extensibility_kind<<in>> Type extensibility.
members<<in>> Initial members of the enumeration. All members must have non-NULL names, and both names and ordinal values must be unique within the type. Note that it is also possible to add members later with DDS_TypeCode_add_member_to_enum.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing an enumeration.
DDS_TypeCode* DDS_TypeCodeFactory_create_alias_tc ( DDS_TypeCodeFactory self,
const char *  name,
const DDS_TypeCode original_type,
DDS_Boolean  is_pointer,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_ALIAS (typedef) DDS_TypeCode.

Parameters
self<<in>> Cannot be NULL.
name<<in>> Name of the alias. Cannot be NULL.
original_type<<in>> Aliased type code. Cannot be NULL.
is_pointer<<in>> Indicates if the alias is a pointer to the aliased type code.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing an alias.
DDS_TypeCode* DDS_TypeCodeFactory_create_string_tc ( DDS_TypeCodeFactory self,
DDS_UnsignedLong  bound,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_STRING DDS_TypeCode.

Parameters
self<<in>> Cannot be NULL.
bound<<in>> Maximum length of the string.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a string.
DDS_TypeCode* DDS_TypeCodeFactory_create_wstring_tc ( DDS_TypeCodeFactory self,
DDS_UnsignedLong  bound,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_WSTRING DDS_TypeCode.

Parameters
self<<in>> Cannot be NULL.
bound<<in>> Maximum length of the wide string.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a wide string.
DDS_TypeCode* DDS_TypeCodeFactory_create_sequence_tc ( DDS_TypeCodeFactory self,
DDS_UnsignedLong  bound,
const DDS_TypeCode element_type,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_SEQUENCE DDS_TypeCode.

Parameters
self<<in>> Cannot be NULL.
bound<<in>> The bound for the sequence (> 0).
element_type<<in>> DDS_TypeCode object describing the sequence elements.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a sequence.
DDS_TypeCode* DDS_TypeCodeFactory_create_array_tc ( DDS_TypeCodeFactory self,
const struct DDS_UnsignedLongSeq dimensions,
const DDS_TypeCode element_type,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_ARRAY DDS_TypeCode.

Parameters
self<<in>> Cannot be NULL.
dimensions<<in>> Dimensions of the array. Each dimension has to be greater than 0.
element_type<<in>> DDS_TypeCode describing the array elements. Cannot be NULL.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a sequence.
DDS_TypeCode* DDS_TypeCodeFactory_create_sparse_tc ( DDS_TypeCodeFactory self,
const char *  name,
DDS_ValueModifier  type_modifier,
const DDS_TypeCode concrete_base,
DDS_ExceptionCode_t ex 
)

Constructs a DDS_TK_SPARSE DDS_TypeCode.

A sparse value type is similar to other value types but with one major difference: not all members need to be present in every sample.

It is not possible to generate code for sparse value types; they must be created at runtime using these APIs. You will interact with samples of sparse types using the Dynamic Data APIs.

Parameters
self<<in>> Cannot be NULL.
name<<in>> Name of the value type. Cannot be NULL.
type_modifier<<in>> One of the value type modifier constants: DDS_VM_NONE, DDS_VM_CUSTOM, DDS_VM_ABSTRACT or DDS_VM_TRUNCATABLE.
concrete_base<<in>> DDS_TypeCode object describing the concrete valuetype base. It may be NULL if the valuetype does not have a concrete base.
ex<<out>> Parameter for error indications. The values that can take are:
Returns
A newly-created DDS_TypeCode object describing a value.

Variable Documentation

DDS_TypeCode DDS_g_tc_null

Basic NULL type.

For new code, DDS_TypeCodeFactory_get_primitive_tc is preferred to using this global variable.

See Also
DDS_TypeCodeFactory_get_primitive_tc
DDS_TypeCode DDS_g_tc_short

Basic 16-bit signed integer type.

For new code, DDS_TypeCodeFactory_get_primitive_tc is preferred to using this global variable.

See Also
DDS_TypeCodeFactory_get_primitive_tc
DDS_Short
DDS_TypeCode DDS_g_tc_long

Basic 32-bit signed integer type.

For new code, DDS_TypeCodeFactory_get_primitive_tc is preferred to using this global variable.

See Also
DDS_TypeCodeFactory_get_primitive_tc
DDS_Long
DDS_TypeCode DDS_g_tc_ushort

Basic unsigned 16-bit integer type.

For new code, DDS_TypeCodeFactory_get_primitive_tc is preferred to using this global variable.

See Also
DDS_TypeCodeFactory_get_primitive_tc
DDS_UnsignedShort
DDS_TypeCode DDS_g_tc_ulong

Basic unsigned 32-bit integer type.

For new code, DDS_TypeCodeFactory_get_primitive_tc is preferred to using this global variable.

See Also
DDS_TypeCodeFactory_get_primitive_tc
DDS_UnsignedLong
DDS_TypeCode DDS_g_tc_float

Basic 32-bit floating point type.

For new code, DDS_TypeCodeFactory_get_primitive_tc is preferred to using this global variable.

See Also
DDS_TypeCodeFactory_get_primitive_tc
DDS_Float
DDS_TypeCode DDS_g_tc_double

Basic 64-bit floating point type.

For new code, DDS_TypeCodeFactory_get_primitive_tc is preferred to using this global variable.

See Also
DDS_TypeCodeFactory_get_primitive_tc
DDS_Double
DDS_TypeCode DDS_g_tc_boolean

Basic Boolean type.

For new code, DDS_TypeCodeFactory_get_primitive_tc is preferred to using this global variable.

See Also
DDS_TypeCodeFactory_get_primitive_tc
DDS_Boolean
DDS_TypeCode DDS_g_tc_char

Basic single-byte character type.

For new code, DDS_TypeCodeFactory_get_primitive_tc is preferred to using this global variable.

See Also
DDS_TypeCodeFactory_get_primitive_tc
DDS_Char
DDS_TypeCode DDS_g_tc_octet

Basic octet/byte type.

For new code, DDS_TypeCodeFactory_get_primitive_tc is preferred to using this global variable.

See Also
DDS_TypeCodeFactory_get_primitive_tc
DDS_Octet
DDS_TypeCode DDS_g_tc_longlong

Basic 64-bit integer type.

For new code, DDS_TypeCodeFactory_get_primitive_tc is preferred to using this global variable.

See Also
DDS_TypeCodeFactory_get_primitive_tc
DDS_LongLong
DDS_TypeCode DDS_g_tc_ulonglong

Basic unsigned 64-bit integer type.

For new code, DDS_TypeCodeFactory_get_primitive_tc is preferred to using this global variable.

See Also
DDS_TypeCodeFactory_get_primitive_tc
DDS_UnsignedLongLong
DDS_TypeCode DDS_g_tc_longdouble

Basic 128-bit floating point type.

For new code, DDS_TypeCodeFactory_get_primitive_tc is preferred to using this global variable.

See Also
DDS_TypeCodeFactory_get_primitive_tc
DDS_LongDouble
DDS_TypeCode DDS_g_tc_wchar

Basic four-byte character type.

For new code, DDS_TypeCodeFactory_get_primitive_tc is preferred to using this global variable.

See Also
DDS_TypeCodeFactory_get_primitive_tc
DDS_Wchar

RTI Connext C API Version 5.0.0 Copyright © Thu Aug 30 2012 Real-Time Innovations, Inc