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. More...
 
void ProcessBuffer (std::vector< uint8_t > &data, SynMessageList &messages)
 Process a data buffer with the assumption it is a SynFlatBuffers::Buffer message. More...
 
void AddMessage (std::shared_ptr< SynMessage > message)
 Adds a SynMessage to the flatbuffer message buffer. More...
 
void Finish (bool size_prefixed=true)
 Completes the flatbuffer message. More...
 
void Reset ()
 Reset the flatbuffer. More...
 
std::vector< uint8_t > ToMessageBuffer ()
 Creates a vector from the flatbuffer data. More...
 
flatbuffers::FlatBufferBuilder & GetBuilder ()
 Gets the FlatBufferBuilder associated with this manager. More...
 
SynMessageList & GetMessages ()
 Get the SynMessageList that is used to store received messages. More...
 
SynFlatBufferMessageList & GetFlatBufferMessageList ()
 Get the FlatBufferMessageList that is used to store outgoing messages. More...
 
int32_t GetSize ()
 Get the size of the underlying finished buffer. More...
 
uint8_t * GetBufferPointer ()
 Get the buffer pointer from the builder. More...
 

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

◆ ~SynFlatBuffersManager()

chrono::synchrono::SynFlatBuffersManager::~SynFlatBuffersManager ( )
inline

Destructor.

Member Function Documentation

◆ AddMessage()

void chrono::synchrono::SynFlatBuffersManager::AddMessage ( std::shared_ptr< SynMessage message)

Adds a SynMessage to the flatbuffer message buffer.

Will call MessageFromState automatically

Parameters
messagethe SynMessage to add

◆ Finish()

void chrono::synchrono::SynFlatBuffersManager::Finish ( bool  size_prefixed = true)

Completes the flatbuffer message.

Creates a buffer message, of which stores every message If size_prefixed, Completes the flatbuffer message with a 4 bytes in the front of the buffer, which has the size of the byte array

Parameters
size_prefixedwhether the buffer should be finished size prefixed

◆ GetBufferPointer()

uint8_t* chrono::synchrono::SynFlatBuffersManager::GetBufferPointer ( )
inline

Get the buffer pointer from the builder.

Returns
uint8_t* the buffer pointer

◆ GetBuilder()

flatbuffers::FlatBufferBuilder& chrono::synchrono::SynFlatBuffersManager::GetBuilder ( )
inline

Gets the FlatBufferBuilder associated with this manager.

Returns
flatbuffers::FlatBufferBuilder& the underlying builder

◆ GetFlatBufferMessageList()

SynFlatBufferMessageList& chrono::synchrono::SynFlatBuffersManager::GetFlatBufferMessageList ( )
inline

Get the FlatBufferMessageList that is used to store outgoing messages.

Returns
SynFlatBufferMessageList& the flatbuffer message list

◆ GetMessages()

SynMessageList& chrono::synchrono::SynFlatBuffersManager::GetMessages ( )
inline

Get the SynMessageList that is used to store received messages.

Returns
SynMessageList the message list

◆ GetSize()

int32_t chrono::synchrono::SynFlatBuffersManager::GetSize ( )
inline

Get the size of the underlying finished buffer.


Convenience Functions

Returns
int32_t the size of the buffer

◆ ProcessBuffer()

void chrono::synchrono::SynFlatBuffersManager::ProcessBuffer ( std::vector< uint8_t > &  data,
SynMessageList &  messages 
)

Process a data buffer with the assumption it is a SynFlatBuffers::Buffer message.

Parameters
datathe data to process
messagesreference to message list to store the parsed messages

◆ Reset()

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

Reset the flatbuffer.

Must be called, otherwise messages will just continue to be added to the vector

◆ ToMessageBuffer()

std::vector< uint8_t > chrono::synchrono::SynFlatBuffersManager::ToMessageBuffer ( )

Creates a vector from the flatbuffer data.

Returns
std::vector<uint8_t> the message buffer

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