123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #ifndef __BITSEQUENCE_H__
- #define __BITSEQUENCE_H__
- #include "bitstream.h"
- class CBitSequence
- {
- public:
- CBitSequence(int nBits = 0) { m_nBits = nBits; m_nValue = 0; }
- virtual ~CBitSequence() {}
- void SetNumberOfBits(int nBits) { m_nBits = nBits; }
- int GetNumberOfBits() const { return m_nBits; }
- bool ReadFrom(CBitStream &Bs) { m_nValue = Bs.GetBits(m_nBits); return true; }
- bool ReadFrom_Bit(CBitStream &Bs) { m_nValue = Bs.Get1Bit(); return true; }
- bool ReadFrom(CBitStream &Bs, int nBits) { SetNumberOfBits(nBits); return ReadFrom(Bs); }
- bool Equals(int nValue) const { return (m_nValue == nValue); }
- int ToInt() const { return m_nValue; }
- void FromInt(int nValue) { m_nValue = nValue; }
- protected:
- private:
- int m_nBits;
- int m_nValue;
- };
- #endif
|