MMTF-C++
The C++ language MMTF libraries
mmtf::BinaryDecoder Class Reference

Helper class to decode msgpack binary into a vector. More...

#include <binary_decoder.hpp>

Public Member Functions

 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. More...
 
template<typename T >
void decode (T &target)
 Decode binary msgpack object into the given target. More...
 
template<>
void decode (std::vector< float > &output)
 
template<>
void decode (std::vector< int8_t > &output)
 
template<>
void decode (std::vector< int16_t > &output)
 
template<>
void decode (std::vector< int32_t > &output)
 
template<>
void decode (std::vector< std::string > &output)
 
template<>
void decode (std::vector< char > &output)
 

Detailed Description

Helper class to decode msgpack binary into a vector.

Constructor & Destructor Documentation

◆ BinaryDecoder()

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]objObject to decode.
[in]keyKey used to report errors.
Exceptions
mmtf::DecodeErrorif obj is not a binary or is too short.

Member Function Documentation

◆ decode() [1/7]

template<>
void mmtf::BinaryDecoder::decode ( std::vector< char > &  output)
inline

◆ decode() [2/7]

template<>
void mmtf::BinaryDecoder::decode ( std::vector< float > &  output)
inline

◆ decode() [3/7]

template<>
void mmtf::BinaryDecoder::decode ( std::vector< int16_t > &  output)
inline

◆ decode() [4/7]

template<>
void mmtf::BinaryDecoder::decode ( std::vector< int32_t > &  output)
inline

◆ decode() [5/7]

template<>
void mmtf::BinaryDecoder::decode ( std::vector< int8_t > &  output)
inline

◆ decode() [6/7]

template<>
void mmtf::BinaryDecoder::decode ( std::vector< std::string > &  output)
inline

◆ decode() [7/7]

template<typename T >
void mmtf::BinaryDecoder::decode ( T &  target)

Decode binary msgpack object into the given target.

Parameters
[out]targetStore decoded vector into this field.
Template Parameters
TCan be one of:
  • std::vector<float> (strategies: 1, 9, 10, 11, 12, 13)
  • std::vector<int8_t> (strategies: 2)
  • 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
mmtf::DecodeErrorif we fail to decode.

The documentation for this class was generated from the following file: