RTI Connext Modern C++ API Version 7.3.0
rti::flat::AbstractBuilder Class Reference

Base class of all Builders. More...

#include <Builder.hpp>

Inheritance diagram for rti::flat::AbstractBuilder:
rti::flat::AbstractListBuilder< detail::DHeaderGenerator > rti::flat::AbstractListBuilder< detail::primitive_sequence_dheader_gen< T >::type > rti::flat::AbstractListBuilder< detail::primitive_sequence_dheader_gen< char >::type > rti::flat::AbstractListBuilder< DHeaderGen > rti::flat::AggregationBuilder rti::flat::AbstractSequenceBuilder< detail::DHeaderGenerator > rti::flat::MutableArrayBuilder< ElementBuilder, N > rti::flat::AbstractSequenceBuilder< detail::primitive_sequence_dheader_gen< T >::type > rti::flat::AbstractSequenceBuilder< detail::primitive_sequence_dheader_gen< char >::type > rti::flat::AbstractSequenceBuilder< DHeaderGen > rti::flat::UnionBuilder< int32_t > MyFlatMutableBuilder rti::flat::UnionBuilder< Discriminator >

Public Member Functions

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...
 

Protected Member Functions

virtual ~AbstractBuilder ()
 If this is a member Builder, it calls finish(). More...
 

Detailed Description

Base class of all Builders.

Constructor & Destructor Documentation

◆ ~AbstractBuilder()

virtual rti::flat::AbstractBuilder::~AbstractBuilder ( )
inlineprotectedvirtual

If this is a member Builder, it calls finish().

If this Builder is building a member (that is, is_nested() is true), and the object goes out of scope before finish() has been called, its destructor calls finish(). Note, however, that it won't report any error.

If this Builder is building a sample (!is_nested()), its destructor doesn't do anything.

Member Function Documentation

◆ discard()

void rti::flat::AbstractBuilder::discard ( )
inline

Discards a member in process of being built.

This function ends the creation of a member, returning the Builder of the type that contains the member to its previous state, as if this member had never been built.

Precondition
This object must be a member Builder, not a sample Builder.

This method is useful when during the building of a member an error occurs and the application wants to roll back, instead of finishing an incomplete member.

◆ is_nested()

bool rti::flat::AbstractBuilder::is_nested ( ) const
inline

Returns whether this is a member Builder.

A member Builder is a Builder that has been created by calling a "build_<member>" function on another Builder (for example, MyFlatMutableBuilder::build_my_mutable()).

Returns
True if this is a member Builder, or false if this is a sample Builder.

◆ is_valid()

bool rti::flat::AbstractBuilder::is_valid ( ) const
inline

Whether this Builder is valid.

A Builder is not valid when it is default-constructed, or after any of these functions is called: finish(), finish_sample(), discard().

◆ capacity()

rti::xcdr::length_t rti::flat::AbstractBuilder::capacity ( ) const
inline

Returns the total capacity in bytes.

The capacity is the total number of bytes this Builder can contain. For a sample Builder (that is, one such that is_nested() returns false), rti::flat::build_data reserves enough bytes to accommodate any sample of a given type.