18#include "msgpack_decoders.hpp"
57template <
typename Stream>
85template <
typename Stream>
96 const std::string& filename);
103 mmtf::impl::decodeFromMapDecoder(data, md);
113template <
typename Stream>
131template <
typename Stream>
135 stream.seekg(0, std::ios::end);
136 buffer.resize(stream.tellg());
137 stream.seekg(0, std::ios::beg);
138 if (!buffer.empty()) stream.read(&buffer[0], buffer.size());
143 const std::string& filename) {
145 std::ifstream ifs(filename.c_str(), std::ifstream::in | std::ios::binary);
146 if (!ifs.is_open()) {
147 throw DecodeError(
"Could not open file: " + filename);
Exception thrown when failing during decoding.
Definition errors.hpp:23
Helper class to decode msgpack maps into object fields. Class cannot be copied as it contains unique ...
Definition map_decoder.hpp:31
void initFromBuffer(const char *buffer, size_t size)
Initialize from byte buffer of given size. Unpacks data and then same effect as MapDecoder::initFromO...
Definition map_decoder.hpp:165
Definition binary_decoder.hpp:25
void decodeFromBuffer(StructureData &data, const char *buffer, size_t size)
Decode an MMTF data structure from a byte buffer.
Definition decoder.hpp:106
void mapDecoderFromBuffer(MapDecoder &mapDecoder, const char *buffer, std::size_t size)
Get a mapDecoder for un-decoded MMTF data.
Definition decoder.hpp:126
void decodeFromFile(StructureData &data, const std::string &filename)
Decode an MMTF data structure from an existing file.
Definition decoder.hpp:120
void mapDecoderFromStream(MapDecoder &mapDecoder, Stream &stream)
Get a mapDecoder into an un-decoded MMTF data.
Definition decoder.hpp:132
void mapDecoderFromFile(MapDecoder &mapDecoder, const std::string &filename)
Get a mapDecoder into an un-decoded MMTF data.
Definition decoder.hpp:142
void decodeFromStream(StructureData &data, Stream &stream)
Decode an MMTF data structure from a stream.
Definition decoder.hpp:114
void decodeFromMapDecoder(StructureData &data, MapDecoder &mapDecoder)
Decode an MMTF data structure from a mapDecoder.
Definition decoder.hpp:102
Top level MMTF data container.
Definition structure_data.hpp:157