Webmaster  |  Imprint 
C++ Server Pages
Main  |  License  |  Documentation  |  Download 

IBlob Class Reference

Implementation base of Blob values. More...

#include <tntdb/iface/iblob.h>

Inheritance diagram for IBlob:

BlobImpl List of all members.

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.

Protected Attributes

char * _data
std::size_t _size

Detailed Description

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.


Member Function Documentation

virtual void assign ( const char *  data,
std::size_t  len 
) [pure virtual]

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

Implemented in BlobImpl.

virtual IBlob* create (  )  const [pure virtual]

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

Implemented in BlobImpl.

virtual void destroy (  )  [pure virtual]

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

Implemented in BlobImpl.

Copyright © 2008 The Tntnet Development Team
Tntnet 1.6