45 lines
867 B
C++
45 lines
867 B
C++
#ifndef _EYD_BITREADER_HH
|
|
#define _EYD_BITREADER_HH
|
|
|
|
#include <string>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <fcntl.h>
|
|
#include <exception>
|
|
|
|
#include "eyd_bitgroup.hh"
|
|
|
|
#include "eyd_global.hh"
|
|
#include "eyd_iface.hh"
|
|
|
|
|
|
namespace EydLib {
|
|
class eBitReaderEndOfFile : public std::exception { };
|
|
class eBitReaderBadFileDescriptor : public std::exception { };
|
|
|
|
class BitReader {
|
|
private:
|
|
char * _read_buffer;
|
|
int _real_buffer_size;
|
|
int _wanted_buffer_size;
|
|
int _bitgroup_size;
|
|
int _current_bit_position;
|
|
int _file_desc;
|
|
bool _eof;
|
|
|
|
bool getBitAt(int position);
|
|
|
|
public:
|
|
BitReader(int size, int buffer_size);
|
|
~BitReader();
|
|
|
|
void open(std::string filename);
|
|
/* BitGroup * BitReader::read(int size); */
|
|
BitGroup BitReader::read();
|
|
ssize_t readDirect(void *buf, size_t count);
|
|
void close();
|
|
};
|
|
}
|
|
|
|
#endif
|