Parse the format in config file. More...
#include <data.h>
Public Member Functions | |
| int32_t | getRecordLength () const |
| Get the length of a record. More... | |
| int32_t | getKeyLength () const |
| Get the key length. More... | |
| DataFormat (const toml::array &array) | |
| Construct by specifications in config file. More... | |
| template<int32_t key_len> | |
| const int8_t * | readAsFormat (Record< key_len > &record, const int8_t *byte) const |
| Unscramble byte string in given format. More... | |
| template<int32_t key_len> | |
| const int8_t * | writeAsFormat (const Record< key_len > &record, int8_t *byte) const |
| Scramble the record in given format. More... | |
Parse the format in config file.
| Field Name | Viable Length | Further Constraints |
|---|---|---|
| flowkey | 4, 8, 13 | Specify exactly once |
| timestamp | 1, 2, 4, 8 | In microseconds. Specify at most once |
| length | 1, 2, 4, 8 | Specify at most once |
| padding | > 0 | None |
| OmniSketch::Data::DataFormat::DataFormat | ( | const toml::array & | array | ) |
Construct by specifications in config file.
It is suggested that toml::array is fetched via a call to Util::ConfigParser::parseConfig(T &, const std::string_view) const with T = toml::array.
|
inline |
Get the key length.
|
inline |
Get the length of a record.
| const int8_t * OmniSketch::Data::DataFormat::readAsFormat | ( | Record< key_len > & | record, |
| const int8_t * | byte | ||
| ) | const |
Unscramble byte string in given format.
| key_len | length of flowkey |
| record | the record to be stored to |
| byte | pointer to byte string |
key_len does not match that in DataFormat. | const int8_t * OmniSketch::Data::DataFormat::writeAsFormat | ( | const Record< key_len > & | record, |
| int8_t * | byte | ||
| ) | const |
Scramble the record in given format.
| key_len | length of flowkey |
| record | the record to be deserialized |
| byte | to store the deserialized message |
key_len does not match that in DataFormat.