This section describes how to specify your data types in an IDL file. RTI Code Generator supports all the types listed in the following tables:
In each table, the middle column shows the IDL syntax for a data type in an IDL file. The rightmost column shows the corresponding language mapping created by RTI Code Generator.
IDL Type |
Example Entry in IDL File |
Example Output Generated by |
char (see Note: 1 below) |
struct PrimitiveStruct { char char_member; }; |
typedef struct PrimitiveStruct { |
wchar |
struct PrimitiveStruct { wchar wchar_member; }; |
typedef struct PrimitiveStruct { DDS_Wchar wchar_member; } PrimitiveStruct; |
octet |
struct PrimitiveStruct { octet octet_member; }; |
typedef struct PrimitiveStruct { DDS_Octet octect_member; } PrimitiveStruct; |
short |
struct PrimitiveStruct { short short_member; }; |
typedef struct PrimitiveStruct { DDS_Short short_member; } PrimitiveStruct; |
unsigned short |
struct PrimitiveStruct { unsigned short unsigned_short_member; }; |
typedef struct PrimitiveStruct { DDS_UnsignedShort unsigned_short_member; } PrimitiveStruct; |
long |
struct PrimitiveStruct { long long_member; }; |
typedef struct PrimitiveStruct { DDS_Long long_member; } PrimitiveStruct; |
unsigned long |
struct PrimitiveStruct { unsigned long unsigned_long_member; }; |
typedef struct PrimitiveStruct { DDS_UnsignedLong unsigned_long_member; } PrimitiveStruct; |
long long |
struct PrimitiveStruct { long long long_long_member; }; |
typedef struct PrimitiveStruct { DDS_LongLong long_long_member; } PrimitiveStruct; |
unsigned long long |
struct PrimitiveStruct { unsigned long long unsigned_long_long_member; }; |
typedef struct PrimitiveStruct { DDS_UnsignedLongLong unsigned_long_long_member; } PrimitiveStruct; |
float |
struct PrimitiveStruct { float float_member; }; |
typedef struct PrimitiveStruct { DDS_Float float_member; } PrimitiveStruct; |
double |
struct PrimitiveStruct { double double_member; }; |
typedef struct PrimitiveStruct { DDS_Double double_member; } PrimitiveStruct; |
long double (see Note: 2 below) |
struct PrimitiveStruct { long double long_double_member; }; |
typedef struct PrimitiveStruct { DDS_LongDouble long_double_member; } PrimitiveStruct; |
(see Note: 9 below) |
struct MyStruct { |
typedef struct MyStruct { DDS_Long * member; } MyStruct; |
boolean |
struct PrimitiveStruct { boolean boolean_member; }; |
typedef struct PrimitiveStruct { DDS_Boolean boolean_member; } PrimitiveStruct; |
enum |
enum PrimitiveEnum { |
typedef enum PrimitiveEnum { ENUM1, ENUM2, ENUM3 } PrimitiveEnum; typedef enum PrimitiveEnum { ENUM1 = 10, ENUM2 = 20, ENUM3 = 30 } PrimitiveEnum; |
constant |
const short SIZE = 5; |
#define SIZE 5 |
struct
(see Note: 10 below) |
struct PrimitiveStruct { char char_member; }; |
typedef struct PrimitiveStruct { char char_member; } PrimitiveStruct; |
union
|
union PrimitiveUnion switch (long){ case 1: short short_member; default: long long_member; }; |
typedef struct PrimitiveUnion { DDS_Long _d; struct { DDS_Short short_member; DDS_Long long_member; } _u; } PrimitiveUnion; |
typedef |
typedef short TypedefShort; |
typedef DDS_Short TypedefShort; |
array of above types |
struct OneDArrayStruct { short short_array[2]; }; struct TwoDArrayStruct { short short_array[1][2]; }; |
typedef struct OneDArrayStruct { DDS_Short short_array[2]; } OneDArrayStruct; typedef struct TwoDArrayStruct { DDS_Short short_array[1][2]; } TwoDArrayStruct; |
bounded sequence of above types
|
struct SequenceStruct { sequence<short,4> short_sequence; }; |
typedef struct SequenceStruct { DDSShortSeq short_sequence; } SequenceStruct;
Note: Sequences of primitive types have been predefined by Connext DDS. |
unbounded sequence of above types
|
struct SequenceStruct { sequence<short> short_sequence; }; |
typedef struct SequenceStruct { DDSShortSeq short_sequence; } SequenceStruct;
See Note: 12 below. |
array of sequences |
struct ArraysOfSequences{ sequence<short,4> sequences_array[2]; }; |
typedef struct ArraysOfSequences { DDS_ShortSeq sequences_array[2]; } ArraysOfSequences; |
sequence of arrays
(see Note: 11 below) |
typedef short ShortArray[2]; struct SequenceofArrays { sequence<ShortArray,2> arrays_sequence; }; |
typedef DDS_Short ShortArray[2]; DDS_SEQUENCE_NO_GET(ShortArraySeq,ShortArray); typedef struct SequenceOfArrays { ShortArraySeq arrays_sequence; } SequenceOfArrays; DDS_SEQUENCE_NO_GET is a Connext DDS macro that defines a new sequence type for a user data type. In this case, the user data type is ShortArray. |
sequence of sequences
|
typedef sequence<short,4> ShortSequence; struct SequencesOfSequences{ sequence<ShortSequence,2> sequences_sequence; }; |
typedef DDS_ShortSeq ShortSequence; DDS_SEQUENCE(ShortSequenceSeq, ShortSequence); typedef struct SequencesOfSequences{ ShortSequenceSeq sequences_sequence; } SequencesOfSequences; |
bounded string |
struct PrimitiveStruct { string<20> string_member; }; |
typedef struct PrimitiveStruct { char* string_member; /* maximum length = (20) */ } PrimitiveStruct; |
unbounded string |
struct PrimitiveStruct { string string_member; }; |
typedef struct PrimitiveStruct { char* string_member; /* maximum length = (255) */ } PrimitiveStruct; See Note: 12 below. |
bounded wstring |
struct PrimitiveStruct { wstring<20> wstring_member; }; |
typedef struct PrimitiveStruct { DDS_Wchar * wstring_member; /* maximum length = (20) */ } PrimitiveStruct; |
unbounded wstring |
struct PrimitiveStruct { wstring wstring_member; }; |
typedef struct PrimitiveStruct { DDS_Wchar * wstring_member; /* maximum length = (255) */ } PrimitiveStruct; See Note: 12 below. |
module PackageName { struct Foo { long field; }; }; |
With the -namespace option (only available for C++): namespace PackageName{ typedef struct Foo { DDS_Long field; } Foo; }; Without the -namespace option: typedef struct PackageName_Foo { DDS_Long field; } PackageName_Foo; |
|
valuetype
|
valuetype MyValueType { public MyValueType2 * member; }; valuetype MyValueType { public MyValueType2 member; }; valuetype MyValueType: MyBaseValueType { public MyValueType2 * member; }; |
typedef struct MyValueType { MyValueType2 * member; } MyValueType; typedef struct MyValueType { MyValueType2 member; } MyValueType; typedef struct MyValueType { MyBaseValueType parent; MyValueType2 * member; } MyValueType; |
IDL Type |
Example Entry in IDL File |
Example Output Generated by |
char (see Note: 1 below) |
struct PrimitiveStruct { char char_member; }; |
class PrimitiveStruct |
wchar |
struct PrimitiveStruct { wchar wchar_member; }; |
class PrimitiveStruct { DDS_Wchar wchar_member; } PrimitiveStruct; |
octet |
struct PrimitiveStruct { octet octet_member; }; |
class PrimitiveStruct { DDS_Octet octect_member; } PrimitiveStruct; |
short |
struct PrimitiveStruct { short short_member; }; |
class PrimitiveStruct { DDS_Short short_member; } PrimitiveStruct; |
unsigned short |
struct PrimitiveStruct { unsigned short unsigned_short_member; }; |
class PrimitiveStruct { DDS_UnsignedShort unsigned_short_member; } PrimitiveStruct; |
long |
struct PrimitiveStruct { long long_member; }; |
class PrimitiveStruct { DDS_Long long_member; } PrimitiveStruct; |
unsigned long |
struct PrimitiveStruct { unsigned long unsigned_long_member; }; |
class PrimitiveStruct { DDS_UnsignedLong unsigned_long_member; } PrimitiveStruct; |
long long |
struct PrimitiveStruct { long long long_long_member; }; |
class PrimitiveStruct { DDS_LongLong long_long_member; } PrimitiveStruct; |
unsigned long long |
struct PrimitiveStruct { unsigned long long unsigned_long_long_member; }; |
class PrimitiveStruct { DDS_UnsignedLongLong unsigned_long_long_member; } PrimitiveStruct; |
float |
struct PrimitiveStruct { float float_member; }; |
typedef struct PrimitiveStruct { DDS_Float float_member; } PrimitiveStruct; |
double |
struct PrimitiveStruct { double double_member; }; |
class PrimitiveStruct { DDS_Double double_member; } PrimitiveStruct; |
long double (see Note: 2 below) |
struct PrimitiveStruct { long double long_double_member; }; |
class PrimitiveStruct { DDS_LongDouble long_double_member; } PrimitiveStruct; |
(see Note: 9 below) |
struct MyStruct { |
class MyStruct { DDS_Long * member; } MyStruct; |
boolean |
struct PrimitiveStruct { boolean boolean_member; }; |
class PrimitiveStruct { DDS_Boolean boolean_member; } PrimitiveStruct; |
enum |
enum PrimitiveEnum { |
typedef enum PrimitiveEnum { ENUM1, ENUM2, ENUM3 } PrimitiveEnum; typedef enum PrimitiveEnum { ENUM1 = 10, ENUM2 = 20, ENUM3 = 30 } PrimitiveEnum; |
constant |
const short SIZE = 5; |
static const DDS_Short size = 5; |
struct
(see Note: 10 below) |
struct PrimitiveStruct { char char_member; }; |
typedef struct PrimitiveStruct { char char_member; } PrimitiveStruct; |
union
|
union PrimitiveUnion switch (long){ case 1: short short_member; default: long long_member; }; |
class PrimitiveUnion { DDS_Long _d; class{ DDS_Short short_member; DDS_Long long_member; } _u; } PrimitiveUnion; |
typedef |
typedef short TypedefShort; |
typedef DDS_Short TypedefShort; |
array of above types |
struct OneDArrayStruct { short short_array[2]; }; struct TwoDArrayStruct { short short_array[1][2]; }; |
class OneDArrayStruct { DDS_Short short_array[2]; } OneDArrayStruct; class TwoDArrayStruct { DDS_Short short_array[1][2]; } TwoDArrayStruct; |
bounded sequence of above types
|
struct SequenceStruct { sequence<short,4> short_sequence; }; |
class SequenceStruct { DDSShortSeq short_sequence; } SequenceStruct; Note: Sequences of primitive types have been predefined by Connext DDS. |
unbounded sequence of above types
|
struct SequenceStruct { sequence<short> short_sequence; }; |
typedef struct SequenceStruct { DDSShortSeq short_sequence; } SequenceStruct; See Note: 12 below. |
array of sequences |
struct ArraysOfSequences{ sequence<short,4> sequences_array[2]; }; |
class ArraysOfSequences { DDS_ShortSeq sequences_array[2]; } ArraysOfSequences; |
sequence of arrays
(see Note: 11 below) |
typedef short ShortArray[2]; struct SequenceofArrays { sequence<ShortArray,2> arrays_sequence; }; |
typedef DDS_Short ShortArray[2]; DDS_SEQUENCE_NO_GET(ShortArraySeq, ShortArray); class SequenceOfArrays { ShortArraySeq arrays_sequence; } SequenceOfArrays; DDS_SEQUENCE_NO_GET is a Connext DDS macro that defines a new sequence type for a user data type. In this case, the user data type is ShortArray. |
sequence of sequences
|
typedef sequence<short,4> ShortSequence; struct SequencesOfSequences{ sequence<ShortSequence,2> sequences_sequence; }; |
typedef DDS_ShortSeq ShortSequence; DDS_SEQUENCE(ShortSequenceSeq, ShortSequence); class SequencesOfSequences{ ShortSequenceSeq sequences_sequence; } SequencesOfSequences; |
bounded string |
struct PrimitiveStruct { string<20> string_member; }; |
class PrimitiveStruct { char* string_member; /* maximum length = (20) */ } PrimitiveStruct; |
unbounded string |
struct PrimitiveStruct { string string_member; }; |
class PrimitiveStruct { char* string_member; /* maximum length = (255) */ } PrimitiveStruct; See Note: 12 below. |
bounded wstring |
struct PrimitiveStruct { wstring<20> wstring_member; }; |
class PrimitiveStruct { DDS_Wchar * wstring_member; /* maximum length = (20) */ } PrimitiveStruct; |
unbounded wstring |
struct PrimitiveStruct { wstring wstring_member; }; |
class PrimitiveStruct { DDS_Wchar * wstring_member; /* maximum length = (255) */ } PrimitiveStruct; See Note: 12 below. |
module PackageName { struct Foo { long field; }; }; |
With the -namespace option (only available for C++): namespace PackageName{ typedef struct Foo { DDS_Long field; } Foo; }; Without the -namespace option: class PackageName_Foo { DDS_Long field; } PackageName_Foo; |
|
valuetype
|
valuetype MyValueType { public MyValueType2 * member; }; valuetype MyValueType { public MyValueType2 member; }; valuetype MyValueType: MyBaseValueType { public MyValueType2 * member; }; |
class MyValueType { public: MyValueType2 * member; }; class MyValueType { public: MyValueType2 member; }; class MyValueType : public MyBaseValueType { public: MyValueType2 * member; }; |
IDL Type |
Example Entry in IDL File |
Example Output Generated by |
char (see Note: 1 below) |
struct PrimitiveStruct { char char_member; }; |
public ref class PrimitiveStruct { System::Char char_member; }; |
wchar |
struct PrimitiveStruct { wchar wchar_member; }; |
public ref class PrimitiveStruct { System::Char wchar_member; }; |
octet |
struct PrimitiveStruct { octet octet_member; }; |
public ref class PrimitiveStruct { System::Byte octet_member; }; |
short |
struct PrimitiveStruct { short short_member; }; |
public ref class PrimitiveStruct { System::Int16 short_member; }; |
unsigned short |
struct PrimitiveStruct { unsigned short unsigned_short_member; }; |
public ref class PrimitiveStruct { System::UInt16 unsigned_short_member; }; |
long |
struct PrimitiveStruct { long long_member; }; |
public ref class PrimitiveStruct { System::Int32 long_member; }; |
unsigned long |
struct PrimitiveStruct { unsigned long unsigned_long_member; }; |
public ref class PrimitiveStruct { System::UInt32 unsigned_long_member; }; |
long long |
struct PrimitiveStruct { long long long_ long_member; }; |
public ref class PrimitiveStruct { System::Int64 long_long_member; }; |
unsigned long long |
struct PrimitiveStruct { unsigned long long unsigned_long_long_member; }; |
public ref class PrimitiveStruct { System::UInt64 unsigned_long_long_member; }; |
float |
struct PrimitiveStruct { float float_member; }; |
public ref class PrimitiveStruct { System::Single float_member; }; |
double |
struct PrimitiveStruct { double double_member; }; |
public ref class PrimitiveStruct { System::Double double_member; } PrimitiveStruct; |
long double
(see Note: 2 below) |
struct PrimitiveStruct { long double long_double_member; }; |
public ref class PrimitiveStruct { DDS::LongDouble long_double_member; } PrimitiveStruct; |
boolean |
struct PrimitiveStruct { boolean boolean_member; }; |
public ref class PrimitiveStruct { System::Boolean boolean_member; }; |
enum |
enum PrimitiveEnum { }; enum PrimitiveEnum { |
public enum class PrimitiveEnum : System::Int32 { ENUM1, ENUM2, ENUM3 }; public enum class PrimitiveEnum : System::Int32 { ENUM1 = 10, ENUM2 = 20, ENUM3 = 30 }; |
constant |
const short SIZE = 5; |
public ref class SIZE { public: static System::Int16 VALUE = 5; }; |
struct
(see Note: 10 below) |
struct PrimitiveStruct { char char_member; }; |
public ref class PrimitiveStruct { System::Char char_member; }; |
union
|
union PrimitiveUnion switch (long){ case 1: short short_member; default: long long_member; }; |
public ref class PrimitiveUnion { System::Int32 _d; struct PrimitiveUnion_u { System::Int16 short_member; System::Int32 long_member; } _u; }; |
array of above types |
struct OneDArrayStruct { short short_array[2]; }; |
public ref class OneDArrayStruct { array<System::Int16>^ short_array; /*length == 2*/ }; |
bounded sequence of above types
|
struct SequenceStruct { sequence<short,4> short_sequence; }; |
public ref class SequenceStruct { ShortSeq^ short_sequence; /*max = 4*/ }; Note: Sequences of primitive types |
unbounded sequence of above types
|
struct SequenceStruct { sequence<short> short_sequence; }; |
public ref class SequenceStruct { ShortSeq^ short_sequence; /*max = <default bound>*/ }; See Note: 12 below. |
array of sequences |
struct ArraysOfSequences{ sequence<short,4> sequences_array[2]; }; |
public ref class ArraysOfSequences { array<DDS::ShortSeq^>^ sequences_array; // maximum length = (2) }; |
bounded string |
struct PrimitiveStruct { string<20> string_member; }; |
public ref class PrimitiveStruct { System::String^ string_member; // maximum length = (20) }; |
unbounded string |
struct PrimitiveStruct { string string_member; }; |
public ref class PrimitiveStruct { System::String^ string_member; // maximum length = (255) }; See Note: 12 below. |
bounded wstring |
struct PrimitiveStruct { wstring<20> wstring_member; }; |
public ref class PrimitiveStruct { System::String^ string_member; // maximum length = (20) }; |
unbounded wstring |
struct PrimitiveStruct { wstring wstring_member; }; |
public ref class PrimitiveStruct { System::String^ string_member; // maximum length = (255) }; See Note: 12 below. |
module PackageName { struct Foo { long field; }; }; |
namespace PackageName { public ref class Foo { System::Int32 field; }; }; |
IDL Type |
Example Entry in IDL File |
Example Output Generated by |
char (see Note: 1 below) |
struct PrimitiveStruct { char char_member; }; |
class PrimitiveStruct { public: char char_member() const OMG_NOEXCEPT; void char_member(char value); } |
wchar |
struct PrimitiveStruct { wchar wchar_member; }; |
class PrimitiveStruct { public: DDS_Wchar wchar_member() const OMG_NOEXCEPT; void wchar_member(DDS_Wchar value); }; |
octet |
struct PrimitiveStruct { octet octet_member; }; |
class PrimitiveStruct { public: uint8_t octet_member() const OMG_NOEXCEPT; void octet_member(uint8_t value); }; |
short |
struct PrimitiveStruct { short short_member; }; |
class PrimitiveStruct { public: int16_t short_member() const OMG_NOEXCEPT; void short_member(int16_t value); }; |
unsigned short |
struct PrimitiveStruct { unsigned short unsigned_short_member; }; |
class PrimitiveStruct { public: uint16_t unsigned_short_member() const OMG_NOEXCEPT; void unsigned_short_member(uint16_t value); }; |
long |
struct PrimitiveStruct { long long_member; }; |
class PrimitiveStruct { |
unsigned long |
struct PrimitiveStruct { unsigned long unsigned_long_member; }; |
class PrimitiveStruct { public: uint32_t long_member() const OMG_NOEXCEPT; void unsigned_long_member(uint32_t value); }; |
long long |
struct PrimitiveStruct { long long long_long_member; }; |
class PrimitiveStruct { public: rti::core::int64 long_long_member() const OMG_NOEXCEPT; void long_long_member(rti::core::int64 value); }; |
unsigned long long |
struct PrimitiveStruct { unsigned long long unsigned_long_long_member; }; |
class PrimitiveStruct { public: rti::core::uint64 unsigned_long_long_member); rti::core::uint64 unsigned_long_long_member() const OMG_NOEXCEPT; }; |
float |
struct PrimitiveStruct { float float_member; }; |
class PrimitiveStruct { public: float float_member() const OMG_NOEXCEPT; void float_member(float value); }; |
double |
struct PrimitiveStruct { double double_member; }; |
class PrimitiveStruct { public: double double_member() const OMG_NOEXCEPT; void double_member(double value); }; |
long double (see Note: 2 below) |
struct PrimitiveStruct { long double long_double_member; }; |
class PrimitiveStruct { public: rti::core::LongDouble& long_double_member() OMG_NOEXCEPT; const rti::core::LongDouble& long_double_member() const OMG_NOEXCEPT; void long_double_member(const rti::core::LongDouble& value); } |
(see Note: 9 below) |
struct MyStruct { |
class PrimitiveStruct { int32_t * member() const OMG_NOEXCEPT; void member(int32_t * value); }; |
boolean |
struct PrimitiveStruct { boolean boolean_member; }; |
class PrimitiveStruct { public: bool boolean_member() const OMG_NOEXCEPT; void boolean_member(bool value); }; |
enum |
enum PrimitiveEnum { |
struct PrimitiveEnum_def { enum type { ENUM1, ENUM2, ENUM3 }; }; typedef dds::core::safe_enum<PrimitiveEnum_def> PrimitiveEnum; struct PrimitiveEnum_def { enum type { ENUM1 = 10, ENUM2 = 20, ENUM3 = 30 }; }; typedef dds::core::safe_enum<PrimitiveEnum_def> PrimitiveEnum; |
constant |
const short SIZE = 5; |
static const int16_t SIZE = 5; |
struct
|
struct PrimitiveStruct { char char_member; }; |
class PrimitiveStruct { public: .... char char_member() const OMG_NOEXCEPT; void char_member(char value); } |
union
|
union PrimitiveUnion switch (long){ case 1: short short_member; default: long long_member; }; |
class PrimitiveUnion { public: int32_t _d() const ; void _d(int32_t value); int16_t short_member() const ; void short_member(int16_t value); int32_t long_member() const ; void long_member(int32_t value); static int32_t default_discriminator(); private: int32_t m_d_; struct Union_ { int16_t m_short_member_; int32_t m_long_member_; Union_(); Union_( int16_t short_member, int32_t long_member); }; Union_ m_u_; }; |
typedef |
typedef short TypedefShort; |
typedef int16_t TypedefShort; struct TypedefShort_AliasTag_t {}; |
array of above types |
struct OneDArrayStruct { short short_array[2]; }; struct TwoDArrayStruct { short short_array[1][2]; }; |
class OneDArrayStruct { public: dds::core::array<int16_t, 2>& short_array() OMG_NOEXCEPT; const dds::core::array<int16_t, 2>& short_array() const OMG_NOEXCEPT; void short_array(const dds::core::array<int16_t, 2>& value); }; class TwoDArrayStruct { public: dds::core::array<dds::core::array<int16_t, 2>, 1>& short_array() OMG_NOEXCEPT; const dds::core::array<dds::core::array<int16_t, 2>, 1>& short_array() const OMG_NOEXCEPT; void short_array(const dds::core::array<dds::core::array<int16_t, 2>, 1>& value); }; |
bounded sequence of above types
(see Note: 11 below) |
struct SequenceStruct { sequence<short,4> short_sequence; }; |
class SequenceStruct { public: dds::core::vector<int16_t>& short_sequence() OMG_NOEXCEPT; const dds::core::vector<int16_t>& short_sequence() const OMG_NOEXCEPT; void short_sequence(const dds::core::vector<int16_t>& value); }; |
unbounded sequence of above types
|
struct SequenceStruct { sequence<short> short_sequence; }; |
class SequenceStruct { public: dds::core::vector<int16_t>& short_sequence() OMG_NOEXCEPT; const dds::core::vector<int16_t>& short_sequence() const OMG_NOEXCEPT; void short_sequence(const dds::core::vector<int16_t>& value); }; See Note: 12 below. |
array of sequences |
struct ArraysOfSequences{ sequence<short,4> sequences_array[2]; }; |
class ArraysOfSequences { public: dds::core::array<dds::core::vector<int16_t>, 2>& sequences_array() OMG_NOEXCEPT; const dds::core::array<dds::core::vector<int16_t>, 2>& sequences_array() const OMG_NOEXCEPT; void sequences_array(const dds::core::array<dds::core::vector<int16_t>, 2>& value); }; |
sequence of arrays
|
typedef short ShortArray[2]; struct SequenceofArrays { sequence<ShortArray,2> arrays_sequence; }; |
typedef dds::core::array<int16_t, 2> ShortArray; class SequenceofArrays { public: dds::core::vector<ShortArray>& arrays_sequence() OMG_NOEXCEPT; const dds::core::vector<ShortArray>& arrays_sequence() const OMG_NOEXCEPT; void arrays_sequence(const dds::core::vector<ShortArray>& value); }; |
sequence of sequences
|
typedef sequence<short,4> ShortSequence; struct SequencesOfSequences{ sequence<ShortSequence,2> sequences_sequence; }; |
typedef dds::core::vector<int16_t> ShortSequence; class SequencesOfSequences { public: dds::core::vector<ShortSequence>& sequences_sequence() OMG_NOEXCEPT; const dds::core::vector<ShortSequence>& sequences_sequence() const OMG_NOEXCEPT; void sequences_sequence(const dds::core::vector<ShortSequence>& value); }; |
bounded string |
struct PrimitiveStruct { string<20> string_member; }; |
class PrimitiveStruct { public: dds::core::string& string_member() OMG_NOEXCEPT; const dds::core::string& string_member() const OMG_NOEXCEPT; void string_member(const dds::core::string& value); }; |
unbounded string |
struct PrimitiveStruct { string string_member; }; |
class PrimitiveStruct { public: dds::core::string& string_member() OMG_NOEXCEPT; const dds::core::string& string_member() const OMG_NOEXCEPT; void string_member(const dds::core::string& value); }; See Note: 12 below. |
bounded wstring |
struct PrimitiveStruct { wstring<20> wstring_member; }; |
class PrimitiveStruct { public: dds::core::wstring& wstring_member() OMG_NOEXCEPT; const dds::core::wstring& wstring_member() const OMG_NOEXCEPT; void wstring_member(const dds::core::wstring& value); }; |
unbounded wstring |
struct PrimitiveStruct { wstring wstring_member; }; |
class PrimitiveStruct { public: dds::core::wstring& wstring_member() OMG_NOEXCEPT; const dds::core::wstring& wstring_member() const OMG_NOEXCEPT; void wstring_member(const dds::core::wstring& value); }; See Note: 12 below. |
module PackageName { struct Foo { long field; }; }; |
namespace PackageName { class Foo { public: int32_t field() const OMG_NOEXCEPT; void field(int32_t value); }; }; |
|
valuetype
|
valuetype MyBaseValueType { public long member; }; valuetype MyValueType: MyBaseValueType { public short * member2; }; |
class MyBaseValueType { public: int32_t member() const OMG_NOEXCEPT; void member(int32_t value); }; class MyValueType : public MyBaseValueType { public: int16_t * member2() const OMG_NOEXCEPT; void member2(int16_t * value); }; |
IDL Type |
Example Entry in IDL file |
Example Java Output Generated by |
char
(see Note: 5 below) |
struct PrimitiveStruct { char char_member; }; |
public class PrimitiveStruct { public char char_member; ... } |
wchar
(see Note: 5 below) |
struct PrimitiveStruct { wchar wchar_member; }; |
public class PrimitiveStruct { public char wchar_member; ... } |
octet |
struct PrimitiveStruct { octet octet_member; }; |
public class PrimitiveStruct { public byte byte_member; ... } |
short |
struct PrimitiveStruct { short short_member; }; |
public class PrimitiveStruct { public short short_member; ... } |
unsigned short
(see Note: 6 below) |
struct PrimitiveStruct { unsigned short unsigned_short_member; }; |
public class PrimitiveStruct { public short unsigned_short_member; ... } |
long |
struct PrimitiveStruct { long long_member; }; |
public class PrimitiveStruct { public int long_member; ... } |
unsigned long
(see Note: 6 below) |
struct PrimitiveStruct { unsigned long unsigned_long_member; }; |
public class PrimitiveStruct { public int unsigned_long_member; ... } |
long long |
struct PrimitiveStruct { long long long_long_member; }; |
public class PrimitiveStruct { public long long_long_member; ... } |
unsigned long long
(see Note: 7 below) |
struct PrimitiveStruct { unsigned long long unsigned_long_long_member; }; |
public class PrimitiveStruct { public long unsigned_long_long_member; ... } |
float |
struct PrimitiveStruct { float float_member; }; |
public class PrimitiveStruct { public float float_member; ... } |
double |
struct PrimitiveStruct { double double_member; }; |
public class PrimitiveStruct { public double double_member; ... } |
long double
(see Note: 7 below) |
struct PrimitiveStruct { long double long_double_member; }; |
public class PrimitiveStruct { public double long_double_member; ... } |
(see Note: 9 below) |
struct MyStruct { long * member; }; |
public class MyStruct { public int member; ... }; |
boolean |
struct PrimitiveStruct { boolean boolean_member; }; |
public class PrimitiveStruct { public boolean boolean_member; ... } |
enum |
enum PrimitiveEnum { ENUM1, ENUM2, ENUM3 }; |
public class PrimitiveEnum extends Enum { public static PrimitiveEnum ENUM1 = new PrimitiveEnum ("ENUM1", 0); public static PrimitiveEnum ENUM2 = new PrimitiveEnum ("ENUM2", 1); public static PrimitiveEnum ENUM3 = new PrimitiveEnum ("ENUM3", 2); public static PrimitiveEnum valueOf(int ordinal); ... } |
enum PrimitiveEnum { ENUM1 = 10, ENUM2 = 20, ENUM3 = 30 }; |
public class PrimitiveEnum extends Enum { public static PrimitiveEnum ENUM1 = new PrimitiveEnum ("ENUM1", 10); public static PrimitiveEnum ENUM2 = new PrimitiveEnum ("ENUM2", 10); public static PrimitiveEnum ENUM3 = new PrimitiveEnum ("ENUM3", 20); public static PrimitiveEnum valueOf(int ordinal); ... } |
|
constant |
const short SIZE = 5; |
public class SIZE { public static final short VALUE = 5; } |
struct
(see Note: 10 below) |
struct PrimitiveStruct { char char_member; }; |
public class PrimitiveStruct { public char char_member; } |
union
(see Note: 10 below) |
union PrimitiveUnion switch (long){ case 1: short short_member; default: long long_member; }; |
public class PrimitiveUnion { public int _d; public short short_member; public int long_member; ... } |
typedef of primitives, enums, strings
(see Note: 8 below) |
typedef short ShortType; struct PrimitiveStruct { ShortType short_member; }; |
/* typedefs are unwounded to the original type when used */ public class PrimitiveStruct { public short short_member; ... } |
typedef of sequences or arrays
(see Note: 8 below) |
typedef short ShortArray[2]; |
/* Wrapper class */ public class ShortArray { public short[] userData = new short[2]; ... } |
array |
struct OneDArrayStruct { short short_array[2]; }; |
public class OneDArrayStruct { public short[] short_array = new short[2]; ... } |
struct TwoDArrayStruct { short short_array[1][2]; }; |
public class TwoDArrayStruct { public short[][] short_array = new short[1][2]; ... } |
|
bounded sequence
|
struct SequenceStruct { sequence<short,4> short_sequence; }; |
public class SequenceStruct { public ShortSeq short_sequence = new ShortSeq((4)); ... } Note: Sequences of primitive types have been predefined by Connext DDS. |
unbounded sequence
|
struct SequenceStruct { sequence<short> short_sequence; }; |
public class SequenceStruct { public ShortSeq short_sequence = new ShortSeq((100)); ... } See Note: 12 below. |
array of sequences |
struct ArraysOfSequences{ sequence<short,4> sequences_array[2]; }; |
public class ArraysOfSequences { public ShortSeq[] sequences_array = new ShortSeq[2]; ... } |
sequence of arrays
(see Note: 11 below) |
typedef short ShortArray[2]; struct SequenceOfArrays{ sequence<ShortArray,2> arrays_sequence; }; |
/* Wrapper class */ public class ShortArray { public short[] userData = new short[2]; ... } /* Sequence of wrapper class objects */ public final class ShortArraySeq extends ArraySequence { ... } public class SequenceOfArrays { public ShortArraySeq arrays_sequence = new ShortArraySeq((2)); ... } |
sequence of sequences
|
typedef sequence<short,4> ShortSequence; struct SequencesOfSequences{ sequence<ShortSequence,2> sequences_sequence; }; |
/* Wrapper class */ public class ShortSequence { public ShortSeq userData = new ShortSeq((4)); ... } /* Sequence of wrapper class objects */ public final class ShortSequenceSeq extends ArraySequence { ... } public class SequencesOfSequences { public ShortSequenceSeq sequences_sequence = new ShortSequenceSeq((2)); ... } |
bounded string |
struct PrimitiveStruct { string<20> string_member; }; |
public class PrimitiveStruct { public String string_member = new String(); /* maximum length = (20) */ ... } |
unbounded string |
struct PrimitiveStruct { string string_member; }; |
public class PrimitiveStruct { public String string_member = new String(); * maximum length = (255) */ ... } See Note: 12 below. |
bounded wstring |
struct PrimitiveStruct { wstring<20> wstring_member; }; |
public class PrimitiveStruct { public String wstring_member = new String(); /* maximum length = (20) */ ... } |
unbounded wstring |
struct PrimitiveStruct { wstring wstring_member; }; |
public class PrimitiveStruct { public String wstring_member = new String(); /* maximum length = (255) */ ... } See Note: 12 below. |
module PackageName { struct Foo { long field; }; }; |
package PackageName; public class Foo { public int field; ... } |
|
valuetype
|
valuetype MyValueType { public MyValueType2 * member; }; valuetype MyValueType { public MyValueType2 member; }; valuetype MyValueType: MyBaseValueType { public MyValueType2 * member; }; |
public class MyValueType { public MyValueType2 member; ... }; public class MyValueType { public MyValueType2 member; ... }; public class MyValueType extends MyBaseValueType { public MyValueType2 member; ... } |
IDL Type |
Example Entry in IDL File |
Example Output Generated by |
char (see Note: 13 below) |
struct PrimitiveStruct { char char_member; }; |
type PrimitiveStruct is record char_member : aliased Standard.DDS.Char; end record; |
wchar |
struct PrimitiveStruct { wchar wchar_member; }; |
type PrimitiveStruct is record wchar_member : aliased Standard.DDS.Wchar; end record; |
octet |
struct PrimitiveStruct { octet octet_member; }; |
type PrimitiveStruct is record octet_member: aliased Standard.DDS.Octet; end record; |
short |
struct PrimitiveStruct { short short_member; }; |
type PrimitiveStruct is record short_member: aliased Standard.DDS.Short; end record; |
unsigned short |
struct PrimitiveStruct { unsigned short unsigned_short_member; }; |
type PrimitiveStruct is record unsigned_short_member: aliased Standard.DDS.Unsigned_Short; end record; |
long |
struct PrimitiveStruct { long long_member; }; |
type PrimitiveStruct is record long_member: aliased Standard.DDS.Long; end record; |
unsigned long |
struct PrimitiveStruct { unsigned long unsigned_long_member; }; |
type PrimitiveStruct is record unsigned_long_member: aliased Standard.DDS.Unsigned_Long; end record; |
long long |
struct PrimitiveStruct { long long long_long_member; }; |
type PrimitiveStruct is record long_long_member: aliased Standard.DDS.Long_Long; end record; |
unsigned long long |
struct PrimitiveStruct { unsigned long long unsigned_long_long_member; }; |
type PrimitiveStruct is record unsigned_long_long_member: aliased Standard.DDS.Unsigned_Long_Long; end record; |
float |
struct PrimitiveStruct { float float_member; }; |
type PrimitiveStruct is record float_member: aliased Standard.DDS.Float; end record; |
double |
struct PrimitiveStruct { double double_member; }; |
type PrimitiveStruct is record double_member: aliased Standard.DDS.Double; end record; |
long double (see Note: 2 below) |
struct PrimitiveStruct { long double long_double_member; }; |
type PrimitiveStruct is record long_double_member: aliased Standard.DDS.Long_Double; end record; |
(see Note: 9 below) |
struct MyStruct { |
type MyStruct is record member : access Standard.DDS.Long; end record; |
boolean |
struct PrimitiveStruct { boolean boolean_member; }; |
type PrimitiveStruct is record boolean_member: aliased Standard.DDS.Boolean; end record; |
enum |
enum PrimitiveEnum { |
type PrimitiveEnum is (ENUM1, ENUM2, ENUM3 ); type PrimitiveEnum is (ENUM1, ENUM2, ENUM3 ); ... for PrimitiveEnum use ( ENUM1 => 10 , ENUM2 => 20 , ENUM3 => 30 ); |
constant |
const short SIZE = 5; |
SIZE : constant Standard.DDS.Short := 5; |
struct
(see Note: 10 below) |
struct PrimitiveStruct { char char_member; }; |
type PrimitiveStruct is record char_member : aliased Standard.DDS.Char; end record; |
union
|
union PrimitiveUnion switch (long){ case 1: short short_member; default: long long_member; }; |
type U_PrimitiveUnion is record short_member : aliased Standard.DDS.Short; long_member : aliased Standard.DDS.Long; end record; type PrimitiveUnion is record d : Standard.DDS.Long; u : U_PrimitiveUnion; end record; |
typedef |
typedef short TypedefShort; |
type TypedefShort is new Standard.DDS.Short; |
array of above types |
struct OneDArrayStruct { short short_array[2]; }; struct TwoDArrayStruct { short short_array[1][2]; }; |
type OneDArrayStruct is record short_array : aliased Standard.DDS.Short_Array(1..2); end record; type TwoDArrayStruct_short_array_Array is array (1..1, 1..2) of aliased Standard.DDS.Short; type TwoDArrayStruct is record short_array : aliased TwoDArrayStruct_short_array_Array; end record; |
bounded sequence of above types
|
struct SequenceStruct { sequence<short,4> short_sequence; }; |
type SequenceStruct is record short_sequence : aliased Standard.DDS.Short_Seq.Sequence; end record; |
unbounded sequence of above types
|
struct SequenceStruct { sequence<short> short_sequence; }; |
type SequenceStruct is record short_sequence : aliased Standard.DDS.Short_Seq.Sequence; end record; See Note: 13 below. |
array of sequences |
struct ArraysOfSequences{ sequence<short,4> sequences_array[2]; }; |
type ArraysOfSequences_sequences_array_Array is array (1..2) of aliased Standard.DDS.Short_Seq.Sequence; type ArraysOfSequences is record sequences_array : aliased ArraysOfSequences_sequences_array_Array; end record; |
sequence of arrays
(see Note: 11 below) |
typedef short ShortArray[2]; struct SequenceofArrays { sequence<ShortArray,2> arrays_sequence; }; |
type ShortArray is array (1..2) of Standard.DDS.Short; ... type SequenceofArrays is record arrays_sequence : aliased ADA_IDL_File.ShortArray_Seq.Sequence; end record; Note: ADA_IDL_File.ShortArray_Seq.Sequence is an instantiation of Standard.DDS.Sequences_Generic for the user's data type |
sequence of sequences
|
typedef sequence<short,4> ShortSequence; struct SequencesOfSequences{ sequence<ShortSequence,2> sequences_sequence; }; |
type ShortSequence is new Standard.DDS.Short_Seq.Sequence; ... type SequencesOfSequences is record sequences_sequence : aliased ADA_IDL_File.ShortSequence_Seq.Sequence; end record; Note: ADA_IDL_File.ShortSequence_Seq.Sequence is an instantiation of Standard.DDS.Sequences_Generic for the user's data type |
bounded string |
struct PrimitiveStruct { string<20> string_member; }; |
type PrimitiveStruct is record string_member : aliased Standard.DDS.String; -- maximum length = (20) end record; |
unbounded string |
struct PrimitiveStruct { string string_member; }; |
type PrimitiveStruct is record string_member : aliased Standard.DDS.String; -- maximum length = (255) end record; |
bounded wstring |
struct PrimitiveStruct { wstring<20> wstring_member; }; |
type PrimitiveStruct is record wstring_member : aliased Standard.DDS.Wide_String; -- maximum length = (20) end record; |
unbounded wstring |
struct PrimitiveStruct { wstring wstring_member; }; |
type PrimitiveStruct is record wstring_member : aliased Standard.DDS.Wide_String; -- maximum length = (255) end record; |
module PackageName { struct Foo { long field; }; }; |
package PackageName is type Foo is record field : aliased Standard.DDS.Long; end record; end PackageName; |
|
valuetype
|
valuetype MyBaseValueType { valuetype MyBaseValueType { public long member; }; valuetype MyValueType: MyBaseValueType { public short * member2; }; |
type MyBaseValueType is record member : aliased Standard.DDS.Long; end record; type MyValueType is record parent : ADA_IDL_File.MyBaseValueType; member2 : access Standard.DDS.Short; end record; |
Note: 1: In C and C++, primitive types are not represented as native language types (e.g. long, char, etc.) but as custom types in the DDS namespace (DDS_Long, DDS_Char, etc.). These typedefs are used to ensure that a field’s size is the same across platforms.
Note: 2: Some platforms do not support long double or have different sizes for that type than defined by IDL (16 bytes). On such platforms, DDS_LongDouble (as well as the unsigned version) is mapped to a character array that matches the expected size of that type by default. If you are using a platform whose native mapping has exactly the expected size, you can instruct Connext DDS to use the native type instead. That is, if sizeof(long double) == 16, you can tell Connext DDS to map DDS_LongDouble to long double by defining the following macro either in code or on the compile line:
-DRTI_CDR_SIZEOF_LONG_DOUBLE=16
Note: 3: Unions in IDL are mapped to structs in C, C++ and records in ADA, so that Connext DDS will not have to dynamically allocate memory for unions containing variable-length fields such as strings or sequences. To be efficient, the entire struct (or class in C++/CLI) is not sent when the union is published. Instead, Connext DDS uses the discriminator field of the struct to decide what field in the struct is actually sent on the wire.
Note: 4: So-called "anonymous sequences" —sequences of sequences in which the sequence element has no type name of its own—are not supported. Such sequences are deprecated in CORBA and may be removed from future versions of IDL. For example, this is not supported:
sequence<sequence<short,4>,4> MySequence;
Sequences of typedef’ed types, where the typedef is really a sequence, are supported. For example, this is supported:
typedef sequence<short,4> MyShortSequence; sequence<MyShortSequence,4> MySequence;
Note: 5: IDL wchar and char are mapped to Java char, 16-bit unsigned quantities representing Unicode characters as specified in the standard OMG IDL to Java mapping. In C++/CLI, char and wchar are mapped to System::Char.
Note: 6: The unsigned version for integer types is mapped to its signed version as specified in the standard OMG IDL to Java mapping.
Note: 7: There is no current support in Java for the IDL long double type. This type is mapped to double as specified in the standard OMG IDL to Java mapping.
Note: 8: Java does not have a typedef construct, nor does C++/CLI. Typedefs for types that are neither arrays nor sequences (struct, unions, strings, wstrings, primitive types and enums) are "unwound" to their original type until a simple IDL type or user-defined IDL type (of the non-typedef variety) is encountered. For typedefs of sequences or arrays, RTI Code Generator will generate wrapper classes if -corba is not used; no wrapper classes are generated if -corba is used.
Note: 9: In C, C++ and ADA, all the members in a value type, structure or union that are declared with the pointer symbol (‘*’) will be mapped to references (pointers). In C++/CLI and Java, the pointer symbol is ignored because the members are always mapped as references.
Note: 10: In-line nested types are not supported inside structures, unions or valuetypes. For example, this is not supported:
struct Outer { short outer_short; struct Inner { char inner_char; short inner_short; } outer_nested_inner; };
Note: 11: The sequence <Type>Seq is implicitly declared in the IDL file and therefore it cannot be declared explicitly by the user. For example, this is not supported:
typedef sequence<Foo> FooSeq; //error
Note: 12: RTI Code Generator will supply a default bound for sequences and strings. You can specify that bound with the -sequenceSize or -stringSize command-line option, respectively. See the RTI Code Generator User’s Manual.
Note: 13: In ADA, primitive types are not represented as native language types (e.g. , Character, etc.) but as custom types in the DDS namespace (Standard.DDS.Long, Standard.DDS.Char, etc.). These typedefs are used to ensure that a field’s size is the same across platforms.
Note: 14: Every type provides a default constructor, a copy constructor, a move constructor (C++11), a constructor with parameters to set all the type's members, a destructor, a copy-assignment operator, and a move-assignment operator (C++11). Types also include equality operators, the operator << and a namespace-level swap function.
PrimitiveStruct(); explicit PrimitiveStruct(char char_member); PrimitiveStruct(PrimitiveStruct&& other_) OMG_NOEXCEPT; PrimitiveStruct& operator=(PrimitiveStruct&& other_) OMG_NOEXCEPT; bool operator == (const PrimitiveStruct& other_) const; bool operator != (const PrimitiveStruct& other_) const; void swap(PrimitiveStruct& other_) OMG_NOEXCEPT ; std::ostream& operator << (std::ostream& o,const PrimitiveStruct& sample);
Note: 15: Sequences of pointers are not supported. For example, this is NOT supported:
sequence<long*, 100>;
Sequences of typedef'ed types, where the typedef is really a pointer, are supported. For example, this is supported:
typedef long* pointerToLong; sequence<pointerToLong, 100>;
© 2016 RTI