CppDB
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Public Member Functions
cppdb::ref_ptr< T > Class Template Reference

This is a smart intrusive reference counting pointer that throws a error on empty access. More...

#include <cppdb/ref_ptr.h>

List of all members.

Public Member Functions

 ref_ptr (T *v=0)
 ~ref_ptr ()
 ref_ptr (ref_ptr const &other)
ref_ptr const & operator= (ref_ptr const &other)
T * get () const
 operator bool () const
T * operator-> () const
T & operator* () const
void reset (T *v=0)

Detailed Description

template<typename T>
class cppdb::ref_ptr< T >

This is a smart intrusive reference counting pointer that throws a error on empty access.

The T should follow these concepts:

   T::add_ref() // increases reference count
   IntegerType  T::del_ref() // decreases reference count and returns its current value
   static T::dispose(T *) // destroys the object

Constructor & Destructor Documentation

template<typename T>
cppdb::ref_ptr< T >::ref_ptr ( T *  v = 0) [inline]

Default create a new object, if v is not null increases its reference count and stores it

template<typename T>
cppdb::ref_ptr< T >::~ref_ptr ( ) [inline]

Dereference the object, if reference count goes to 0 destroys it calling T::dispose

template<typename T>
cppdb::ref_ptr< T >::ref_ptr ( ref_ptr< T > const &  other) [inline]

Copy a pointer


Member Function Documentation

template<typename T>
T* cppdb::ref_ptr< T >::get ( ) const [inline]

Get he pointer value, it may return NULL in case of empty pointer

template<typename T>
cppdb::ref_ptr< T >::operator bool ( ) const [inline]

Cast to boolean type: check if the pointer is not empty in similar way as you check ordinary pointers.

template<typename T>
T& cppdb::ref_ptr< T >::operator* ( ) const [inline]

Returns reference to object, throws cppdb_error if it is NULL

template<typename T>
T* cppdb::ref_ptr< T >::operator-> ( ) const [inline]

Returns pointer to object, throws cppdb_error if it is NULL

template<typename T>
ref_ptr const& cppdb::ref_ptr< T >::operator= ( ref_ptr< T > const &  other) [inline]

Assign a pointer

template<typename T>
void cppdb::ref_ptr< T >::reset ( T *  v = 0) [inline]

Reset the pointer with new value - old object is dereferenced new is added.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator