Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

mpcl::memory::TAllocSmartPointer< TItem, TAllocator > Class Template Reference

#include <alloc_smart_pointer.hh>

Inheritance diagram for mpcl::memory::TAllocSmartPointer< TItem, TAllocator >:

mpcl::memory::TBaseSmartPointer List of all members.

Public Types

typedef const TItem * const_pointer
typedef const TItem & const_reference
typedef TAllocator< TItem > item_allocator
 Item allocator type.

typedef TItem * pointer
typedef TItem & reference
typedef size_t size_type
typedef TItem value_type

Public Methods

 TAllocSmartPointer (void)
 Builds a new instance.

 TAllocSmartPointer (const TAllocSmartPointer &rkqtITEM)
template<typename TDerivedItem>  TAllocSmartPointer (const TAllocSmartPointer< TDerivedItem, TAllocator > &rkqtITEM_DERIVED)
 TAllocSmartPointer (const_pointer pktITEM)
 ~TAllocSmartPointer (void)
 Destroys the instance.

TAllocSmartPointer & operator= (const_pointer pktITEM)
void release (void)
template<typename TPointer> TPointer constCast (void) const throw ()
pointer get (void) const throw ()
bool operator== (const TAllocSmartPointer &rkqtITEM) const throw ()
bool operator!= (const TAllocSmartPointer &rkqtITEM) const throw ()
bool operator! (void) const throw ()
pointer operator-> (void) const throw (TConstraintException)
reference operator * (void) const throw (TConstraintException)

Protected Methods

void freeCell (void)
void reserveCell (const_pointer pktITEM)

Detailed Description

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
class mpcl::memory::TAllocSmartPointer< TItem, TAllocator >

Smart pointer for objects obtained using allocators (TAllocator).
Warning:
This class is not thread safe.

Definition at line 47 of file alloc_smart_pointer.hh.


Member Typedef Documentation

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
typedef const TItem* mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::const_pointer
 

Item const pointer type.

See also:
lib.container.requirements.

Definition at line 61 of file alloc_smart_pointer.hh.

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
typedef const TItem& mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::const_reference
 

Item const reference type.

See also:
lib.container.requirements.

Definition at line 69 of file alloc_smart_pointer.hh.

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
typedef TItem* mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::pointer
 

Item pointer type.

See also:
lib.container.requirements.

Definition at line 82 of file alloc_smart_pointer.hh.

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
typedef TItem& mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::reference
 

Item reference type.

See also:
lib.container.requirements.

Definition at line 90 of file alloc_smart_pointer.hh.

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
typedef size_t mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::size_type
 

Item size type.

See also:
lib.container.requirements.

Definition at line 98 of file alloc_smart_pointer.hh.

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
typedef TItem mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::value_type
 

Item value type.

See also:
lib.container.requirements.

Definition at line 106 of file alloc_smart_pointer.hh.


Constructor & Destructor Documentation

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::TAllocSmartPointer const TAllocSmartPointer< TItem, TAllocator > &    rkqtITEM [inline]
 

Builds a new instance from another instance.

Parameters:
rkqtITEM  Source instance.

Definition at line 158 of file alloc_smart_pointer.hh.

References mpcl::memory::TBaseSmartPointer::cell_type.

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
template<typename TDerivedItem>
mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::TAllocSmartPointer const TAllocSmartPointer< TDerivedItem, TAllocator > &    rkqtITEM_DERIVED [inline, explicit]
 

Builds a new instance from another TAllocSmartPointer instantiation.

Parameters:
rkqtITEM_DERIVED  Source instance.

Definition at line 172 of file alloc_smart_pointer.hh.

References mpcl::memory::TBaseSmartPointer::cell_type.

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::TAllocSmartPointer const_pointer    pktITEM [inline, explicit]
 

Builds a new instance from a pointer.

Parameters:
pktITEM  Source item.
Exceptions:
std::bad_alloc  If there is no memory available.

