|
dune-fem 2.12-git
|
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 | |
| ReferenceCounterDefault (const ThisType &)=delete | |
| ThisType & | operator= (const ThisType &)=delete |
| void | addReference () const |
| :: ReferenceCounterInterface :: addReference | |
| void | deleteObject () |
| :: ReferenceCounterInterface :: deleteObject | |
| void | removeReference () const |
| :: ReferenceCounterInterface :: removeReference | |
| unsigned int | referenceCounter () const |
| return current reference count | |
| const ObjectType & | getObject () const |
| access the real object (const version) | |
| ObjectType & | getObject () |
| access the real object (non-const version) | |
Protected Member Functions | |
| const Implementation & | asImp () const |
| Implementation & | asImp () |
Static Protected Member Functions | |
| static const Implementation & | asImp (const ThisType &other) |
| static Implementation & | asImp (ThisType &other) |
| static const Implementation & | asImp (const ThisType &other) |
| static Implementation & | asImp (ThisType &other) |
| static const RCT::ReferenceCounterType & | asImp (const ThisType &other) |
| static RCT::ReferenceCounterType & | asImp (ThisType &other) |
Protected Attributes | |
| unsigned int | refcount_ |
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.
Member Typedef Documentation
◆ ObjectType
|
inherited |
type of the object, this is a reference counter for
◆ ReferenceCounterInterfaceType
|
inherited |
type of the reference counter interface
◆ ReferenceCounterType
| typedef BaseType::ReferenceCounterType Dune::Fem::ReferenceCounterDefault< RCT >::ReferenceCounterType |
type of the implementation (Barton-Nackman)
◆ Traits
|
inherited |
type of the traits
Constructor & Destructor Documentation
◆ ReferenceCounterDefault() [1/2]
|
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
◆ ReferenceCounterDefault() [2/2]
|
delete |
Member Function Documentation
◆ addReference()
|
inline |
:: ReferenceCounterInterface :: addReference
:: ReferenceCounterInterface :: addReference
◆ asImp() [1/8]
|
inlineprotected |
◆ asImp() [2/8]
|
inlineprotected |
◆ asImp() [3/8]
|
inlinestaticprotectedinherited |
◆ asImp() [4/8]
|
inlinestaticprotectedinherited |
◆ asImp() [5/8]
|
inlinestaticprotected |
◆ asImp() [6/8]
|
inlinestaticprotectedinherited |
◆ asImp() [7/8]
|
inlinestaticprotectedinherited |
◆ asImp() [8/8]
|
inlinestaticprotected |
◆ deleteObject()
|
inline |
:: ReferenceCounterInterface :: deleteObject
:: ReferenceCounterInterface :: deleteObject
◆ 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
◆ operator=()
|
delete |
◆ referenceCounter()
|
inline |
return current reference count
◆ removeReference()
|
inline |
:: ReferenceCounterInterface :: removeReference
:: ReferenceCounterInterface :: removeReference
Member Data Documentation
◆ refcount_
|
mutableprotected |
The documentation for this class was generated from the following file:
Legal Statements / Impressum | Hosted by TU Dresden & Uni Heidelberg | Generated by
1.9.8