RTI Connext Traditional C++ API Version 7.2.0

Represents the Offset to an arbitrary user-defined FlatData mutable IDL union. More...

#include <Offset.hpp>

Inheritance diagram for MyFlatUnionOffset:
rti::flat::MutableOffset rti::flat::OffsetBase

Public Types

typedef MyFlatUnionConstOffset ConstOffset
 The equivalent read-only Offset type. More...
 

Public Member Functions

 MyFlatUnionOffset ()
 Creates a null Offset. More...
 
int32_t _d () const
 Retrieves the union discriminator. More...
 
int32_t my_primitive () const
 Retrieves the value for a primitive member. More...
 
MyFlatMutable::ConstOffset my_mutable () const
 Retrieves a const Offset to a complex member. More...
 
MyFlatFinal::ConstOffset my_final () const
 Retrieves a const Offset to a complex member. More...
 
bool my_primitive (int32_t value)
 Sets the value for a primitive member. More...
 
MyFlatMutable::Offset my_mutable ()
 Retrieves a non-const Offset to a complex member. More...
 
MyFlatFinal::Offset my_final ()
 Retrieves a non-const Offset to a complex member. More...
 
- Public Member Functions inherited from rti::flat::OffsetBase
bool is_null () const
 Indicates whether this Offset doesn't point to a valid element. More...
 
bool is_cpp_compatible () const
 Indicates whether rti::flat::plain_cast() is possible. More...
 
const unsigned char * get_buffer () const
 Gets this member's position in the buffer. More...
 
offset_t get_buffer_size () const
 Gets the size, in bytes, of this member in the buffer. More...
 

Detailed Description

Represents the Offset to an arbitrary user-defined FlatData mutable IDL union.

This example type represents the Offset type that rtiddsgen would generate for MyFlatUnion.

It provides accessors for each of its members, plus the discriminator _d(). Accessors can return other Offsets or primitive values.

Given a union, only one member, the one identified by _d(), can exist at a time. The discriminator cannot be modified.

Member Typedef Documentation

◆ ConstOffset

typedef MyFlatUnionConstOffset MyFlatUnionOffset::ConstOffset

The equivalent read-only Offset type.

Constructor & Destructor Documentation

◆ MyFlatUnionOffset()

MyFlatUnionOffset::MyFlatUnionOffset ( )
inline

Creates a null Offset.

Postcondition
is_null()

Member Function Documentation

◆ _d()

int32_t MyFlatUnionOffset::_d ( ) const

Retrieves the union discriminator.

Returns
The union discriminator, which identifies which field this union contains.

In this example:

Any other discriminator value indicates that no member or an unknown member follows.

Note that the discriminator cannot be modified, since that would potentially change the size of this Sample by selecting a different member. The discriminator is selected during the building of a Sample (see MyUnionBuilder).

◆ my_primitive() [1/2]

int32_t MyFlatUnionOffset::my_primitive ( ) const

Retrieves the value for a primitive member.

Returns
The value of my_primitive if this member is selected by _d()
or its default value otherwise.

◆ my_mutable() [1/2]

MyFlatMutable::ConstOffset MyFlatUnionOffset::my_mutable ( ) const

Retrieves a const Offset to a complex member.

Returns
The Offset to the 'my_mutable' member if selected by _d(), or a null Offset otherwise

◆ my_final() [1/2]

MyFlatFinal::ConstOffset MyFlatUnionOffset::my_final ( ) const

Retrieves a const Offset to a complex member.

Returns
The Offset to the 'my_final' member if selected by _d(), or a null Offset otherwise

◆ my_primitive() [2/2]

bool MyFlatUnionOffset::my_primitive ( int32_t  value)

Sets the value for a primitive member.

Precondition
_d() must select 'my_primitive', otherwise this function returns false.
Returns
true if my_primitive was set or false if the operation failed.

◆ my_mutable() [2/2]

MyFlatMutable::Offset MyFlatUnionOffset::my_mutable ( )

Retrieves a non-const Offset to a complex member.

Returns
The Offset to the 'my_mutable' member if selected by _d(), or a null Offset otherwise

◆ my_final() [2/2]

MyFlatFinal::Offset MyFlatUnionOffset::my_final ( )

Retrieves a non-const Offset to a complex member.

Returns
The Offset to the 'my_final' member if selected by _d(), or a null Offset otherwise