Public Member Functions | Private Attributes
MAKLogger::DtSmartBuffer Class Reference

A smart buffer has a shared pointer to the memory buffer and an offset and size of a 'smart' sub buffer. More...

+ Collaboration diagram for MAKLogger::DtSmartBuffer:

List of all members.

Public Member Functions

 DtSmartBuffer (const DtMemoryBufferSP &parentBuffer)
 Creates a smart sub buffer, that is maps directly to a single DtSmartBuffer.
 DtSmartBuffer (const DtMemoryBufferSP &parentBuffer, size_t offset, size_t size)
 CTOR which uses shared parent buffer.
 ~DtSmartBuffer ()
 DTOR
DtMemoryBufferSP buffer () const
 Get the memory buffer the smart buffer uses.
void setBuffer (const DtMemoryBufferSP &buffer)
 Set the memory buffer the smart buffer uses.
void * data ()
 Get the data in the smart buffer.
const void * data () const
 Get the const data in the smart buffer.
size_t size () const
 Get the size of the smart buffer.
void resize (size_t)
 Set the size of the smart buffer.
size_t availableSize () const
 Get the available size left in the memory buffer.
size_t currentOffset () const
 Get the current offset from the base memory.
void increaseOffset (int offsetInBytes)
 Increase the offset in the memory buffer.
void setOffset (int offsetInBytes)
 Set the offset from the beginning of the memory buffer.
void resetOffset ()
 Reset the offset to the beginning of the memory buffer.

Private Attributes

DtMemoryBufferSP myBuffer
void * mySubData
size_t mySize

Detailed Description

A smart buffer has a shared pointer to the memory buffer and an offset and size of a 'smart' sub buffer.


Constructor & Destructor Documentation

MAKLogger::DtSmartBuffer::DtSmartBuffer ( const DtMemoryBufferSP &  parentBuffer) [explicit]

Creates a smart sub buffer, that is maps directly to a single DtSmartBuffer.

Initializes offset to beginning of buffer and size to size of entire buffer.

Exceptions:
DtInvalidinput if the buffer is null.
MAKLogger::DtSmartBuffer::DtSmartBuffer ( const DtMemoryBufferSP &  parentBuffer,
size_t  offset,
size_t  size 
)

CTOR which uses shared parent buffer.

Exceptions:
DtInvalidInputwhen the offset is too large.

Member Function Documentation

size_t MAKLogger::DtSmartBuffer::availableSize ( ) const

Get the available size left in the memory buffer.

This will be >= to size

void MAKLogger::DtSmartBuffer::increaseOffset ( int  offsetInBytes)

Increase the offset in the memory buffer.

Exceptions:
DtInvalidInputwhen the offset is too large.
void MAKLogger::DtSmartBuffer::resize ( size_t  )

Set the size of the smart buffer.

Warning:
This does not change the amount of memory allocated.
Exceptions:
DtInvalidInputwhen the offset is larger than the memory buffer or less than zero.
void MAKLogger::DtSmartBuffer::setBuffer ( const DtMemoryBufferSP &  buffer)

Set the memory buffer the smart buffer uses.

This call initializes offset to beginning of buffer and size to size of entire buffer.

Exceptions:
DtInvalidinput if the buffer is null.
void MAKLogger::DtSmartBuffer::setOffset ( int  offsetInBytes)

Set the offset from the beginning of the memory buffer.

Exceptions:
DtInvalidInputwhen the offset is too large.

The documentation for this class was generated from the following file:

Document ID: Generated on Tue Oct 11 19:41:03 EDT 2011 from SVN revision 107422
Copyright © 2005-2011 VT MÄK Inc. All Rights Reserved (www.mak.com)