CatapultServer  v0.5.0.1 (Elephant)
catapult::ionet::PacketPayloadBuilder Class Reference

A packet payload builder for creating payloads composed of heterogeneous data. More...

Collaboration diagram for catapult::ionet::PacketPayloadBuilder:

Public Member Functions

 PacketPayloadBuilder (PacketType type)
 Creates builder for a packet with the specified type. More...
 
 PacketPayloadBuilder (PacketType type, uint32_t maxPacketDataSize)
 Creates builder for a packet with the specified type and max packet data size (maxPacketDataSize). More...
 
template<typename TEntity >
bool appendEntity (const std::shared_ptr< TEntity > &pEntity)
 Appends a single entity (pEntity) to the payload. More...
 
template<typename TEntity >
bool appendEntities (const std::vector< std::shared_ptr< TEntity >> &entities)
 Appends all entities to the payload. More...
 
template<typename TEntityGenerator >
bool appendGeneratedEntities (TEntityGenerator &&generator)
 Appends all entities produced by generator to the payload. More...
 
template<typename TEntity >
bool appendRange (model::EntityRange< TEntity > &&range)
 Appends a fixed size range to the payload. More...
 
template<typename TValue >
bool appendValue (const TValue &value)
 Appends a fixed size value to the payload. More...
 
template<typename TValue >
bool appendValues (const std::vector< TValue > &values)
 Appends fixed size values to the payload. More...
 
template<typename TValueGenerator >
bool appendGeneratedValues (TValueGenerator &&generator)
 
PacketPayload build ()
 Builds the packet payload. More...
 

Private Member Functions

bool increaseSize (uint32_t numBytes)
 

Private Attributes

uint32_t m_maxPacketDataSize
 
PacketPayload m_payload
 
bool m_hasError
 

Detailed Description

A packet payload builder for creating payloads composed of heterogeneous data.

Constructor & Destructor Documentation

◆ PacketPayloadBuilder() [1/2]

catapult::ionet::PacketPayloadBuilder::PacketPayloadBuilder ( PacketType  type)
inlineexplicit

Creates builder for a packet with the specified type.

◆ PacketPayloadBuilder() [2/2]

catapult::ionet::PacketPayloadBuilder::PacketPayloadBuilder ( PacketType  type,
uint32_t  maxPacketDataSize 
)
inlineexplicit

Creates builder for a packet with the specified type and max packet data size (maxPacketDataSize).

Member Function Documentation

◆ appendEntities()

template<typename TEntity >
bool catapult::ionet::PacketPayloadBuilder::appendEntities ( const std::vector< std::shared_ptr< TEntity >> &  entities)
inline

Appends all entities to the payload.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendEntity()

template<typename TEntity >
bool catapult::ionet::PacketPayloadBuilder::appendEntity ( const std::shared_ptr< TEntity > &  pEntity)
inline

Appends a single entity (pEntity) to the payload.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendGeneratedEntities()

template<typename TEntityGenerator >
bool catapult::ionet::PacketPayloadBuilder::appendGeneratedEntities ( TEntityGenerator &&  generator)
inline

Appends all entities produced by generator to the payload.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendGeneratedValues()

template<typename TValueGenerator >
bool catapult::ionet::PacketPayloadBuilder::appendGeneratedValues ( TValueGenerator &&  generator)
inline

Appends all values produced by generator to the payload.

Note
generator is expected to produce pointers to fixed-size data.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendRange()

template<typename TEntity >
bool catapult::ionet::PacketPayloadBuilder::appendRange ( model::EntityRange< TEntity > &&  range)
inline

Appends a fixed size range to the payload.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendValue()

template<typename TValue >
bool catapult::ionet::PacketPayloadBuilder::appendValue ( const TValue &  value)
inline

Appends a fixed size value to the payload.

Here is the call graph for this function:

◆ appendValues()

template<typename TValue >
bool catapult::ionet::PacketPayloadBuilder::appendValues ( const std::vector< TValue > &  values)
inline

Appends fixed size values to the payload.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ build()

PacketPayload catapult::ionet::PacketPayloadBuilder::build ( )
inline

Builds the packet payload.

Here is the caller graph for this function:

◆ increaseSize()

bool catapult::ionet::PacketPayloadBuilder::increaseSize ( uint32_t  numBytes)
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_hasError

bool catapult::ionet::PacketPayloadBuilder::m_hasError
private

◆ m_maxPacketDataSize

uint32_t catapult::ionet::PacketPayloadBuilder::m_maxPacketDataSize
private

◆ m_payload

PacketPayload catapult::ionet::PacketPayloadBuilder::m_payload
private

The documentation for this class was generated from the following file: