avro::detail::BufferImpl Class Reference

Implementation details for Buffer class. More...

#include <BufferDetail.hh>

List of all members.

Public Types

typedef std::deque< ChunkChunkList
typedef boost::shared_ptr
< BufferImpl
SharedPtr
typedef boost::shared_ptr
< const BufferImpl
ConstSharedPtr

Public Member Functions

 BufferImpl ()
 Default constructor, creates a buffer without any chunks.
 BufferImpl (const BufferImpl &src)
 Copy constructor, gets a copy of all the chunks with data.
size_type size () const
 Amount of data held in this buffer.
size_type freeSpace () const
 Capacity that may be written before the buffer must allocate more memory.
void reserveFreeSpace (size_type reserveSize)
 Add enough free chunks to make the reservation size available.
ChunkList::const_iterator beginRead () const
 Return the chunk avro's begin iterator for reading.
ChunkList::const_iterator endRead () const
 Return the chunk avro's end iterator for reading.
ChunkList::const_iterator beginWrite () const
 Return the chunk avro's begin iterator for writing.
ChunkList::const_iterator endWrite () const
 Return the chunk avro's end iterator for writing.
template<typename T >
void writeTo (T val, const boost::true_type &)
 Write a single value to buffer, add a new chunk if necessary.
template<typename T >
void writeTo (T val, const boost::false_type &)
 An uninstantiable function, this is if boost::is_fundamental check fails, and will compile-time assert.
size_type writeTo (const data_type *data, size_type size)
 Write a block of data to the buffer, adding new chunks if necessary.
size_type wroteTo (size_type size)
 Update internal status of chunks after data is written using iterator.
void append (const BufferImpl &src)
 Append the chunks that have data in src to this buffer.
void discardData ()
 Remove all the chunks that contain data from this buffer.
void discardData (size_type bytes)
 Remove the specified amount of data from the chunks, starting at the front.
void extractData (BufferImpl &dest, size_type bytes)
 Remove the specified amount of data from the chunks, moving the data to dest's chunks.
void extractData (BufferImpl &dest)
 Move data from this to the destination, leaving this buffer without data.
void copyData (BufferImpl &dest, ChunkList::const_iterator iter, size_type offset, size_type bytes) const
 Copy data to a different buffer by copying the chunks.
int numDataChunks () const
 The number of chunks containing data. Used for debugging.
int numFreeChunks () const
 The number of chunks containing free space (note that an entire chunk may not be free).
void appendForeignData (const data_type *data, size_type size, const free_func &func)
 Add unmanaged data to the buffer.

Detailed Description

Implementation details for Buffer class.

Internally, BufferImpl keeps two lists of chunks, one list consists entirely of chunks containing data, and one list which contains chunks with free space.


Member Function Documentation

void avro::detail::BufferImpl::appendForeignData ( const data_type *  data,
size_type  size,
const free_func &  func 
) [inline]

Add unmanaged data to the buffer.

The buffer will not automatically free the data, but it will call the supplied function when the data is no longer referenced by the buffer (or copies of the buffer).

void avro::detail::BufferImpl::copyData ( BufferImpl dest,
ChunkList::const_iterator  iter,
size_type  offset,
size_type  bytes 
) const [inline]

Copy data to a different buffer by copying the chunks.

It's a bit like extract, but without modifying the source buffer.

int avro::detail::BufferImpl::numFreeChunks (  )  const [inline]

The number of chunks containing free space (note that an entire chunk may not be free).

Used for debugging.

void avro::detail::BufferImpl::reserveFreeSpace ( size_type  reserveSize  )  [inline]

Add enough free chunks to make the reservation size available.

Actual amount may be more (rounded up to next chunk).

template<typename T >
void avro::detail::BufferImpl::writeTo ( val,
const boost::false_type &   
) [inline]

An uninstantiable function, this is if boost::is_fundamental check fails, and will compile-time assert.


The documentation for this class was generated from the following file:
Generated on Thu Sep 2 18:40:54 2010 for Avro C++ by  doxygen 1.6.3