RTI Connext Java API  Version 5.3.1
 All Classes Namespaces Functions Variables Groups Pages
TypeCodeFactory Class Reference

A singleton factory for creating, copying, and deleting data type definitions dynamically. More...

Public Member Functions

TypeCode create_struct_tc (String name, ExtensibilityKind extensibility_kind, StructMember[] members) throws BAD_PARAM
 Constructs a com.rti.dds.typecode.TCKind.TK_STRUCT com.rti.dds.typecode.TypeCode.
 
TypeCode create_struct_tc (String name, StructMember[] members) throws BAD_PARAM
 Constructs a com.rti.dds.typecode.TCKind.TK_STRUCT com.rti.dds.typecode.TypeCode.
 
TypeCode create_value_tc (String name, ExtensibilityKind extensibility_kind, short type_modifier, TypeCode concrete_base, ValueMember[] members) throws BAD_PARAM
 Constructs a com.rti.dds.typecode.TCKind.TK_VALUE com.rti.dds.typecode.TypeCode.
 
TypeCode create_value_tc (String name, short type_modifier, TypeCode concrete_base, ValueMember[] members) throws BAD_PARAM
 Constructs a com.rti.dds.typecode.TCKind.TK_VALUE com.rti.dds.typecode.TypeCode.
 
TypeCode create_union_tc (String name, ExtensibilityKind extensibility_kind, TypeCode discriminator_type, int default_index, UnionMember[] members) throws BAD_PARAM
 Constructs a com.rti.dds.typecode.TCKind.TK_UNION com.rti.dds.typecode.TypeCode.
 
TypeCode create_union_tc (String name, TypeCode discriminator_type, int default_index, UnionMember[] members) throws BAD_PARAM
 Constructs a com.rti.dds.typecode.TCKind.TK_UNION com.rti.dds.typecode.TypeCode.
 
TypeCode create_enum_tc (String name, ExtensibilityKind extensibility_kind, EnumMember[] members) throws BAD_PARAM
 Constructs a com.rti.dds.typecode.TCKind.TK_ENUM com.rti.dds.typecode.TypeCode.
 
TypeCode create_enum_tc (String name, EnumMember[] members) throws BAD_PARAM
 Constructs a com.rti.dds.typecode.TCKind.TK_ENUM com.rti.dds.typecode.TypeCode.
 
TypeCode create_alias_tc (String name, TypeCode original_type, boolean is_pointer) throws BAD_PARAM
 Constructs a com.rti.dds.typecode.TCKind.TK_ALIAS (typedef) com.rti.dds.typecode.TypeCode.
 
TypeCode create_string_tc (int bound) throws BAD_PARAM
 Constructs a com.rti.dds.typecode.TCKind.TK_STRING com.rti.dds.typecode.TypeCode.
 
TypeCode create_wstring_tc (int bound) throws BAD_PARAM
 Constructs a com.rti.dds.typecode.TCKind.TK_WSTRING com.rti.dds.typecode.TypeCode.
 
TypeCode create_sequence_tc (int bound, TypeCode element_type) throws BAD_PARAM
 Constructs a com.rti.dds.typecode.TCKind.TK_SEQUENCE com.rti.dds.typecode.TypeCode.
 
TypeCode create_array_tc (int[] dimensions, TypeCode element_type) throws BAD_PARAM
 Constructs a com.rti.dds.typecode.TCKind.TK_ARRAY com.rti.dds.typecode.TypeCode.
 
TypeCode create_array_tc (int length, TypeCode element_type) throws BAD_PARAM
 Constructs a com.rti.dds.typecode.TCKind.TK_ARRAY com.rti.dds.typecode.TypeCode for a single-dimensional array.
 
TypeCode clone_tc (TypeCode tc)
 Creates and returns a copy of the input com.rti.dds.typecode.TypeCode.
 
void delete_tc (TypeCode tc)
 Deletes the input com.rti.dds.typecode.TypeCode.
 
TypeCode get_primitive_tc (TCKind kind) throws BAD_PARAM
 Get the com.rti.dds.typecode.TypeCode for a primitive type (integers, floating point values, etc.) identified by the given com.rti.dds.typecode.TCKind.
 

