pion::PionBlob< CharType, AllocType > Class Template Reference

#include <PionBlob.hpp>

List of all members.


Detailed Description

template<typename CharType, typename AllocType>
class pion::PionBlob< CharType, AllocType >

PionBlob: a simple, reference-counting BLOB class that uses PionPoolAllocator for memory management

Definition at line 27 of file PionBlob.hpp.

Public Member Functions

virtual ~PionBlob ()
 virtual destructor
 PionBlob (void)
 default constructor
 PionBlob (const PionBlob &blob)
 PionBlob (const BlobParams &p)
 PionBlob (AllocType &blob_alloc, const CharType *ptr, const std::size_t len)
 PionBlob (AllocType &blob_alloc, const std::string &str)
PionBloboperator= (const PionBlob &blob)
void set (const BlobParams &p)
void set (AllocType &blob_alloc, const CharType *ptr, const std::size_t len)
void set (AllocType &blob_alloc, const std::string &str)
const CharType * get (void) const
 returns (const) reference to the BLOB payload
std::size_t size (void) const
 returns size of the BLOB in octets
std::size_t length (void) const
 returns length of the BLOB in octets (alias for size())
bool empty (void) const
 returns true if the BLOB is empty (undefined or size == 0)
long use_count (void) const
 returns the number of reference to this BLOB (or 0 if this is null)
bool unique (void) const
 returns true if this is a unique instance or if this is null
void clear (void)
 alias for release() -> switch to empty state
void reset (void)
 alias for release() -> switch to empty state
bool operator== (const PionBlob &blob) const
 returns true if str is equal to this (BLOB matches string)
bool operator== (const std::string &str) const
 returns true if str is equal to this (BLOB matches string)
bool operator!= (const PionBlob &blob) const
 returns true if blob is not equal to this (two BLOBs do not match)
bool operator!= (const std::string &str) const
 returns true if str is not equal to this (BLOB does not match string)
bool operator< (const PionBlob &blob) const
 returns true if this is less than blob
bool operator> (const PionBlob &blob) const
 returns true if this is greater than blob
bool operator< (const std::string &str) const
 returns true if this is less than str
bool operator> (const std::string &str) const
 returns true if this is greater than str

Protected Member Functions

void release (void)
BlobDatagrab (void) const

Static Protected Member Functions

static BlobDatacreate (AllocType &blob_alloc, const std::size_t len)

Protected Attributes

BlobDatam_blob_ptr
 pointer to the BLOB metadata structure (payload follows the structure)

Classes

struct  BlobData
 structure used to store BLOB metadata; payload starts immediately following this More...
struct  BlobParams
 data type used to initialize blobs in variants without copy construction More...


Constructor & Destructor Documentation

template<typename CharType, typename AllocType>
pion::PionBlob< CharType, AllocType >::PionBlob ( const PionBlob< CharType, AllocType > &  blob  )  [inline]

copy constructor

Parameters:
blob grabs reference from this existing blob

Definition at line 132 of file PionBlob.hpp.

template<typename CharType, typename AllocType>
pion::PionBlob< CharType, AllocType >::PionBlob ( const BlobParams p  )  [inline]

constructs a BLOB using BlobParams

Parameters:
p BlobParams contains all parameters used to initialize the BLOB

Definition at line 141 of file PionBlob.hpp.

References pion::PionBlob< CharType, AllocType >::create(), pion::PionBlob< CharType, AllocType >::BlobData::get(), pion::PionBlob< CharType, AllocType >::BlobParams::m_alloc, pion::PionBlob< CharType, AllocType >::m_blob_ptr, pion::PionBlob< CharType, AllocType >::BlobParams::m_len, and pion::PionBlob< CharType, AllocType >::BlobParams::m_ptr.

template<typename CharType, typename AllocType>
pion::PionBlob< CharType, AllocType >::PionBlob ( AllocType &  blob_alloc,
const CharType *  ptr,
const std::size_t  len 
) [inline]

constructs a BLOB using existing memory buffer

Parameters:
blob_alloc allocator used for memory management
ptr pointer to a buffer of memory to copy into the BLOB
len size in octets of the memory buffer to copy

Definition at line 155 of file PionBlob.hpp.

References pion::PionBlob< CharType, AllocType >::create(), pion::PionBlob< CharType, AllocType >::BlobData::get(), and pion::PionBlob< CharType, AllocType >::m_blob_ptr.

template<typename CharType, typename AllocType>
pion::PionBlob< CharType, AllocType >::PionBlob ( AllocType &  blob_alloc,
const std::string &  str 
) [inline]

constructs a BLOB using existing string

Parameters:
blob_alloc allocator used for memory management
str existing std::string object to copy

Definition at line 168 of file PionBlob.hpp.

