RTI Connext Java API Version 7.3.0

<<interface>> <<generic>> User data type specific interface. More...

Inherits TypeSupportImpl.

Public Member Functions

Object copy_data (Object destination, Object source)
 
long serialize_to_cdr_buffer (byte[] buffer, long length, Foo src)
 <<extension>> Serializes the input sample into a CDR buffer of octets. More...
 
long serialize_to_cdr_buffer (byte[] buffer, long length, Foo src, short representation)
 <<extension>> Serializes the input sample into a buffer of octets. More...
 
void deserialize_from_cdr_buffer (Foo dst, byte[] buffer, long length)
 <<extension>> Deserializes a sample from a buffer of octets. More...
 
String data_to_string (Foo src, PrintFormatProperty formatProperty)
 <<extension>> Transforms a data sample into a human-readable string representation. More...
 
String data_to_string (Foo src)
 <<extension>> Transforms a data sample into a human-readable string representation using the default values for com.rti.dds.topic.PrintFormatProperty. More...
 
Foo data_from_string (String str, PrintFormatKind printFormat)
 <<extension>> Creates a new sample from a string. More...
 
Foo data_from_string (String str)
 <<extension>> Creates a new Foo sample from a JSON string. More...
 
DynamicData data_to_dynamicdata (Object data)
 <<extension>> Creates a new DynamicData sample from an existing Foo sample More...
 
Foo data_from_dynamicdata (DynamicData dynamicData)
 <<extension>> Creates a new Foo sample from an existing DynamicData sample. More...
 

Static Public Member Functions

static String get_type_name ()
 Get the default name for this type. More...
 
static void register_type (DomainParticipant participant, String type_name)
 Allows an application to communicate to RTI Connext the existence of a data type. More...
 
static TypeCode getTypeCode ()
 <<extension>> Retrieves the TypeCode for the Type. More...
 

Detailed Description

<<interface>> <<generic>> User data type specific interface.

Defines the user data type specific interface generated for each application class.

The concrete user data type automatically generated by the implementation is an incarnation of this class.

See also
the Code Generator User's Manual

Member Function Documentation

◆ get_type_name()

static String get_type_name ( )
static

Get the default name for this type.

Can be used for calling com.rti.ndds.example.FooTypeSupport.register_type or creating com.rti.dds.topic.Topic

Returns
default name for this type
See also
com.rti.ndds.example.FooTypeSupport.register_type
com.rti.dds.domain.DomainParticipant.create_topic

◆ register_type()

static void register_type ( DomainParticipant  participant,
String  type_name 
)
static

Allows an application to communicate to RTI Connext the existence of a data type.

The generated implementation of the operation embeds all the knowledge that has to be communicated to the middleware in order to make it able to manage the contents of data of that type. This includes in particular the key definition that will allow RTI Connext to distinguish different instances of the same type.

The same com.rti.dds.topic.TypeSupport can be registered multiple times with a com.rti.dds.domain.DomainParticipant using the same or different values for the type_name. If register_type is called multiple times on the same com.rti.dds.topic.TypeSupport with the same com.rti.dds.domain.DomainParticipant and type_name, the second (and subsequent) registrations are ignored but the operation returns com.rti.dds.infrastructure.RETCODE_OK.

Precondition
Cannot use the same type_name to register two different com.rti.dds.topic.TypeSupport with the same com.rti.dds.domain.DomainParticipant, or else the operation will fail and com.rti.dds.infrastructure.RETCODE_PRECONDITION_NOT_MET will be returned.
Parameters
participant<<in>> the com.rti.dds.domain.DomainParticipant to register the data type Foo with. Cannot be NULL.
type_name<<in>> the type name under with the data type Foo is registered with the participant; this type name is used when creating a new com.rti.dds.topic.Topic. (See com.rti.dds.domain.DomainParticipant.create_topic.) The name may not be NULL or longer than 255 characters.
Exceptions
Oneof the Standard Return Codes, com.rti.dds.infrastructure.RETCODE_PRECONDITION_NOT_MET or com.rti.dds.infrastructure.RETCODE_OUT_OF_RESOURCES.
MT Safety:
UNSAFE on the FIRST call. It is not safe for two threads to simultaneously make the first call to register a type. Subsequent calls are thread safe.
See also
com.rti.dds.domain.DomainParticipant.create_topic

◆ getTypeCode()

static TypeCode getTypeCode ( )
static

<<extension>> Retrieves the TypeCode for the Type.

This method retrieves the com.rti.dds.typecode.TypeCode for the Type. A com.rti.dds.typecode.TypeCode is a mechanism for representing a type at runtime. RTI Connext can use type codes to send type definitions on the network. A com.rti.dds.typecode.TypeCode value consists of a type code kind (represented by the com.rti.dds.typecode.TCKind enumeration) and a list of members (that is, fields). These members are recursive: each one has its own com.rti.dds.typecode.TypeCode, and in the case of complex types (structures, arrays, and so on), these contained type codes contain their own members.

Returns
The TypeCode for this type

◆ copy_data()

Object copy_data ( Object  destination,
Object  source 
)

This is a concrete implementation of this method inherited from the base class. This method will perform a deep copy of source into destination.

Parameters
sourceThe Object which contains the data to be copied.
destinationThe object where data will be copied to.
Returns
Returns destination.
Exceptions
NullPointerExceptionIf destination or source is null.
ClassCastExceptionIf either destination or this is not a Foo type.

References Foo.copy_from().

◆ serialize_to_cdr_buffer() [1/2]

long serialize_to_cdr_buffer ( byte[]  buffer,
long  length,
Foo  src 
)