Definition at line 200 of file alloc_smart_pointer.hh.

References mpcl::memory::TBaseSmartPointer::cell_type, and mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::reserveCell().


Member Function Documentation

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
template<typename TPointer>
TPointer mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::constCast void    const throw () [inline]
 

Function to cast this instance to another non-const.

Returns:
The constant instance copy.

Definition at line 280 of file alloc_smart_pointer.hh.

References mpcl::memory::TBaseSmartPointer::ptSharedCell.

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
void mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::freeCell void    [inline, protected]
 

Frees space of the cell.

Precondition:
( ptSharedCell != NULL )
( ptSharedCell->pvItem != NULL )

Definition at line 120 of file alloc_smart_pointer.hh.

References mpcl::memory::TBaseSmartPointer::ptSharedCell.

Referenced by mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::release().

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
pointer mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::get void    const throw () [inline]
 

Returns a pointer to the shared item.

Returns:
A pointer to the shared item.

Definition at line 318 of file alloc_smart_pointer.hh.

References mpcl::memory::TBaseSmartPointer::ptSharedCell.

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
reference mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::operator * void    const throw (TConstraintException) [inline]
 

Returns the shared item.

Returns:
The shared item.

Definition at line 376 of file alloc_smart_pointer.hh.

References mpcl::memory::TBaseSmartPointer::ptSharedCell.

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
bool mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::operator! void    const throw () [inline]
 

Returns true if this represents a NULL pointer.

Returns:
True if this represents a NULL pointer.

Definition at line 353 of file alloc_smart_pointer.hh.

References mpcl::memory::TBaseSmartPointer::ptSharedCell.

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
bool mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::operator!= const TAllocSmartPointer< TItem, TAllocator > &    rkqtITEM const throw () [inline]
 

Returns false if both instances are bound.

Parameters:
rkqtITEM  Source instance.
Returns:
False if both instances are bound.

Definition at line 344 of file alloc_smart_pointer.hh.

References mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::operator==().

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
pointer mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::operator-> void    const throw (TConstraintException) [inline]
 

Returns the shared item.

Returns:
The shared item.

Definition at line 362 of file alloc_smart_pointer.hh.

References mpcl::memory::TBaseSmartPointer::ptSharedCell.

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
TAllocSmartPointer& mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::operator= const_pointer    pktITEM [inline]
 

Creates a new cell holding the pointer pktITEM.

Parameters:
pktITEM  Source instance.
Returns:
This instance.

Definition at line 219 of file alloc_smart_pointer.hh.

References mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::release(), and mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::reserveCell().

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
bool mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::operator== const TAllocSmartPointer< TItem, TAllocator > &    rkqtITEM const throw () [inline]
 

Returns true if both instances hold the same item or are both null.

Parameters:
rkqtITEM  Source instance.
Returns:
True if both instances are bound.

Definition at line 334 of file alloc_smart_pointer.hh.

Referenced by mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::operator!=().

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
void mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::release void    [inline]
 

Decrements reference count and releases the shared cell and the bound item if this is the last owner.

Definition at line 240 of file alloc_smart_pointer.hh.

References mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::freeCell(), and mpcl::memory::TBaseSmartPointer::ptSharedCell.

Referenced by mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::operator=(), and mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::~TAllocSmartPointer().

template<typename TItem, template< typename TItemA > class TAllocator = std::allocator>
void mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::reserveCell const_pointer    pktITEM [inline, protected]
 

Reserves space for a new cell that will contains pktITEM.

Parameters:
pktITEM  Item pointer to contain.

Definition at line 132 of file alloc_smart_pointer.hh.

References mpcl::memory::TBaseSmartPointer::ptSharedCell.

Referenced by mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::operator=(), and mpcl::memory::TAllocSmartPointer< TItem, TAllocator >::TAllocSmartPointer().


The documentation for this class was generated from the following file:
Generated on Mon Oct 13 02:35:25 2003 for MPCL by doxygen1.2.18