Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef BUFFER_H
- #define BUFFER_H
- class Buffer
- {
- public:
- Buffer(long long _size);
- virtual ~Buffer();
- long long Size();
- long long Read();
- long long Written();
- long long RemainingSpace(); // you cannot write past the limit of the buffer
- long long RemainingData(); // you cannot read if there is nothing written
- void Reset(); // when you want to reuse the buffer just reset it
- unsigned char* GetArray(); // returns the pointer to the underlying array
- bool tryWriteFloat(float);
- bool tryWriteDouble(double);
- bool tryReadFloat(float&);
- bool tryReadDouble(double&);
- private:
- unsigned char* buffer;
- long long size = 0;
- long long read = 0; // how much was read
- long long written = 0; // how much was written
- };
- #endif // BUFFER_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement