23 #ifndef __ccxx_Buffer_hxx 24 #define __ccxx_Buffer_hxx 62 Buffer(T* data,
size_t size,
bool takeOwnership =
true);
115 bool put(
const T& item);
157 bool get(T* items,
uint_t count);
167 int peek(
const T& item)
const;
230 #include <commonc++/BufferImpl.h++> 237 #endif // __ccxx_Buffer_hxx void rewind()
Rewind the buffer.
T * getPointer()
Get a pointer to the element at the current position.
Definition: Buffer.h++:170
Buffer< byte_t > ByteBuffer
Definition: Buffer.h++:232
Buffer< char > CharBuffer
Definition: Buffer.h++:233
void fill(const T &item, uint_t count=0)
Fill the buffer with a given item.
void setLimit(uint_t limit)
Set the limit.
uint_t _pos
The position.
Definition: Buffer.h++:223
unsigned int uint_t
An alias for unsigned int.
Definition: Integers.h++:74
void flip()
Flip the buffer.
T & operator[](int index)
Get a reference to the element at the specified index.
uint_t getRemaining() const
Get the number of elements available to be read or written.
Definition: Buffer.h++:186
bool hasRemaining() const
Test if there are any elements available to be read or written.
Definition: Buffer.h++:195
const T * getPointer() const
Get a pointer to the next element to be read or written.
Definition: Buffer.h++:174
uint_t bump(uint_t delta)
Bump (advance) the position by the given number of elements, or to the limit, whichever occurs first...
bool put(const T &item)
Copy an item into the buffer at the current position and bump the position by 1.
uint_t getLimit() const
Get the limit.
Definition: Buffer.h++:178
void setPosition(uint_t pos)
Set the position.
T * _data
A pointer to the raw buffer.
Definition: AbstractBuffer.h++:96
A buffer for storing a contiguous sequence of elements.
Definition: Buffer.h++:44
virtual ~Buffer()
Destructor.
int peek(const T &item) const
Scan forward from the current position for an element equal to the given value.
virtual void clear()
Clear the buffer.
Buffer(uint_t size)
Construct a new Buffer with the given size.
uint_t skip(uint_t delta)
Advance the position by the given number of elements, or to the limit, whichever occurs first...
An abstract base class for buffers.
Definition: AbstractBuffer.h++:38
uint_t _limit
The limit.
Definition: Buffer.h++:221
Definition: AllocationMap.c++:25
uint_t getPosition() const
Get the position of the next element to be read or written.
Definition: Buffer.h++:199