Static Public Member Functions

static final TypeCodeFactory get_instance ()
 Gets the singleton instance of this class.
 

Detailed Description

A singleton factory for creating, copying, and deleting data type definitions dynamically.

You can access the singleton with the com.rti.dds.typecode.TypeCodeFactory.get_instance method.

If you want to publish and subscribe to data of types that are not known to you at system design time, this class will be your starting point. After creating a data type definition with this class, you will modify that definition using the com.rti.dds.typecode.TypeCode class and then register it with the Dynamic Data API.

The methods of this class fall into several categories:

Getting definitions for primitive types:
Type definitions for primitive types (e.g. integers, floating point values, etc.) are pre-defined; your application only needs to get them, not create them.

Creating definitions for strings, arrays, and sequences:
Type definitions for strings, arrays, and sequences (i.e. variables-size lists) must be created as you need them, because the type definition includes the maximum length of those containers.

Creating definitions for structured types:
Structured types include structures, value types, and unions.

Creating definitions for other types:
The type system also supports enumerations and aliases (i.e. typedefs in C and C++).

Deleting type definitions:
When you're finished using a type definition, you should delete it. (Note that you only need to delete a com.rti.dds.typecode.TypeCode that you created; if you got the object from com.rti.dds.typecode.TypeCodeFactory.get_primitive_tc, you must not delete it.)

Copying type definitions:
You can also create deep copies of type definitions:

Member Function Documentation

static final TypeCodeFactory get_instance ( )
static

Gets the singleton instance of this class.

Returns
The com.rti.dds.typecode.TypeCodeFactory instance if no errors. Otherwise, null.
TypeCode create_struct_tc ( String  name,
ExtensibilityKind  extensibility_kind,
StructMember[]  members 
) throws BAD_PARAM

Constructs a com.rti.dds.typecode.TCKind.TK_STRUCT com.rti.dds.typecode.TypeCode.

Parameters
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, com.rti.dds.infrastructure.com.rti.dds.util.Sequence.Sequence.size() 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.) This argument may be null.
Exceptions
com.rti.dds.infrastructure.ExceptionCode_t.BAD_PARAM.Illegal parameter value.
Returns
A newly-created com.rti.dds.typecode.TypeCode object describing a struct.
TypeCode create_struct_tc ( String  name,
StructMember[]  members 
) throws BAD_PARAM

Constructs a com.rti.dds.typecode.TCKind.TK_STRUCT com.rti.dds.typecode.TypeCode.

Parameters
name<<in>> Name of the struct type. Cannot be null.
members<<in>> Initial members of the structure. This list may be empty (that is, com.rti.dds.infrastructure.com.rti.dds.util.Sequence.Sequence.size() 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.) This argument may be null.
Exceptions
com.rti.dds.infrastructure.ExceptionCode_t.BAD_PARAM.Illegal parameter value.
Returns
A newly-created com.rti.dds.typecode.TypeCode object describing a struct.
TypeCode create_value_tc ( String  name,
ExtensibilityKind  extensibility_kind,
short  type_modifier,
TypeCode  concrete_base,
ValueMember[]  members 
) throws BAD_PARAM

Constructs a com.rti.dds.typecode.TCKind.TK_VALUE com.rti.dds.typecode.TypeCode.

Parameters
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: com.rti.dds.typecode.ValueModifier.VM_NONE, com.rti.dds.typecode.ValueModifier.VM_CUSTOM, com.rti.dds.typecode.ValueModifier.VM_ABSTRACT or com.rti.dds.typecode.ValueModifier.VM_TRUNCATABLE.
concrete_base<<in>> com.rti.dds.typecode.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.) This argument may be null.
Exceptions
com.rti.dds.infrastructure.ExceptionCode_t.BAD_PARAM.Illegal parameter value.
Returns
A newly-created com.rti.dds.typecode.TypeCode object describing a value.
TypeCode create_value_tc ( String  name,
short  type_modifier,
TypeCode  concrete_base,
ValueMember[]  members 
) throws BAD_PARAM

