#include <mc_rtc/MessagePackBuilder.h>
Public Member Functions | |
MessagePackBuilder (std::vector< char > &buffer) | |
~MessagePackBuilder () | |
void | start_array (size_t size) |
void | finish_array () |
void | start_map (size_t size) |
void | finish_map () |
void | write_object (const char *data, size_t s) |
size_t | finish () |
Add data to the MessagePack (basic) | |
These overload set allows to write basic data to the MessagePack | |
void | write () |
void | write (bool b) |
void | write (int8_t i) |
void | write (int16_t i) |
void | write (int32_t i) |
void | write (int64_t i) |
void | write (uint8_t i) |
void | write (uint16_t i) |
void | write (uint32_t i) |
void | write (uint64_t i) |
void | write (float f) |
void | write (double d) |
void | write (const std::string &s) |
void | write (const char *s) |
void | write (const char *s, size_t len) |
Add data to the MessagePack (extended) | |
These functions serialize common types used throughout mc_rtc. This does not use MessagePack extension mechanism. Instead, this serializes to simple primitives, if type retrieval is desired, one should implement a specific mechanism. | |
void | write (const Eigen::Vector2d &v) |
void | write (const Eigen::Vector3d &v) |
void | write (const Eigen::Vector4d &v) |
void | write (const Eigen::Vector6d &v) |
void | write (const Eigen::VectorXd &v) |
template<int N, int _Options, int _MaxRows, int _MaxCols> | |
void | write (const Eigen::Matrix< double, N, 1, _Options, _MaxRows, _MaxCols > &v) |
void | write (const Eigen::Quaterniond &q) |
void | write (const Eigen::Matrix3d &m) |
void | write (const sva::PTransformd &pt) |
void | write (const sva::ForceVecd &fv) |
void | write (const sva::MotionVecd &mv) |
void | write (const sva::ImpedanceVecd &mv) |
void | write (const mc_rtc::Configuration &config) |
template<typename T , typename std::enable_if_t< internal::is_integral_v< T >, int > = 0> | |
void | write (const T &number) |
template<typename T , typename = std::enable_if_t<internal::has_write_builder_v<T>>> | |
void | write (const T &value) |
Add data to the MessagePack (containers) | |
These functions support the serialization of standard containers of serializable objects. | |
template<typename T , typename A > | |
void | write (const std::vector< T, A > &v) |
template<typename T , std::size_t N> | |
void | write (const std::array< T, N > &a) |
template<typename T1 , typename T2 > | |
void | write (const std::pair< T1, T2 > &p) |
template<typename KeyT , typename T , typename C , typename A > | |
void | write (const std::map< KeyT, T, C, A > &m) |
template<typename T , typename C , typename A > | |
void | write (const std::set< T, C, A > &s) |
template<typename... Args> | |
void | write (const std::tuple< Args... > &t) |
template<typename... Args> | |
void | write (const std::variant< Args... > &value) |
template<typename Type , int Options, typename StrideType > | |
void | write (const Eigen::Ref< Type, Options, StrideType > &v) |
Helper class to build a MessagePack message
After a message has been built, the builder object must be discarded to create a new message.
mc_rtc::MessagePackBuilder::MessagePackBuilder | ( | std::vector< char > & | buffer | ) |
Constructor
buffer | Buffer used to store the data, it may grow depending on the needs |
mc_rtc::MessagePackBuilder::~MessagePackBuilder | ( | ) |
Destructor
size_t mc_rtc::MessagePackBuilder::finish | ( | ) |
Finish building the message
Afterwards, data cannot be appended to the builder
void mc_rtc::MessagePackBuilder::finish_array | ( | ) |
Finished serializing an array
void mc_rtc::MessagePackBuilder::finish_map | ( | ) |
Finished serializing a map
void mc_rtc::MessagePackBuilder::start_array | ( | size_t | size | ) |
Start serializing an array
size | Size of the array |
void mc_rtc::MessagePackBuilder::start_map | ( | size_t | size | ) |
Start serializing a map
size | Size of the map, the map must then contains 2*size elements |
void mc_rtc::MessagePackBuilder::write | ( | ) |
Write null
void mc_rtc::MessagePackBuilder::write | ( | bool | b | ) |
Write a bool
void mc_rtc::MessagePackBuilder::write | ( | const char * | s | ) |
Write a C-style string
void mc_rtc::MessagePackBuilder::write | ( | const char * | s, |
size_t | len | ||
) |
Write a C-style string with available size
void mc_rtc::MessagePackBuilder::write | ( | const Eigen::Matrix3d & | m | ) |
Write an Eigen::Matrix3d
Serialized as an array of size 9
|
inline |
Write an Eigen::Vector2d
Serialized as an array of size 2
void mc_rtc::MessagePackBuilder::write | ( | const Eigen::Quaterniond & | q | ) |
Write an Eigen::Quaterniond
Serialized as an array of size 4
|
inline |
Write an Eigen::Ref
void mc_rtc::MessagePackBuilder::write | ( | const Eigen::Vector2d & | v | ) |
Write an Eigen::Vector2d
Serialized as an array of size 2
void mc_rtc::MessagePackBuilder::write | ( | const Eigen::Vector3d & | v | ) |
Write an Eigen::Vector3d
Serialized as an array of size 3
void mc_rtc::MessagePackBuilder::write | ( | const Eigen::Vector4d & | v | ) |
Write an Eigen::Vector4d
Serialized as an array of size 4
void mc_rtc::MessagePackBuilder::write | ( | const Eigen::Vector6d & | v | ) |
Write an Eigen::Vector6d
Serialized as an array of size 6
void mc_rtc::MessagePackBuilder::write | ( | const Eigen::VectorXd & | v | ) |
Write an Eigen::VectorXd
Serialized as an array of size X
void mc_rtc::MessagePackBuilder::write | ( | const mc_rtc::Configuration & | config | ) |
Write an mc_rtc::Configuration
Serialized as the JSON data it holds
|
inline |
Write an std::array<T, N>
|
inline |
Write an std::map<KeyT, T, C, A>
|
inline |
Write an std::pair<T1, T2>
|
inline |
Write an std::set<T, C, A>
void mc_rtc::MessagePackBuilder::write | ( | const std::string & | s | ) |
Write an std::string
|
inline |
Write an std::tuple<Args...>
|
inline |
Write an std::variant<Args...>
|
inline |
Write an std::vector<T, A>
void mc_rtc::MessagePackBuilder::write | ( | const sva::ForceVecd & | fv | ) |
Write an sva::ForceVecd
Serialized as an array of size 6 (Torque + Force)
void mc_rtc::MessagePackBuilder::write | ( | const sva::ImpedanceVecd & | mv | ) |
Write an sva::ImpedanceVecd
Serialized as an array of size 6 (Angular + Linear)
void mc_rtc::MessagePackBuilder::write | ( | const sva::MotionVecd & | mv | ) |
Write an sva::MotionVecd
Serialized as an array of size 6 (Angular + Linear)
void mc_rtc::MessagePackBuilder::write | ( | const sva::PTransformd & | pt | ) |
Write an sva::PTransformd
Serialized as an array of size 12 (Matrix3d + Vector3d)
|
inline |
Write numbers by finding their closest standard size match
|
inline |
Write
T | to MessagePack if T implements T::write(MessagePackBuilder &) const |
void mc_rtc::MessagePackBuilder::write | ( | double | d | ) |
Write a double
void mc_rtc::MessagePackBuilder::write | ( | float | f | ) |
Write a float
void mc_rtc::MessagePackBuilder::write | ( | int16_t | i | ) |
Write a int16_t
void mc_rtc::MessagePackBuilder::write | ( | int32_t | i | ) |
Write a int32_t
void mc_rtc::MessagePackBuilder::write | ( | int64_t | i | ) |
Write a int64_t
void mc_rtc::MessagePackBuilder::write | ( | int8_t | i | ) |
Write a int8_t
void mc_rtc::MessagePackBuilder::write | ( | uint16_t | i | ) |
Write a uint16_t
void mc_rtc::MessagePackBuilder::write | ( | uint32_t | i | ) |
Write a uint32_t
void mc_rtc::MessagePackBuilder::write | ( | uint64_t | i | ) |
Write a uint64_t
void mc_rtc::MessagePackBuilder::write | ( | uint8_t | i | ) |
Write a uint8_t
void mc_rtc::MessagePackBuilder::write_object | ( | const char * | data, |
size_t | s | ||
) |
Write an existing object into the object being constructed
data | Data written into the object |
size | Size of the data |