The InputBuffer (read-only buffer). More...
#include <Buffer.hh>
Classes | |
class | ShallowCopy |
Class to indicate that a copy of a OutputBuffer to InputBuffer should be a shallow copy, used to enable reading of the contents of an OutputBuffer without need to convert it to InputBuffer using a deep copy. | |
Public Types | |
typedef detail::size_type | size_type |
typedef detail::data_type | data_type |
typedef detail::InputBufferIterator | const_iterator |
Public Member Functions | |
InputBuffer () | |
Default InputBuffer creates an empty buffer. | |
InputBuffer (const OutputBuffer &src) | |
Construct an InputBuffer that contains the contents of an OutputBuffer. | |
bool | empty () const |
Does the buffer have any data? | |
size_type | size () const |
Returns the size of the buffer, in bytes. | |
const_iterator | begin () const |
Return an iterator pointing to the first data chunk of this buffer that contains data. | |
const_iterator | end () const |
Return the end iterator. | |
int | numChunks () const |
Returns the number of chunks containing data. | |
Friends | |
class | OutputBuffer |
class | istreambuf |
class | BufferReader |
The InputBuffer (read-only buffer).
InputBuffer is an immutable buffer which that may be constructed from an OutputBuffer, or several of OutputBuffer's methods. Once the data is transfered to an InputBuffer it cannot be modified, only read (via BufferReader, istream, or its iterator).
Assignments and copies are shallow copies.
avro::InputBuffer::InputBuffer | ( | ) | [inline] |
Default InputBuffer creates an empty buffer.
Copy/assignment functions use the default ones. They will do a shallow copy, and because InputBuffer is immutable, the copies will be identical.
Destructor also uses the default, which resets a shared pointer, deleting the underlying data if no other copies of exist.
avro::InputBuffer::InputBuffer | ( | const OutputBuffer & | src | ) | [inline] |
Construct an InputBuffer that contains the contents of an OutputBuffer.
The two buffers will have the same contents, but this copy will be immutable, while the the OutputBuffer may still be written to.
If you wish to move the data from the OutputBuffer to a new InputBuffer (leaving only free space in the OutputBuffer), OutputBuffer::extractData() will do this more efficiently.
Implicit conversion is allowed.