RTI Connext Modern C++ API Version 7.1.0
|
Builds a sequence member of fixed-size elements. More...
#include <SequenceBuilders.hpp>
Public Member Functions | |
ElementOffset | add_next () |
Adds the next element. More... | |
FinalSequenceBuilder & | add_n (unsigned int count) |
Adds a number of elements at once. More... | |
Offset | finish () |
Finishes building the sequence. More... | |
![]() | |
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... | |
Additional Inherited Members | |
![]() | |
unsigned int | element_count () const |
Returns the current number of elements that have been added. More... | |
![]() | |
virtual | ~AbstractBuilder () |
If this is a member Builder, it calls finish(). More... | |
Builds a sequence member of fixed-size elements.
ElementOffset | The Offset type for the elements of the sequence |
To add an element, call add_next() and use the ElementOffset it returns to initialize the element's values. An empty sequence can be built by calling finish() without any call to add_next().
This class doesn't enforce the sequence bound set in IDL.
The following example uses a FinalSequenceBuilder to initialize a sequence member of MyFlatMutableBuilder with two elements:
If the element type meets certain requirements, rti::flat::plain_cast() provides a more efficient way to initialize a sequence of final elements.
|
inline |
Adds the next element.
|
inline |
Adds a number of elements at once.
This is an alternative to add_next().
To initialize the elements, call finish() and use the Offset it returns to access the elements.
|
inline |
Finishes building the sequence.