Main Page | Namespace List | Class List | File List | Namespace Members | Class Members | File Members

decodecontext.hpp

Go to the documentation of this file.
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: // construct 00029 DecodeContext(file_it data_begin, 00030 file_it data_end); 00031 00032 public: // read and advance 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: // conditional and loop support 00054 00063 bool testCondition(std::string const & field, 00064 std::string const & op, 00065 unsigned long const & value) const; 00066 00067 public: // loop support 00073 void registerCRC(); 00074 00080 bool testLoopExit(); 00081 00082 private: // loop support 00083 void pushLoopExit(unsigned bytes_to_loop_exit); 00084 00085 private: // save values 00086 void pushFieldValue(std::string const & field, 00087 unsigned long const & value); 00088 00089 private: // read and advance 00090 void getCurrentByte(); 00091 00092 private: 00093 unsigned current_byte_; // The current byte from the input stream 00094 unsigned bits_left_; // How much of this byte remains to be read 00095 00096 unsigned depth_; // How deeply nested into the section 00097 00098 int offset_for_crc_; // Offset from the end of the section at 00099 // which the last loop ends. Either 4 or 0, 00100 // depending on the section type. 00101 00102 file_it data_begin_; 00103 file_it data_end_; 00104 00105 // Record of field values, used in conditional evaluation. 00106 typedef std::map<std::string, unsigned long> field_values; 00107 field_values field_values_; 00108 00109 // Stack of file iterators marking loop exits 00110 std::stack<file_it> loop_exits_; 00111 }; 00112 00113 #endif // defined DECODECONTEXT_HPP_INCLUDED

Generated on Fri Nov 26 15:31:02 2004 for DVB Codec by doxygen 1.3.7