Class to encode and decode data encoded with MSNumpress. More...
#include <OpenMS/FORMAT/MSNumpressCoder.h>
Classes | |
| struct | NumpressConfig |
| Configuration class for MSNumpress. More... | |
Public Types | |
| enum | NumpressCompression { NONE, LINEAR, PIC, SLOF, SIZE_OF_NUMPRESSCOMPRESSION } |
Public Member Functions | |
| MSNumpressCoder () | |
| default constructor More... | |
| virtual | ~MSNumpressCoder () |
| Destructor. More... | |
| void | encodeNP (const std::vector< double > &in, String &result, bool zlib_compression, const NumpressConfig &config) |
| Encodes a vector of floating point numbers into a Base64 string using numpress. More... | |
| void | encodeNP (const std::vector< float > &in, String &result, bool zlib_compression, const NumpressConfig &config) |
| encodeNP from a float (convert first to double) More... | |
| void | decodeNP (const String &in, std::vector< double > &out, bool zlib_compression, const NumpressConfig &config) |
| Decodes a Base64 string to a vector of floating point numbers using numpress. More... | |
| void | encodeNPRaw (const std::vector< double > &in, String &result, const NumpressConfig &config) |
| Encode the vector in to the result string using numpress (unsafe) More... | |
| void | decodeNPRaw (const std::string &in, std::vector< double > &out, const NumpressConfig &config) |
| Decode the (not necessary null terminated) string in to the result vector out (unsafe) More... | |
Static Public Attributes | |
| static const std::string | NamesOfNumpressCompression [SIZE_OF_NUMPRESSCOMPRESSION] |
| Names of compression schemes. More... | |
Private Member Functions | |
| void | decodeNPInternal_ (const unsigned char *in, size_t in_size, std::vector< double > &out, const NumpressConfig &config) |
Private Attributes | |
| Base64 | base64coder_ |
Class to encode and decode data encoded with MSNumpress.
MSNumpress supports three encoding schemata:
| enum NumpressCompression |
|
inline |
default constructor
|
inlinevirtual |
Destructor.
| void decodeNP | ( | const String & | in, |
| std::vector< double > & | out, | ||
| bool | zlib_compression, | ||
| const NumpressConfig & | config | ||
| ) |
Decodes a Base64 string to a vector of floating point numbers using numpress.
This code is obtained from the proteowizard implementation ./pwiz/pwiz/data/msdata/BinaryDataEncoder.cpp (adapted by Hannes Roest).
This function will first decode the input base64 string (with optional zlib decompression after decoding) and then apply numpress decoding to the data.
| in | The base64 encoded string |
| out | The resulting vector of doubles |
| zlib_compression | Whether to apply zlib de-compression before numpress de-compression |
| config | The numpress configuration defining the compression strategy |
| throws | Exception::ConversionError if the string cannot be converted |
|
private |
| void decodeNPRaw | ( | const std::string & | in, |
| std::vector< double > & | out, | ||
| const NumpressConfig & | config | ||
| ) |
Decode the (not necessary null terminated) string in to the result vector out (unsafe)
This performs the raw numpress decoding on a raw byte array (not Base64 encoded). Therefore the input string is likely *unsafe* to handle and is basically a byte container.
Please use the safe versions above unless you only have the raw byte arrays.
| in | The base64 encoded string |
| out | The resulting vector of doubles |
| config | The numpress configuration defining the compression strategy |
| throws | Exception::ConversionError if the string cannot be converted |
| void encodeNP | ( | const std::vector< double > & | in, |
| String & | result, | ||
| bool | zlib_compression, | ||
| const NumpressConfig & | config | ||
| ) |
Encodes a vector of floating point numbers into a Base64 string using numpress.
This code is obtained from the proteowizard implementation ./pwiz/pwiz/data/msdata/BinaryDataEncoder.cpp (adapted by Hannes Roest).
This function will first apply the numpress encoding to the data, then encode the result in base64 (with optional zlib compression before base64 encoding).
| in | The vector of floating point numbers to be encoded |
| result | The resulting string |
| zlib_compression | Whether to apply zlib compression after numpress compression |
| config | The numpress configuration defining the compression strategy |
| void encodeNP | ( | const std::vector< float > & | in, |
| String & | result, | ||
| bool | zlib_compression, | ||
| const NumpressConfig & | config | ||
| ) |
encodeNP from a float (convert first to double)
| void encodeNPRaw | ( | const std::vector< double > & | in, |
| String & | result, | ||
| const NumpressConfig & | config | ||
| ) |
Encode the vector in to the result string using numpress (unsafe)
This performs the raw numpress encoding on a set of data and does no Base64 encoding on the result. Therefore the result string is likely *unsafe* to handle and is basically a byte container.
Please use the safe versions above unless you need access to the raw byte arrays.
| in | The vector of floating point numbers to be encoded |
| result | The resulting string |
| config | The numpress configuration defining the compression strategy |
|
private |
|
static |
Names of compression schemes.
| OpenMS / TOPP release 2.3.0 | Documentation generated on Tue Jan 9 2018 18:22:10 using doxygen 1.8.13 |