References pion::PionBlob< CharType, AllocType >::create(), pion::PionBlob< CharType, AllocType >::BlobData::get(), and pion::PionBlob< CharType, AllocType >::m_blob_ptr.


Member Function Documentation

template<typename CharType, typename AllocType>
static BlobData* pion::PionBlob< CharType, AllocType >::create ( AllocType &  blob_alloc,
const std::size_t  len 
) [inline, static, protected]

creates a new BLOB reference object

Parameters:
len size in octets to allocate for the BLOB
Returns:
BlobData* pointer to the new BLOB data object (with reference incremented)

Definition at line 70 of file PionBlob.hpp.

Referenced by pion::PionBlob< CharType, AllocType >::PionBlob(), and pion::PionBlob< CharType, AllocType >::set().

template<typename CharType, typename AllocType>
BlobData* pion::PionBlob< CharType, AllocType >::grab ( void   )  const [inline, protected]

grabs & returns reference pointer to this BLOB (increments references)

Definition at line 93 of file PionBlob.hpp.

References pion::PionBlob< CharType, AllocType >::m_blob_ptr, and pion::PionBlob< CharType, AllocType >::BlobData::m_copies.

Referenced by pion::PionBlob< CharType, AllocType >::operator=().

template<typename CharType, typename AllocType>
PionBlob& pion::PionBlob< CharType, AllocType >::operator= ( const PionBlob< CharType, AllocType > &  blob  )  [inline]

assignment operator

Parameters:
blob grabs reference from this existing blob
Returns:
reference to this BLOB

Definition at line 182 of file PionBlob.hpp.

References pion::PionBlob< CharType, AllocType >::grab(), pion::PionBlob< CharType, AllocType >::m_blob_ptr, and pion::PionBlob< CharType, AllocType >::release().

template<typename CharType, typename AllocType>
void pion::PionBlob< CharType, AllocType >::release ( void   )  [inline, protected]

releases pointer to the BLOB metadata structure, and frees memory if no more references

Definition at line 79 of file PionBlob.hpp.

References pion::PionBlob< CharType, AllocType >::BlobData::m_alloc_ptr, pion::PionBlob< CharType, AllocType >::m_blob_ptr, pion::PionBlob< CharType, AllocType >::BlobData::m_copies, and pion::PionBlob< CharType, AllocType >::BlobData::m_len.

Referenced by pion::PionBlob< CharType, AllocType >::clear(), pion::PionBlob< CharType, AllocType >::operator=(), pion::PionBlob< CharType, AllocType >::reset(), pion::PionBlob< CharType, AllocType >::set(), and pion::PionBlob< CharType, AllocType >::~PionBlob().

template<typename CharType, typename AllocType>
void pion::PionBlob< CharType, AllocType >::set ( AllocType &  blob_alloc,
const std::string &  str 
) [inline]

assigns BLOB to use an existing string

Parameters:
blob_alloc allocator used for memory management
str existing std::string object to copy

Definition at line 218 of file PionBlob.hpp.

References pion::PionBlob< CharType, AllocType >::create(), pion::PionBlob< CharType, AllocType >::BlobData::get(), pion::PionBlob< CharType, AllocType >::m_blob_ptr, and pion::PionBlob< CharType, AllocType >::release().

template<typename CharType, typename AllocType>
void pion::PionBlob< CharType, AllocType >::set ( AllocType &  blob_alloc,
const CharType *  ptr,
const std::size_t  len 
) [inline]

assigns BLOB to use an existing memory buffer

Parameters:
blob_alloc allocator used for memory management
ptr pointer to a buffer of memory to copy into the BLOB
len size in octets of the memory buffer to copy

Definition at line 206 of file PionBlob.hpp.

References pion::PionBlob< CharType, AllocType >::create(), pion::PionBlob< CharType, AllocType >::BlobData::get(), pion::PionBlob< CharType, AllocType >::m_blob_ptr, and pion::PionBlob< CharType, AllocType >::release().

template<typename CharType, typename AllocType>
void pion::PionBlob< CharType, AllocType >::set ( const BlobParams p  )  [inline]

assigns BLOB to existing memory buffer via BlobParams

Parameters:
p BlobParams contains all parameters used to initialize the BLOB

Definition at line 193 of file PionBlob.hpp.

References pion::PionBlob< CharType, AllocType >::create(), pion::PionBlob< CharType, AllocType >::BlobData::get(), pion::PionBlob< CharType, AllocType >::BlobParams::m_alloc, pion::PionBlob< CharType, AllocType >::m_blob_ptr, pion::PionBlob< CharType, AllocType >::BlobParams::m_len, pion::PionBlob< CharType, AllocType >::BlobParams::m_ptr, and pion::PionBlob< CharType, AllocType >::release().


The documentation for this class was generated from the following file:
Generated on Fri Apr 30 14:48:54 2010 for pion-net by  doxygen 1.4.7