Constructs a com.rti.dds.typecode.TCKind.TK_VALUE com.rti.dds.typecode.TypeCode.

Parameters
name<<in>> Name of the value type. Cannot be null.
type_modifier<<in>> One of the value type modifier constants: com.rti.dds.typecode.ValueModifier.VM_NONE, com.rti.dds.typecode.ValueModifier.VM_CUSTOM, com.rti.dds.typecode.ValueModifier.VM_ABSTRACT or com.rti.dds.typecode.ValueModifier.VM_TRUNCATABLE.
concrete_base<<in>> com.rti.dds.typecode.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.) This argument may be null.
Exceptions
com.rti.dds.infrastructure.ExceptionCode_t.BAD_PARAM.Illegal parameter value.
Returns
A newly-created com.rti.dds.typecode.TypeCode object describing a value.
TypeCode create_union_tc ( String  name,
ExtensibilityKind  extensibility_kind,
TypeCode  discriminator_type,
int  default_index,
UnionMember[]  members 
) throws BAD_PARAM

Constructs a com.rti.dds.typecode.TCKind.TK_UNION com.rti.dds.typecode.TypeCode.

Parameters
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.) This argument may be null.
Exceptions
com.rti.dds.infrastructure.ExceptionCode_t.BAD_PARAM.Illegal parameter value.
Returns
A newly-created com.rti.dds.typecode.TypeCode object describing a union.
TypeCode create_union_tc ( String  name,
TypeCode  discriminator_type,
int  default_index,
UnionMember[]  members 
) throws BAD_PARAM

Constructs a com.rti.dds.typecode.TCKind.TK_UNION com.rti.dds.typecode.TypeCode.

Parameters
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.) This argument may be null.
Exceptions
com.rti.dds.infrastructure.ExceptionCode_t.BAD_PARAM.Illegal parameter value.
Returns
A newly-created com.rti.dds.typecode.TypeCode object describing a union.
TypeCode create_enum_tc ( String  name,
ExtensibilityKind  extensibility_kind,
EnumMember[]  members 
) throws BAD_PARAM

Constructs a com.rti.dds.typecode.TCKind.TK_ENUM com.rti.dds.typecode.TypeCode.

Parameters
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 com.rti.dds.typecode.TypeCode.add_member_to_enum. This argument may be null.
Exceptions
com.rti.dds.infrastructure.ExceptionCode_t.BAD_PARAM.Illegal parameter value.
Returns
A newly-created com.rti.dds.typecode.TypeCode object describing an enumeration.
TypeCode create_enum_tc ( String  name,
EnumMember[]  members 
) throws BAD_PARAM

Constructs a com.rti.dds.typecode.TCKind.TK_ENUM com.rti.dds.typecode.TypeCode.

Parameters
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 com.rti.dds.typecode.TypeCode.add_member_to_enum. This argument may be null.
Exceptions
com.rti.dds.infrastructure.ExceptionCode_t.BAD_PARAM.Illegal parameter value.
Returns
A newly-created com.rti.dds.typecode.TypeCode object describing an enumeration.
TypeCode create_alias_tc ( String  name,
TypeCode  original_type,
boolean  is_pointer 
) throws BAD_PARAM

Constructs a com.rti.dds.typecode.TCKind.TK_ALIAS (typedef) com.rti.dds.typecode.TypeCode.

Parameters
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.
Exceptions
com.rti.dds.infrastructure.ExceptionCode_t.BAD_PARAM.Illegal parameter value.
Returns
A newly-created com.rti.dds.typecode.TypeCode object describing an alias.
TypeCode create_string_tc ( int  bound) throws BAD_PARAM

Constructs a com.rti.dds.typecode.TCKind.TK_STRING com.rti.dds.typecode.TypeCode.

Parameters
bound<<in>> Maximum length of the string. It cannot be negative.
Exceptions
com.rti.dds.infrastructure.ExceptionCode_t.BAD_PARAM.Illegal parameter value.
Returns
A newly-created com.rti.dds.typecode.TypeCode object describing a string.
TypeCode create_wstring_tc ( int  bound) throws BAD_PARAM

