DUNE-FEM (unstable)

Dune::Fem::ReferenceCounterDefault< RCT > Class Template Reference

default implementation of ReferenceCounterInterface More...

#include <dune/fem/storage/referencecounter.hh>

Public Types

typedef BaseType::ReferenceCounterType ReferenceCounterType
 type of the implementation (Barton-Nackman)
 
typedef RCT Traits
 type of the traits
 
typedef ThisType ReferenceCounterInterfaceType
 type of the reference counter interface
 
typedef Traits::ObjectType ObjectType
 type of the object, this is a reference counter for
 

Public Member Functions

 ReferenceCounterDefault (unsigned int refcount=1)
 constructor initializing the reference counter More...
 
void addReference () const
 Dune namespace. :: ReferenceCounterInterface :: addReference More...
 
void deleteObject ()
 Dune namespace. :: ReferenceCounterInterface :: deleteObject More...
 
void removeReference () const
 Dune namespace. :: ReferenceCounterInterface :: removeReference More...
 
unsigned int referenceCounter () const
 return current reference count
 
const ObjectTypegetObject () const
 access the real object (const version) More...
 
ObjectTypegetObject ()
 access the real object (non-const version) More...
 

Detailed Description

template<class RCT>
class Dune::Fem::ReferenceCounterDefault< RCT >

default implementation of ReferenceCounterInterface

Reference counting usually uses a class variable to hold the number of references to the instance. To make reference counting simple to use, this mechanism is default implemented.

Note
The deleteObject method is used to delete the object when the reference counter reaches zero. To perform any action other than deleting the object, simply overwrite this method.

Constructor & Destructor Documentation

◆ ReferenceCounterDefault()

template<class RCT >
Dune::Fem::ReferenceCounterDefault< RCT >::ReferenceCounterDefault ( unsigned int  refcount = 1)
inlineexplicit

constructor initializing the reference counter

Note
Since we want to be able to count referenced to stack objects, we initialize the reference counter to 1 by default. This means that after calling new we already have one reference to the object. In such cases, just call removeReference directly when the reference is no longer used (instead of simply deleting it).
Parameters
[in]refcountstart value for the reference counter; this value defalts to 1

Member Function Documentation

◆ addReference()

template<class RCT >
void Dune::Fem::ReferenceCounterDefault< RCT >::addReference ( ) const
inline

Dune namespace. :: ReferenceCounterInterface :: addReference

Include standard header files.

Todo:
put vtk io intro here ...

details and examples regarding the VTK file format can be found here:

http://www.earthmodels.org/software/vtk-and-paraview/vtk-file-formats

include base class functionality for the communication interface include parallel capability :: ReferenceCounterInterface :: addReference

◆ deleteObject()

template<class RCT >
void Dune::Fem::ReferenceCounterDefault< RCT >::deleteObject ( )
inline

Dune namespace. :: ReferenceCounterInterface :: deleteObject

Include standard header files.

Todo:
put vtk io intro here ...

details and examples regarding the VTK file format can be found here:

http://www.earthmodels.org/software/vtk-and-paraview/vtk-file-formats

include base class functionality for the communication interface include parallel capability :: ReferenceCounterInterface :: deleteObject

Referenced by Dune::Fem::ReferenceCounterDefault< RCT >::removeReference().

◆ getObject() [1/2]

template<class RCT >
ObjectType & Dune::Fem::ReferenceCounterInterface< RCT >::getObject ( )
inlineinherited

access the real object (non-const version)

Sometimes the reference counter just wraps the object for which it counts references. In such cases, this method returns the wrapped object. Otherwise, the object itself may be returned.

Returns
a reference to the real object

◆ getObject() [2/2]

template<class RCT >
const ObjectType & Dune::Fem::ReferenceCounterInterface< RCT >::getObject ( ) const
inlineinherited

access the real object (const version)

Sometimes the reference counter just wraps the object for which it counts references. In such cases, this method returns the wrapped object. Otherwise, the object itself may be returned.

Returns
a constant reference to the real object

◆ removeReference()

template<class RCT >
void Dune::Fem::ReferenceCounterDefault< RCT >::removeReference ( ) const
inline

Dune namespace. :: ReferenceCounterInterface :: removeReference

Include standard header files.

Todo:
put vtk io intro here ...

details and examples regarding the VTK file format can be found here:

http://www.earthmodels.org/software/vtk-and-paraview/vtk-file-formats

include base class functionality for the communication interface include parallel capability :: ReferenceCounterInterface :: removeReference

References Dune::Fem::ReferenceCounterDefault< RCT >::deleteObject().


The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)