<<extension>> Serializes the input sample into a CDR buffer of octets.

This method serializes a sample into a buffer of octets using Common Data Representation (CDR). Calling this method is equivalent to calling com.rti.ndds.example.FooTypeSupport.serialize_to_cdr_buffer with com.rti.dds.infrastructure.DataRepresentationQosPolicy.AUTO_DATA_REPRESENTATION as the representation.

The input buffer must be big enough to store the serialized representation of the sample. Otherwise, the method will return an error.

To determine the minimum size of the input buffer, the user must call this method with the buffer set to null.

For more information about CDR in Connext, see Data Representation in the Core Libraries Extensible Types Guide.

Parameters
src<<in>>. Input sample. Cannot be null.
buffer<<out>>. Serialization buffer.
length<<in>>. When buffer is not null, length must contain the size of the input buffer when the method is invoked. This parameter is ignored when buffer is set to null.
Returns
When buffer is set to null, this method will return a buffer size big enough to hold the serialized data. Notice that the size is conservative and it may be greater than the actual size after serialization. When buffer is different than null, this method will return the actual size of the serialized content. This is the size that must be provided to the com.rti.ndds.example.FooTypeSupport.deserialize_from_cdr_buffer.
Exceptions
Oneof the Standard Return Codes , java.lang.IllegalStateException

◆ serialize_to_cdr_buffer() [2/2]

long serialize_to_cdr_buffer ( byte[]  buffer,
long  length,
Foo  src,
short  representation 
)

<<extension>> Serializes the input sample into a buffer of octets.

This method serializes a sample into a buffer of octets using the input data representation. See com.rti.ndds.example.FooTypeSupport.serialize_to_cdr_buffer for details.

Parameters
src<<in>>. Input sample. Cannot be null.
buffer<<out>>. Serialization buffer.
length<<in>>. Serialization buffer length.
representation<<in>>. Representation used to serialize the data.
Returns
Size of the serialized content.
Exceptions
Oneof the Standard Return Codes , java.lang.IllegalStateException

◆ deserialize_from_cdr_buffer()

void deserialize_from_cdr_buffer ( Foo  dst,
byte[]  buffer,
long  length 
)

<<extension>> Deserializes a sample from a buffer of octets.

This method deserializes a sample from a CDR buffer of octets.

The content of the buffer generated by the method com.rti.ndds.example.FooTypeSupport.serialize_to_cdr_buffer can be provided to this method to get the sample back.

Parameters
dst<<out>>. Output sample. Cannot be null.
buffer<<in>>. Deserialization buffer. Cannot be null.
length<<in>>. Length of the serialized representation of the sample in the buffer.
Exceptions
Oneof the Standard Return Codes , java.lang.IllegalStateException

◆ data_to_string() [1/2]

String data_to_string ( Foo  src,
PrintFormatProperty  formatProperty 
)

<<extension>> Transforms a data sample into a human-readable string representation.

This method takes a data sample and creates a string representation of the data.

If the size of the output string is longer than the size of an unsigned 32-bit integer, this operation will fail with com.rti.dds.infrastructure.RETCODE_OUT_OF_RESOURCES.

This method is only provided for types that were generated with typecodes.

Parameters
src<<out>>. The sample to get the string representation of. Cannot be null.
formatProperty<<in>>. Properties describing what the format of the output string should be.
Exceptions
Oneof the Standard Return Codes, com.rti.dds.infrastructure.RETCODE_OUT_OF_RESOURCES , java.lang.IllegalStateException

◆ data_to_string() [2/2]

String data_to_string ( Foo  src)

<<extension>> Transforms a data sample into a human-readable string representation using the default values for com.rti.dds.topic.PrintFormatProperty.

See also
com.rti.ndds.example.FooTypeSupport.data_to_string

◆ data_from_string() [1/2]

Foo data_from_string ( String  str,
PrintFormatKind  printFormat 
)

<<extension>> Creates a new sample from a string.

This method takes a string representation of the data and creates a new data sample.

Parameters
str<<in>>. The JSON string representation
printFormat<<in>>. Must be set to com.rti.dds.topic.PrintFormatKind.JSON_PRINT_FORMAT, the only format currently supported.

◆ data_from_string() [2/2]

Foo data_from_string ( String  str)

<<extension>> Creates a new Foo sample from a JSON string.

This method is an overload that does not take a PrintFormatKind.

Parameters
str<<in>>. The JSON string representation
See also
com.rti.ndds.example.FooTypeSupport.data_from_string

◆ data_to_dynamicdata()

DynamicData data_to_dynamicdata ( Object  data)

<<extension>> Creates a new DynamicData sample from an existing Foo sample

This method takes a Foo sample and creates a new DynamicData sample from it. The resulting DynamicData sample will have the same type and contain the same values as the Foo sample.

Parameters
data<<in>>. The Foo sample that will be transformed into a DynamicData sample.
See also
com.rti.ndds.example.FooTypeSupport.data_from_dynamicdata.

◆ data_from_dynamicdata()

Foo data_from_dynamicdata ( DynamicData  dynamicData)

<<extension>> Creates a new Foo sample from an existing DynamicData sample.

This method takes a DynamicData sample and uses it to create a new Foo sample.

A precondition for this operation is that the type of the DynamicData need to be assignable to Foo. If this not the case, the behavior is undefined.

Parameters
dynamicData<<in>>. The DynamicData sample to be transformed into a Foo sample.
See also
com.rti.ndds.example.FooTypeSupport.data_to_dynamicdata
com.rti.ndds.example.FooTypeSupport.getTypeCode
com.rti.dds.typecode.TypeCode.TypeCode.assignable