Constructs a com.rti.dds.typecode.TCKind.TK_WSTRING com.rti.dds.typecode.TypeCode.

Parameters
bound<<in>> Maximum length of the wide string. It cannot be negative.
Exceptions
com.rti.dds.infrastructure.ExceptionCode_t.BAD_PARAM.Illegal parameter value.
Returns
A newly-created com.rti.dds.typecode.TypeCode object describing a wide string.
TypeCode create_sequence_tc ( int  bound,
TypeCode  element_type 
) throws BAD_PARAM

Constructs a com.rti.dds.typecode.TCKind.TK_SEQUENCE com.rti.dds.typecode.TypeCode.

Parameters
bound<<in>> The bound for the sequence (> 0).
element_type<<in>> com.rti.dds.typecode.TypeCode object describing the sequence elements.
Exceptions
com.rti.dds.infrastructure.ExceptionCode_t.BAD_PARAM.Illegal parameter value.
Returns
A newly-created com.rti.dds.typecode.TypeCode object describing a sequence.
TypeCode create_array_tc ( int[]  dimensions,
TypeCode  element_type 
) throws BAD_PARAM

Constructs a com.rti.dds.typecode.TCKind.TK_ARRAY com.rti.dds.typecode.TypeCode.

Parameters
dimensions<<in>> Dimensions of the array. Each dimension has to be greater than 0.
element_type<<in>> com.rti.dds.typecode.TypeCode describing the array elements. Cannot be null.
Exceptions
com.rti.dds.infrastructure.ExceptionCode_t.BAD_PARAM.Illegal parameter value.
Returns
A newly-created com.rti.dds.typecode.TypeCode object describing a sequence.
TypeCode create_array_tc ( int  length,
TypeCode  element_type 
) throws BAD_PARAM

Constructs a com.rti.dds.typecode.TCKind.TK_ARRAY com.rti.dds.typecode.TypeCode for a single-dimensional array.

Parameters
length<<in>> Length of the single-dimensional array.
element_type<<in>> com.rti.dds.typecode.TypeCode describing the array elements. Cannot be null.
Exceptions
com.rti.dds.infrastructure.ExceptionCode_t.BAD_PARAM.Illegal parameter value.
Returns
A newly-created com.rti.dds.typecode.TypeCode object describing a sequence.
TypeCode clone_tc ( TypeCode  tc)

Creates and returns a copy of the input com.rti.dds.typecode.TypeCode.

Parameters
tc<<in>> Type code that will be copied. Cannot be null.
Returns
A clone of tc.
void delete_tc ( TypeCode  tc)

Deletes the input com.rti.dds.typecode.TypeCode.

Calling this method is optional. If you do not call it, the garbage collector will perform the deletion when it is able.

Parameters
tc<<inout>> Type code that will be deleted. Cannot be null.
TypeCode get_primitive_tc ( TCKind  kind) throws BAD_PARAM

Get the com.rti.dds.typecode.TypeCode for a primitive type (integers, floating point values, etc.) identified by the given com.rti.dds.typecode.TCKind.

See Also
com.rti.dds.typecode.TypeCode.TypeCode.TC_LONG
com.rti.dds.typecode.TypeCode.TypeCode.TC_ULONG
com.rti.dds.typecode.TypeCode.TypeCode.TC_SHORT
com.rti.dds.typecode.TypeCode.TypeCode.TC_USHORT
com.rti.dds.typecode.TypeCode.TypeCode.TC_FLOAT
com.rti.dds.typecode.TypeCode.TypeCode.TC_DOUBLE
com.rti.dds.typecode.TypeCode.TypeCode.TC_LONGDOUBLE
com.rti.dds.typecode.TypeCode.TypeCode.TC_OCTET
com.rti.dds.typecode.TypeCode.TypeCode.TC_BOOLEAN
com.rti.dds.typecode.TypeCode.TypeCode.TC_CHAR
com.rti.dds.typecode.TypeCode.TypeCode.TC_WCHAR

RTI Connext Java API Version 5.3.1 Copyright © Mon Feb 19 2018 Real-Time Innovations, Inc