2009-11-21 01:45:08 +00:00
|
|
|
#ifndef __BUFFER_H__
|
|
|
|
#define __BUFFER_H__
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace ProFUSE {
|
|
|
|
class Buffer {
|
|
|
|
|
|
|
|
public:
|
|
|
|
Buffer() {}
|
|
|
|
Buffer(unsigned size) { _buffer.reserve(size); }
|
|
|
|
|
|
|
|
void *buffer() const { return (void *)&_buffer[0]; }
|
|
|
|
unsigned size() const { return _buffer.size(); }
|
2009-11-22 21:56:32 +00:00
|
|
|
|
2009-11-21 01:45:08 +00:00
|
|
|
void resize(unsigned size) { _buffer.resize(size); }
|
2009-11-22 21:56:32 +00:00
|
|
|
void clear() { _buffer.clear(); }
|
2009-11-21 01:45:08 +00:00
|
|
|
|
|
|
|
void push8(uint8_t x) { _buffer.push_back(x); }
|
|
|
|
|
|
|
|
void push16be(uint16_t);
|
|
|
|
void push16le(uint16_t);
|
|
|
|
|
2009-11-23 03:19:38 +00:00
|
|
|
|
|
|
|
void push24be(uint32_t);
|
|
|
|
void push24le(uint32_t);
|
|
|
|
|
2009-11-21 01:45:08 +00:00
|
|
|
void push32be(uint32_t);
|
|
|
|
void push32le(uint32_t);
|
|
|
|
|
|
|
|
void pushBytes(const void *data, unsigned size);
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<uint8_t> _buffer;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|