DUNE-FEM (unstable)
default implementation of ReferenceCounterInterface More...
#include <dune/fem/storage/referencecounter.hh>
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 ObjectType & | getObject () const |
access the real object (const version) More... | |
ObjectType & | getObject () |
access the real object (non-const version) More... | |
Detailed Description
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()
|
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] refcount start value for the reference counter; this value defalts to 1
Member Function Documentation
◆ addReference()
|
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()
|
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]
|
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]
|
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()
|
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:
- dune/fem/storage/referencecounter.hh