Helper class to decode msgpack binary into a vector.
More...
#include <binary_decoder.hpp>
|
| BinaryDecoder (const msgpack::object &obj, const std::string &key="UNNAMED_BINARY") |
| Initialize object given a msgpack object. Reads out binary header to prepare for call of decode.
|
|
| BinaryDecoder (const std::string &str, const std::string &key="UNNAMED_BINARY") |
| Initialize object given a msgpack binary string. Reads out binary header to prepare for call of decode.
|
|
template<typename T> |
void | decode (T &target) const |
| Decode binary msgpack object into the given target.
|
|
template<> |
void | decode (std::vector< float > &output) const |
|
template<> |
void | decode (std::vector< int8_t > &output) const |
|
template<> |
void | decode (std::vector< int16_t > &output) const |
|
template<> |
void | decode (std::vector< int32_t > &output) const |
|
template<> |
void | decode (std::vector< std::string > &output) const |
|
template<> |
void | decode (std::vector< char > &output) const |
|
Helper class to decode msgpack binary into a vector.
◆ BinaryDecoder() [1/2]
mmtf::BinaryDecoder::BinaryDecoder |
( |
const msgpack::object & | obj, |
|
|
const std::string & | key = "UNNAMED_BINARY" ) |
|
inline |
Initialize object given a msgpack object. Reads out binary header to prepare for call of decode.
- Parameters
-
[in] | obj | Object to decode. |
[in] | key | Key used to report errors. |
- Warning
- This uses a pointer to the data of obj. obj must stay alive while this instance exists or it will result in undefined behavior.
- Exceptions
-
◆ BinaryDecoder() [2/2]
mmtf::BinaryDecoder::BinaryDecoder |
( |
const std::string & | str, |
|
|
const std::string & | key = "UNNAMED_BINARY" ) |
|
inline |
Initialize object given a msgpack binary string. Reads out binary header to prepare for call of decode.
- Parameters
-
[in] | str | Object to decode. |
[in] | key | Key used to report errors. |
- Warning
- This uses a pointer to the data of str. str must stay alive while this instance exists or it will result in undefined behavior.
- Exceptions
-
◆ decode() [1/7]
template<>
void mmtf::BinaryDecoder::decode |
( |
std::vector< char > & | output | ) |
const |
|
inline |
◆ decode() [2/7]
template<>
void mmtf::BinaryDecoder::decode |
( |
std::vector< float > & | output | ) |
const |
|
inline |
◆ decode() [3/7]
template<>
void mmtf::BinaryDecoder::decode |
( |
std::vector< int16_t > & | output | ) |
const |
|
inline |
◆ decode() [4/7]
template<>
void mmtf::BinaryDecoder::decode |
( |
std::vector< int32_t > & | output | ) |
const |
|
inline |
◆ decode() [5/7]
template<>
void mmtf::BinaryDecoder::decode |
( |
std::vector< int8_t > & | output | ) |
const |
|
inline |
◆ decode() [6/7]
template<>
void mmtf::BinaryDecoder::decode |
( |
std::vector< std::string > & | output | ) |
const |
|
inline |
◆ decode() [7/7]
template<typename T>
void mmtf::BinaryDecoder::decode |
( |
T & | target | ) |
const |
Decode binary msgpack object into the given target.
- Parameters
-
[out] | target | Store decoded vector into this field. |
- Template Parameters
-
T | Can be one of:
- std::vector<float> (strategies: 1, 9, 10, 11, 12, 13)
- std::vector<int8_t> (strategies: 2, 16)
- std::vector<int16_t> (strategies: 3)
- std::vector<int32_t> (strategies: 4, 7, 8, 14, 15)
- std::vector<std::string> (strategies: 5)
- std::vector<char> (strategies: 6)
|
- Exceptions
-
The documentation for this class was generated from the following file:
- /home/abuild/rpmbuild/BUILD/mmtf-cpp-1.1.0-build/mmtf-cpp-1.1.0/include/mmtf/binary_decoder.hpp