Rev 1319 | Rev 1323 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1319 | Rev 1322 | ||
|---|---|---|---|
| Line 8... | Line 8... | ||
| 8 | #ifndef BITBUFFER_H_ |
8 | #ifndef BITBUFFER_H_ |
| 9 | #define BITBUFFER_H_ |
9 | #define BITBUFFER_H_ |
| 10 | 10 | ||
| 11 | #include <vector> |
11 | #include <vector> |
| 12 | #include <string> |
12 | #include <string> |
| - | 13 | #include "types.h" |
|
| 13 | 14 | ||
| 14 | namespace atom { |
15 | namespace atom { |
| 15 | namespace message { |
16 | namespace message { |
| 16 | 17 | ||
| 17 | using namespace std; |
18 | using namespace std; |
| 18 | 19 | ||
| 19 | class BitBuffer { |
20 | class BitBuffer { |
| 20 | public: |
21 | public: |
| 21 | BitBuffer(unsigned char bytes[], unsigned int length); |
22 | BitBuffer(unsigned char bytes[], unsigned int length); |
| 22 | BitBuffer(vector<unsigned char> bytes); |
- | |
| 23 | BitBuffer( |
23 | BitBuffer(byte_list bytes); |
| 24 | BitBuffer(); |
24 | BitBuffer(); |
| 25 | virtual ~BitBuffer(); |
25 | virtual ~BitBuffer(); |
| 26 | 26 | ||
| - | 27 | byte_list getAsBytes(); |
|
| - | 28 | void setFromBytes(vector<unsigned char> bytes); |
|
| - | 29 | ||
| 27 |
|
30 | void readBasicType(unsigned int length, long & value); |
| 28 | void |
31 | void writeBasicType(unsigned int length, long value); |
| - | 32 | ||
| - | 33 | void readBasicType(unsigned int length, unsigned long & value); |
|
| - | 34 | void writeBasicType(unsigned int length, unsigned long value); |
|
| 29 | 35 | ||
| 30 | unsigned long readUnsignedInteger(unsigned int length); |
- | |
| 31 | void |
36 | void readBasicType(unsigned int length, bool & value); |
| 32 | - | ||
| 33 | double readDecimal(unsigned int length, unsigned int scaling); |
- | |
| 34 | void |
37 | void writeBasicType(unsigned int length, bool value); |
| 35 | - | ||
| 36 | bool readBoolean(); |
- | |
| 37 | void writeBoolean(bool value); |
- | |
| 38 | - | ||
| 39 | vector<unsigned char> getAsBytes(); |
- | |
| 40 | void setFromBytes(vector<unsigned char> bytes); |
- | |
| 41 | 38 | ||
| 42 |
|
39 | void readDecimal(unsigned int length, unsigned int scaling, double & value); |
| 43 | void |
40 | void writeDecimal(unsigned int length, unsigned int scaling, double value); |
| 44 | 41 | ||
| 45 | private: |
42 | private: |
| 46 |
|
43 | byte_list myBuffer; |
| 47 | }; |
44 | }; |
| 48 | 45 | ||
| 49 | } |
46 | } |
| 50 | } |
47 | } |
| 51 | 48 | ||