dune-fem  2.4.1-rc
Public Types | Public Member Functions | Protected Attributes | List of all members
Dune::Fem::ObjectPointer< ReferenceCounter > Class Template Reference

models a pointer to a reference countable object More...

#include </local/tomalk/somewhere/tmp/dune-fem/dune/fem/storage/referencecounter.hh>

Public Types

typedef ReferenceCounter ReferenceCounterType
 type of the object, this pointer points to More...
 
typedef ReferenceCounterType::ObjectType ObjectType
 

Public Member Functions

 ObjectPointer (ReferenceCounterType *const object=0)
 initialize a pointer (with a standard C++ pointer) More...
 
 ObjectPointer (const ThisType &other)
 copy constructor More...
 
 ~ObjectPointer ()
 destructor More...
 
ThisTypeoperator= (const ThisType &other)
 assign another pointer to this one. More...
 
ObjectTypeoperator* () const
 dereference the ObjectPointer More...
 
unsigned int referenceCounter () const
 return current reference count More...
 

Protected Attributes

ReferenceCounterTypeobject_
 

Detailed Description

template<class ReferenceCounter>
class Dune::Fem::ObjectPointer< ReferenceCounter >

models a pointer to a reference countable object

ObjectPointer tries to behave like a normal pointer to an object implementing the ReferenceCounterInterface. Internally, however, it calls the object's addReference and removeReference methods whenever the pointer is created, assign or deleted.

Member Typedef Documentation

template<class ReferenceCounter >
typedef ReferenceCounterType::ObjectType Dune::Fem::ObjectPointer< ReferenceCounter >::ObjectType
template<class ReferenceCounter >
typedef ReferenceCounter Dune::Fem::ObjectPointer< ReferenceCounter >::ReferenceCounterType

type of the object, this pointer points to

Constructor & Destructor Documentation

template<class ReferenceCounter >
Dune::Fem::ObjectPointer< ReferenceCounter >::ObjectPointer ( ReferenceCounterType *const  object = 0)
inlineexplicit

initialize a pointer (with a standard C++ pointer)

Parameters
[in]objectC++ pointer to initialize this pointer with; the default value is 0
template<class ReferenceCounter >
Dune::Fem::ObjectPointer< ReferenceCounter >::ObjectPointer ( const ThisType other)
inline

copy constructor

Copying an ObjectPointer will also increase the reference counter of the object pointed to.

Parameters
[in]otherpointer to assign to this one
template<class ReferenceCounter >
Dune::Fem::ObjectPointer< ReferenceCounter >::~ObjectPointer ( )
inline

destructor

When the pointer is deleted, the reference counter of the object pointed to is automatically decreased.

Member Function Documentation

template<class ReferenceCounter >
ObjectType& Dune::Fem::ObjectPointer< ReferenceCounter >::operator* ( ) const
inline

dereference the ObjectPointer

Note
This method asserts that the pointer is not 0.
Returns
a reference to the object pointed to.
template<class ReferenceCounter >
ThisType& Dune::Fem::ObjectPointer< ReferenceCounter >::operator= ( const ThisType other)
inline

assign another pointer to this one.

References Dune::Fem::ObjectPointer< ReferenceCounter >::object_.

template<class ReferenceCounter >
unsigned int Dune::Fem::ObjectPointer< ReferenceCounter >::referenceCounter ( ) const
inline

return current reference count

Member Data Documentation

template<class ReferenceCounter >
ReferenceCounterType* Dune::Fem::ObjectPointer< ReferenceCounter >::object_
protected

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