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

Base class of all Builders. More...

#include <Builder.hpp>

Inheritance diagram for rti::flat::AbstractBuilder:
rti::flat::AbstractListBuilder rti::flat::AggregationBuilder rti::flat::AbstractSequenceBuilder rti::flat::MutableArrayBuilder< ElementBuilder, N > MyFlatMutableBuilder rti::flat::UnionBuilder< Discriminator > rti::flat::UnionBuilder< int32_t > rti::flat::PrimitiveSequenceBuilder< char > rti::flat::FinalSequenceBuilder< ElementOffset > rti::flat::MutableSequenceBuilder< ElementBuilder > rti::flat::PrimitiveSequenceBuilder< T > MyFlatUnionBuilder rti::flat::StringBuilder

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 ( )

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 ( )

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.

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

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

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

◆ is_valid()

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

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

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.