Implementation base of Blob values. More...

#include <tntdb/iface/iblob.h>

Inheritance diagram for tntdb::IBlob:
cxxtools::AtomicRefCounted tntdb::BlobImpl

Public Member Functions

virtual ~IBlob ()
 Destructor.
virtual void assign (const char *data, std::size_t len)=0
 Assign data of a given length.
virtual char * reserve (std::size_t len, bool shrink)=0
 Makes sure, the buffer has at least len bytes.
virtual IBlobcreate () const =0
 Create a value implementation.
virtual void destroy ()=0
 Destroy a value implementation.
std::size_t size () const
 Returns the size of the blob-data.
const char * data () const
 Returns a pointer to the blob-data or 0 if the blob is empty.
bool operator== (const IBlob &other) const
 Returns true if the two instances contain the same data.
- Public Member Functions inherited from cxxtools::AtomicRefCounted
 AtomicRefCounted ()
 AtomicRefCounted (unsigned refs_)
virtual ~AtomicRefCounted ()
virtual atomic_t addRef ()
virtual atomic_t release ()
atomic_t refs () const

Protected Member Functions

 IBlob ()

Protected Attributes

char * _data
std::size_t _size

Detailed Description

Implementation base of Blob values.

This class serves as the base for the shared implementation classes used in Blob objects. The non-virtual interface consists of a pointer to the blob-data and its size. The implementor has to override three virtual methods, IBlob::assign, IBlob::create and IBlob::destroy. The main purpose of these methods is to customize memory allocation of blob-data, aswell as the shared implementation class derived from IBlob. A default implementation, called BlobImpl, is provided, that uses new/delete and the implementation class.

Constructor & Destructor Documentation

virtual tntdb::IBlob::~IBlob ( )
virtual

Destructor.

tntdb::IBlob::IBlob ( )
inlineprotected

Member Function Documentation

virtual void tntdb::IBlob::assign ( const char *  data,
std::size_t  len 
)
pure virtual

Assign data of a given length.

The len bytes of the data pointed to by data are copied to this blob.

Implemented in tntdb::BlobImpl.

virtual IBlob* tntdb::IBlob::create ( ) const
pure virtual

Create a value implementation.

Returns a pointer to a implementation class derived from IBlob. IBlob::destroy must be implemented accordingly to destroy this instance.

Implemented in tntdb::BlobImpl.

const char* tntdb::IBlob::data ( ) const
inline

Returns a pointer to the blob-data or 0 if the blob is empty.

virtual void tntdb::IBlob::destroy ( )
pure virtual

Destroy a value implementation.

Destroys an instance previously created by the IBlob::create.

Implemented in tntdb::BlobImpl.

bool tntdb::IBlob::operator== ( const IBlob other) const
inline

Returns true if the two instances contain the same data.

virtual char* tntdb::IBlob::reserve ( std::size_t  len,
bool  shrink 
)
pure virtual

Makes sure, the buffer has at least len bytes.

Implemented in tntdb::BlobImpl.

std::size_t tntdb::IBlob::size ( ) const
inline

Returns the size of the blob-data.

Member Data Documentation

char* tntdb::IBlob::_data
protected
std::size_t tntdb::IBlob::_size
protected

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