chrono::synchrono::SynFlatBuffersManager Class Reference

Description

Helper class that wraps the flatbuffers::FlatBufferBuilder.

#include <SynFlatBuffersManager.h>

Public Member Functions

 SynFlatBuffersManager (int msg_length=1024)
 Construct a flatbuffers manager with a builder starting length. More...
 
 ~SynFlatBuffersManager ()
 Destructor.
 
void AddMessage (SynMessage *message)
 Adds a SynMessage to the flatbuffer message buffer.
 
void AddMessage (flatbuffers::Offset< SynFlatBuffers::Message > message)
 Adds a SynFlatBuffers Message to the flatbuffer message buffer.
 
void Finish ()
 Completes the flatbuffer message. Creates a buffer message, which stores every message.
 
void FinishSizePrefixed ()
 Completes the flatbuffer message with 4 bytes in the front of the buffer, which has the size of the byte array Creates a buffer message, which stores every message.
 
void Reset ()
 Reset the flatbuffer. More...
 
bool VerifyBuffer (const uint8_t *data)
 
const SynFlatBuffers::Message * Get (int i)
 When a message is received through MPI, the byte array (buffer) is stored in the class variable m_buffer. More...
 
const SynFlatBuffers::Message * GetFromRank (uint32_t rank)
 When a message is received through TCP (interface), the byte array (buffer) is stored in the class variable m_buffer. More...
 
std::vector< uint8_t > & ToMessageBuffer ()
 
int32_t GetSize ()
 Gets the size of the buffer message.
 
uint8_t * GetBufferPointer ()
 Gets the buffer pointer.
 
std::vector< uint8_t > & GetBuffer ()
 Gets the underlying buffer.
 
flatbuffers::FlatBufferBuilder & GetBuilder ()
 Gets the FlatBufferBuilder associated with this manager.
 
std::vector< flatbuffers::Offset< SynFlatBuffers::Message > > & GetMessageVector ()
 Gets the message vector.
 

Constructor & Destructor Documentation

◆ SynFlatBuffersManager()

chrono::synchrono::SynFlatBuffersManager::SynFlatBuffersManager ( int  msg_length = 1024)

Construct a flatbuffers manager with a builder starting length.

Parameters
msg_lengthInitialize size hint for the underlying buffer

Member Function Documentation

◆ Get()

const SynFlatBuffers::Message * chrono::synchrono::SynFlatBuffersManager::Get ( int  i)

When a message is received through MPI, the byte array (buffer) is stored in the class variable m_buffer.

This buffer is then converted to a flatbuffer message. The ith message is then retrieved from this buffer message.

Parameters
iwhich message to retrieve (zero indexed)

◆ GetFromRank()

const SynFlatBuffers::Message * chrono::synchrono::SynFlatBuffersManager::GetFromRank ( uint32_t  rank)

When a message is received through TCP (interface), the byte array (buffer) is stored in the class variable m_buffer.

This buffer is then converted to a flatbuffer message. The message with the same id is then retrieved from this buffer message.

◆ Reset()

void chrono::synchrono::SynFlatBuffersManager::Reset ( void  )

Reset the flatbuffer.

Must be called, otherwise messages will just continue to be added to the vector (memory leak).


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_synchrono/flatbuffer/SynFlatBuffersManager.h
  • /builds/uwsbel/chrono/src/chrono_synchrono/flatbuffer/SynFlatBuffersManager.cpp