RTI Connext Traditional C++ API Version 7.2.0

Represents the Builder for an arbitrary user-defined mutable IDL union. More...

#include <Builder.hpp>

Inheritance diagram for MyFlatUnionBuilder:
rti::flat::UnionBuilder< int32_t > rti::flat::AggregationBuilder rti::flat::AbstractBuilder

Public Types

typedef MyFlatUnionOffset Offset
 The related offset type. More...
 

Public Member Functions

 MyFlatUnionBuilder ()
 Creates an invalid Builder. More...
 
Offset finish ()
 Finishes building a member. More...
 
MyFlatUnionfinish_sample ()
 Finishes building a sample. More...
 
bool add_my_primitive (int32_t value)
 Adds a primitive member. More...
 
MyFlatMutableBuilder build_my_mutable (int32_t discriminator=1)
 Builds a mutable-struct member. More...
 
MyFlatFinal::Offset add_my_final ()
 Adds a final-struct member. More...
 
- Public Member Functions inherited from rti::flat::AbstractBuilder
void discard ()
 Discards a member in process of being built. More...
 
bool is_nested () const
 Returns whether this is a member Builder. More...
 
bool is_valid () const
 Whether this Builder is valid. More...
 
rti::xcdr::length_t capacity () const
 Returns the total capacity in bytes. More...
 
bool check_failure ()
 Checks if the previous operation failed and resets the failure flag. More...
 

Additional Inherited Members

- Protected Member Functions inherited from rti::flat::AbstractBuilder
virtual ~AbstractBuilder ()
 If this is a member Builder, it calls finish(). More...
 

Detailed Description

Represents the Builder for an arbitrary user-defined mutable IDL union.

This example type represents the Builder type that rtiddsgen would generate for MyFlatUnion and allows creating a sample or a member of that type.

Union builders are similar to struct builders (see MyFlatMutableBuilder), except that they only allow adding/building one member.

"Add" and "build" functions automatically set the discriminator value that in the IDL definition selects that member. If more than one discriminator value selects a member, the add/build function allows picking one.

Member Typedef Documentation

◆ Offset

The related offset type.

Constructor & Destructor Documentation

◆ MyFlatUnionBuilder()

MyFlatUnionBuilder::MyFlatUnionBuilder ( )
inline

Creates an invalid Builder.

Postcondition
!is_valid()
Note
Top-level builders are created with rti::flat::build_data(), and member builders are created with the corresponding build_<member> function.

Member Function Documentation

◆ finish()

Offset MyFlatUnionBuilder::finish ( )

Finishes building a member.

See also
MyMutableBuilder::finish()

◆ finish_sample()

MyFlatUnion * MyFlatUnionBuilder::finish_sample ( )

Finishes building a sample.

See also
MyMutableBuilder::finish_sample()

◆ add_my_primitive()

bool MyFlatUnionBuilder::add_my_primitive ( int32_t  value)

Adds a primitive member.

This function automatically selects the discriminator 0, which corresponds to the member 'my_primitive' (see MyFlatUnion)

◆ build_my_mutable()

MyFlatMutableBuilder MyFlatUnionBuilder::build_my_mutable ( int32_t  discriminator = 1)

Builds a mutable-struct member.

Parameters
discriminatorAllows selecting one of the possible discriminator values for this member: 1 or 2. This argument is optional: if not specified it selects the first 'case' label in the IDL definition (1).
Returns
The Builder to build this member

◆ add_my_final()

MyFlatFinal::Offset MyFlatUnionBuilder::add_my_final ( )

Adds a final-struct member.

Returns
The Offset to the member, which can be used to set its values.

This function automatically selects the discriminator value 3, which corresponds to the member 'my_final' (see MyFlatUnion).