MMTF-C++
The C++ language MMTF libraries
|
Go to the documentation of this file.
13 #ifndef MMTF_DECODER_H
14 #define MMTF_DECODER_H
18 #include "msgpack_decoder.hpp"
20 #include <msgpack.hpp>
46 template <
typename Stream>
55 inline void decodeFromFile(StructureData& data,
const std::string& filename);
64 msgpack::unpacked upd;
65 msgpack::unpack(upd, buffer, size);
66 msgpack::object obj(upd.get());
70 template <
typename Stream>
73 std::stringstream buffer;
74 buffer << stream.rdbuf();
80 std::ifstream ifs(filename.c_str(), std::ifstream::in | std::ios::binary);
82 throw DecodeError(
"Could not open file: " + filename);
Top level MMTF data container.
Definition: structure_data.hpp:151
void decodeFromStream(StructureData &data, Stream &stream)
Decode an MMTF data structure from a stream.
Definition: decoder.hpp:71
Exception thrown when failing during decoding.
Definition: errors.hpp:23
void decodeFromFile(StructureData &data, const std::string &filename)
Decode an MMTF data structure from an existing file.
Definition: decoder.hpp:78
void decodeFromBuffer(StructureData &data, const char *buffer, size_t size)
Decode an MMTF data structure from a byte buffer.
Definition: decoder.hpp:61
Definition: binary_decoder.hpp:24