configBitstreamParser: external access to header keys/values

This commit is contained in:
Gwenhael Goavec-Merou 2021-02-10 08:02:20 +01:00
parent e91c251eb0
commit 210bdac09a
2 changed files with 21 additions and 0 deletions

View File

@ -29,6 +29,14 @@ ConfigBitstreamParser::~ConfigBitstreamParser()
_fd.close();
}
string ConfigBitstreamParser::getHeaderVal(string key)
{
auto val = _hdr.find(key);
if (val == _hdr.end())
throw std::runtime_error("Error key " + key + " not found");
return val->second;
}
uint8_t ConfigBitstreamParser::reverseByte(uint8_t src)
{
uint8_t dst = 0;

View File

@ -14,6 +14,19 @@ class ConfigBitstreamParser {
virtual int parse() = 0;
uint8_t *getData() {return (uint8_t*)_bit_data.c_str();}
int getLength() {return _bit_length;}
/**
* \brief get header list of keys/values
* \return list of couple keys/values
*/
std::map<std::string, std::string> getHeader() { return _hdr; }
/**
* \brief get value in header list
* \param[in] key: key value
* \return associated value for the key
*/
std::string getHeaderVal(std::string key);
enum {
ASCII_MODE = 0,