Voyant API 0.2.1
|
Base template class for Cap'n Proto wrappers. More...
#include <capnp_wrapper.h>
Public Member Functions | |
virtual | ~CapnpWrapper ()=default |
Virtual destructor for proper cleanup in derived classes. | |
virtual void | fromProto (typename T::Reader reader)=0 |
Update wrapper fields from a Cap'n Proto reader. | |
virtual void | toProto (typename T::Builder &builder) const =0 |
Write wrapper fields to a Cap'n Proto builder. | |
virtual void | debugString (std::ostream &os) const =0 |
Generate a debug string representation. | |
void | fromBuffer (const uint8_t *buffer, size_t size) |
Update wrapper fields from a serialized message buffer. | |
size_t | toBuffer (uint8_t *buffer, size_t buffer_size) const |
Serialize this wrapper to a buffer using Cap'n Proto format. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const CapnpWrapper< T > &wrapper) |
Output operator for streaming any derived wrapper class. | |
Base template class for Cap'n Proto wrappers.
This class provides a consistent interface for wrapping Cap'n Proto generated types with C++ classes that are easier to use and integrate with other code.
T | The Cap'n Proto generated type to wrap |
|
virtualdefault |
Virtual destructor for proper cleanup in derived classes.
|
pure virtual |
Generate a debug string representation.
os | The output stream to write to |
Implemented in DataBlockWrapper, PointGroupHeaderWrapper, PointGroupWrapper, VoyantFrameWrapper, VoyantHeaderWrapper, PointDataWrapper, VoyantSdlConfigWrapper, and VoyantVersionWrapper.
|
inline |
Update wrapper fields from a serialized message buffer.
buffer | Pointer to the buffer containing serialized Cap'n Proto data |
size | Size of the buffer in bytes |
|
pure virtual |
Update wrapper fields from a Cap'n Proto reader.
reader | The Cap'n Proto reader to extract data from |
|
inline |
Serialize this wrapper to a buffer using Cap'n Proto format.
buffer | Pointer to the buffer to write serialized data to |
buffer_size | Size of the buffer in bytes |
std::runtime_error | if the buffer is too small |
|
pure virtual |
Write wrapper fields to a Cap'n Proto builder.
builder | The Cap'n Proto builder to write data to |
|
friend |
Output operator for streaming any derived wrapper class.
os | The output stream to write to |
wrapper | The wrapper object to output |