RTI Connext Modern C++ API  Version 6.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rti::flat::FinalSequenceBuilder< ElementOffset > Class Template Reference

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

#include <SequenceBuilders.hpp>

Inheritance diagram for rti::flat::FinalSequenceBuilder< ElementOffset >:
rti::flat::AbstractSequenceBuilder rti::flat::AbstractListBuilder rti::flat::AbstractBuilder

Public Member Functions

ElementOffset add_next ()
 Adds the next element.
FinalSequenceBuilderadd_n (unsigned int count)
 Adds a number of elements at once.
Offset finish ()
 Finishes building the sequence.

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.

Detailed Description

template<typename ElementOffset>
class rti::flat::FinalSequenceBuilder< ElementOffset >

Builds a sequence member of fixed-size elements.

Template Parameters
ElementOffsetThe 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:

auto seq_builder = builder.build_my_final_seq();
MyFlatFinalOffset element = seq_builder.add_next();
// ... continue initializing the first element
element = seq_builder.add_next();
// ... continue initializing the second element

If the element type meets certain requirements, rti::flat::plain_cast() provides a more efficient way to initialize a sequence of final elements.

Member Function Documentation

template<typename ElementOffset>
ElementOffset rti::flat::FinalSequenceBuilder< ElementOffset >::add_next ( )

Adds the next element.

The Offset that can be used to set the element values
template<typename ElementOffset>
FinalSequenceBuilder& rti::flat::FinalSequenceBuilder< ElementOffset >::add_n ( unsigned int  count)

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.

template<typename ElementOffset>
Offset rti::flat::FinalSequenceBuilder< ElementOffset >::finish ( )

Finishes building the sequence.

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

RTI Connext Modern C++ API Version 6.0.1 Copyright © Sat Nov 23 2019 Real-Time Innovations, Inc