RTI Connext Modern C++ API  Version 6.1.0
rti::flat::MutableSequenceBuilder< ElementBuilder > Class Template Reference

Builds a sequence member of variable-size elements. More...

#include <SequenceBuilders.hpp>

Inheritance diagram for rti::flat::MutableSequenceBuilder< ElementBuilder >:
rti::flat::AbstractSequenceBuilder rti::flat::AbstractListBuilder rti::flat::AbstractBuilder

Public Types

typedef SequenceOffset< typename ElementBuilder::Offset > Offset
 The related Offset type. More...

Public Member Functions

ElementBuilder build_next ()
 Begins building the next element. More...
Offset finish ()
 Finishes building the sequence. 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...

Additional Inherited Members

- Protected Member Functions inherited from rti::flat::AbstractListBuilder
unsigned int element_count () const
 Returns the current number of elements that have been added. More...
- Protected Member Functions inherited from rti::flat::AbstractBuilder
virtual ~AbstractBuilder ()
 If this is a member Builder, it calls finish(). More...

Detailed Description

template<typename ElementBuilder>
class rti::flat::MutableSequenceBuilder< ElementBuilder >

Builds a sequence member of variable-size elements.

Template Parameters
ElementBuilderThe Builder type for the elements of the sequence

To build the elements use the ElementBuilder returned by build_next(). An empty sequence can be built by calling finish() without any call to build_next().

This class doesn't enforce the sequence bound set in IDL.

The following example uses a MutableSequenceBuilder to initialize a sequence member of MyFlatMutableBuilder with two elements:

auto seq_builder = builder.build_my_mutable_seq();
auto element_builder = seq_builder.build_next();
// ... build the first element
element_builder = seq_builder.build_next();
// ... build the second element

Member Typedef Documentation

◆ Offset

template<typename ElementBuilder>
typedef SequenceOffset<typename ElementBuilder::Offset> rti::flat::MutableSequenceBuilder< ElementBuilder >::Offset

The related Offset type.

Member Function Documentation

◆ build_next()

template<typename ElementBuilder>
ElementBuilder rti::flat::MutableSequenceBuilder< ElementBuilder >::build_next ( )

Begins building the next element.

Before calling build_next() to create a new element, the application must have called finish() on the previous element Builder.

◆ finish()

template<typename ElementBuilder>
Offset rti::flat::MutableSequenceBuilder< ElementBuilder >::finish ( )

Finishes building the sequence.

An Offset to the member that has been built.
See also