00001
00007
#ifndef DECODECONTEXT_HPP_INCLUDED
00008
#define DECODECONTEXT_HPP_INCLUDED
00009
00010
#include "codectypedefs.hpp"
00011
00012
#include <map>
00013
#include <stack>
00014
#include <string>
00015
#include <iosfwd>
00016
00026 class DecodeContext
00027 {
00028
public:
00029
DecodeContext(
file_it data_begin,
00030
file_it data_end);
00031
00032
public:
00042 std::string
00043
readFieldValue(std::string
const & field_name,
00044
unsigned width_of_field_in_bits);
00045
00046
00051
bool finished()
const;
00052
00053
public:
00054
00063
bool testCondition(std::string
const & field,
00064 std::string
const & op,
00065
unsigned long const & value)
const;
00066
00067
public:
00073
void registerCRC();
00074
00080
bool testLoopExit();
00081
00082
private:
00083
void pushLoopExit(
unsigned bytes_to_loop_exit);
00084
00085
private:
00086
void pushFieldValue(std::string
const & field,
00087
unsigned long const & value);
00088
00089
private:
00090
void getCurrentByte();
00091
00092
private:
00093
unsigned current_byte_;
00094
unsigned bits_left_;
00095
00096
unsigned depth_;
00097
00098
int offset_for_crc_;
00099
00100
00101
00102
file_it data_begin_;
00103
file_it data_end_;
00104
00105
00106
typedef std::map<std::string, unsigned long> field_values;
00107 field_values field_values_;
00108
00109
00110 std::stack<file_it> loop_exits_;
00111 };
00112
00113
#endif // defined DECODECONTEXT_HPP_INCLUDED