RTI Connext Traditional C++ API Version 7.3.0

A Sample represents an instance of the IDL topic-type and contains the data in serialized format. More...

Classes

class  rti::flat::Sample< OffsetType >
 The generic definition of FlatData topic-types. More...
 
struct  rti::flat::flat_type_traits< T >
 Given a Sample, an Offset or a Builder, it allows obtaining the other types. More...
 

Typedefs

typedef rti::flat::Sample< MyFlatFinalOffsetMyFlatFinal
 Represents an arbitrary user-defined FlatData final IDL struct. More...
 
typedef rti::flat::Sample< MyFlatMutableOffsetMyFlatMutable
 Represents an arbitrary user-defined flat mutable IDL struct. More...
 
typedef rti::flat::Sample< MyFlatUnionOffsetMyFlatUnion
 Represents an arbitrary user-defined flat mutable IDL union. More...
 

Detailed Description

A Sample represents an instance of the IDL topic-type and contains the data in serialized format.

All FlatData topic-types are instantiations of rti::flat::Sample. This documentation uses the following three example types to illustrate the different ways FlatData IDL types map to C++:

Typedef Documentation

◆ MyFlatFinal

Represents an arbitrary user-defined FlatData final IDL struct.

This documentation uses the following example IDL definition of MyFlatFinal:

@language_binding(FLAT_DATA)
@final
struct MyFlatFinal {
long my_primitive;
FlatFinalBar my_complex; // Another arbitrary final FlatData type
long my_primitive_array[10];
FlatFinalBar my_complex_array[10];
};
The generic definition of FlatData topic-types.
Definition: FlatSample.hpp:148

For this type, rtiddsgen generates:

Note that, as a final FlatData type, MyFlatFinal can only contain fixed-size types, such as primitives, other final FlatData structs, and arrays of fixed-size types.

Samples of MyFlatFinal are created with FooDataWriter::get_loan. After creating a final Sample, modify its values using the MyFlatFinalOffset returned by root().

◆ MyFlatMutable

Represents an arbitrary user-defined flat mutable IDL struct.

This documentation uses the following example IDL definition of MyFlatMutable:

@language_binding(FLAT_DATA)
@mutable
struct MyFlatMutable {
long my_primitive;
@optional long my_optional_primitive;
long my_primitive_array[10];
sequence<long, 10> my_primitive_seq;
MyFlatFinal my_final;
MyFlatFinal my_final_array[10];
sequence<MyFlatFinal, 10> my_final_seq;
FlatMutableBar my_mutable;
FlatMutableBar my_mutable_array[10];
sequence<FlatMutableBar, 10> my_mutable_seq;
string<255> my_string;
sequence<string<255>, 10> my_string_seq;
};

For this type, rtiddsgen generates:

As a mutable FlatData type, MyFlatMutable is not restricted to fixed-size members. Samples of MyFlatMutable are created with rti::flat::build_data(), which returns a MyFlatMutableBuilder. Once built, a mutable Sample can't change in size, but the value of members that already exist can be changed using the MyFlatMutableOffset returned by root().

◆ MyFlatUnion

Represents an arbitrary user-defined flat mutable IDL union.

This documentation uses the following example IDL definition of MyFlatUnion:

@language_binding(FLAT_DATA)
@mutable
union MyFlatUnion switch (long) {
case 0:
long my_primitive;
case 1:
case 2:
MyFlatMutable my_mutable;
case 3:
MyFlatFinal my_final;
};
Note
FlatData unions can only be mutable since unions are, by definition, variable-size types.

For this type, rtiddsgen generates: