Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
LockPtr< T > Class Template Reference

#include <elm/util/LockPtr.h>

+ Inheritance diagram for LockPtr< T >:

Public Member Functions

 LockPtr (T *p=0)
 
 LockPtr (const LockPtr &l)
 
 ~LockPtr (void)
 
LockPtroperator= (const LockPtr &lock)
 
LockPtroperator= (T *p)
 
T * operator-> (void) const
 
T & operator* (void) const
 
T * operator& (void) const
 
bool isNull (void) const
 
 operator bool (void) const
 
bool operator== (const LockPtr< T > &ap) const
 
bool operator!= (const LockPtr< T > &ap) const
 
bool operator> (const LockPtr< T > &ap) const
 
bool operator>= (const LockPtr< T > &ap) const
 
bool operator< (const LockPtr< T > &ap) const
 
bool operator<= (const LockPtr< T > &ap) const
 

Static Public Attributes

static LockPtr< T > null
 

Detailed Description

template<class T>
class elm::LockPtr< T >

Implements a pointer wrapper class that takes care of the usage of a pointer and that automatically delete a pointed object when it is no more used.

Based on reference counting approach, assignment of shared pointer induces the decrementation of the previous pointer and the incrementation of the new pointer. Unlike the SharedPtr, the pointed object must implements the Lock class. This permits to save one extraneous pointer used, in SharedPtr, to link the pointed objects with its counter.

Beware: this also means that pointed objects forming a cycle will not be deleted!

Parameters
TType of pointed object.

Constructor & Destructor Documentation

◆ LockPtr() [1/2]

LockPtr ( T *  p = 0)
inline

◆ LockPtr() [2/2]

LockPtr ( const LockPtr< T > &  l)
inline

◆ ~LockPtr()

~LockPtr ( void  )
inline

Member Function Documentation

◆ isNull()

◆ operator bool()

operator bool ( void  ) const
inline

◆ operator!=()

bool operator!= ( const LockPtr< T > &  ap) const
inline

◆ operator&()

T* operator& ( void  ) const
inline

◆ operator*()

T& operator* ( void  ) const
inline

◆ operator->()

T* operator-> ( void  ) const
inline

◆ operator<()

bool operator< ( const LockPtr< T > &  ap) const
inline

◆ operator<=()

bool operator<= ( const LockPtr< T > &  ap) const
inline

◆ operator=() [1/2]

LockPtr& operator= ( const LockPtr< T > &  lock)
inline

◆ operator=() [2/2]

LockPtr& operator= ( T *  p)
inline

◆ operator==()

bool operator== ( const LockPtr< T > &  ap) const
inline

◆ operator>()

bool operator> ( const LockPtr< T > &  ap) const
inline

◆ operator>=()

bool operator>= ( const LockPtr< T > &  ap) const
inline

Member Data Documentation

◆ null

LockPtr<T> null
static

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