MistServer  2.5.3-Pro-19-gf5e75b1 ( Generic_64)
bitstream.h
Go to the documentation of this file.
1 #pragma once
2 #include<string>
3 
4 namespace Utils {
5  class bitstream {
6  public:
7  bitstream();
8  bitstream & operator<< (std::string input) {
9  append(input);
10  return *this;
11  };
12  bitstream & operator<< (char input) {
13  append(std::string(input, 1));
14  return *this;
15  };
16  void append(const char * input, size_t bytes);
17  void append(const std::string & input);
18  long long unsigned int size();
19  void skip(size_t count);
20  long long unsigned int get(size_t count);
21  long long unsigned int peek(size_t count);
22  bool peekOffset(size_t peekOffset);
23  void flush();
24  void clear();
25  long long int getExpGolomb();
26  long long unsigned int getUExpGolomb();
27  long long int peekExpGolomb();
28  long long unsigned int peekUExpGolomb();
29  private:
30  bool checkBufferSize(unsigned int size);
31  long long unsigned int golombGetter();
32  long long unsigned int golombPeeker();
33  char * data;
34  size_t offset;
35  size_t dataSize;
36  size_t bufferSize;
37  };
38 
39  class bitstreamLSBF {
40  public:
41  bitstreamLSBF();
42  bitstreamLSBF & operator<< (std::string input) {
43  append(input);
44  return *this;
45  };
46  void append(char * input, size_t bytes);
47  void append(std::string & input);
48  long long unsigned int size();
49  void skip(size_t count);
50  long long unsigned int get(size_t count);
51  long long unsigned int peek(size_t count);
52  void clear();
53  std::string data;
54  private:
55  long long unsigned int readBuffer;
56  unsigned int readBufferOffset;
57  void fixData();
58  };
59 }
60 
61 
size_t dataSize
Definition: bitstream.h:35
long long unsigned int golombGetter()
Definition: bitstream.cpp:127
bool peekOffset(size_t peekOffset)
Definition: bitstream.cpp:40
size_t offset
Definition: bitstream.h:34
unsigned int readBufferOffset
Definition: bitstream.h:56
bool checkBufferSize(unsigned int size)
Definition: bitstream.cpp:14
long long int peekExpGolomb()
Definition: bitstream.cpp:145
bitstream & operator<<(std::string input)
Definition: bitstream.h:8
void append(const char *input, size_t bytes)
Definition: bitstream.cpp:29
char * data
Definition: bitstream.h:33
std::string data
Definition: bitstream.h:53
long long unsigned int golombPeeker()
Definition: bitstream.cpp:118
long long int getExpGolomb()
Definition: bitstream.cpp:136
long long unsigned int readBuffer
Definition: bitstream.h:55
void clear()
Definition: bitstream.cpp:107
void flush()
Definition: bitstream.cpp:112
size_t bufferSize
Definition: bitstream.h:36
Definition: bitstream.h:5
long long unsigned int size()
Definition: bitstream.cpp:103
bitstream()
Definition: bitstream.cpp:7
Definition: bitstream.h:39
long long unsigned int peek(size_t count)
Definition: bitstream.cpp:45
Definition: bitstream.cpp:6
void skip(size_t count)
Definition: bitstream.cpp:94
long long unsigned int peekUExpGolomb()
Definition: bitstream.cpp:150
long long unsigned int getUExpGolomb()
Definition: bitstream.cpp:141