add configBitstreamParser an base class for all bitstream file parser

This commit is contained in:
Gwenhael Goavec-Merou
2019-10-05 10:27:35 +02:00
parent ea44d71a65
commit d3da23149c
2 changed files with 57 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
#ifndef CONFIGBITSTREAMPARSER_H
#define CONFIGBITSTREAMPARSER_H
#include <iostream>
#include <fstream>
#include <stdint.h>
class ConfigBitstreamParser {
public:
ConfigBitstreamParser(std::string filename, int mode = ASCII_MODE);
~ConfigBitstreamParser();
virtual int parse() = 0;
uint8_t *getData() {return (uint8_t*)_bit_data.c_str();}
int getLength() {return _bit_length;}
enum {
ASCII_MODE = 0,
BIN_MODE = std::ifstream::binary
};
protected:
std::string _filename;
int _bit_length;
int _file_size;
std::ifstream _fd;
std::string _bit_data;
};
#endif