MADNESS  version 0.9
Public Member Functions | List of all members
madness::detail::RemoteCounterBase Class Referenceabstract

Base class for remote counter implementation objects. More...

#include <worldref.h>

Inheritance diagram for madness::detail::RemoteCounterBase:
Inheritance graph
[legend]

Public Member Functions

 RemoteCounterBase ()
 
virtual ~RemoteCounterBase ()
 
virtual void * key () const =0
 Counter key accessor. More...
 
long use_count () const
 Remote and local counter accessor. More...
 
template<typename T >
const std::shared_ptr< T > & get_shared () const
 Shared pointer accessor. More...
 
void add_ref ()
 Increment the reference count. More...
 
bool release ()
 Decrement the reference count. More...
 

Detailed Description

Base class for remote counter implementation objects.

This class only holds an atomic counter. The use counter tracks local copies of the counter an references that have been copied as part of the communication process. This class also provides a mechanism for hiding the pointer type.

Note
The actual counter manipulation is handled by RemoteCounter. This class only provides the counter interface.
This class is considered an implementation detail and may change at any time. You should not use this class directly.

Constructor & Destructor Documentation

madness::detail::RemoteCounterBase::RemoteCounterBase ( )
inline
virtual madness::detail::RemoteCounterBase::~RemoteCounterBase ( )
inlinevirtual

Member Function Documentation

void madness::detail::RemoteCounterBase::add_ref ( )
inline

Increment the reference count.

The reference count should be incremented when a local copy of the counter is created or the when the counter is serialized as part of communication.

Exceptions
nothing

References c, key(), and madness::print().

template<typename T >
const std::shared_ptr<T>& madness::detail::RemoteCounterBase::get_shared ( ) const
inline

Shared pointer accessor.

Template Parameters
TThe stored pointer type
Returns
A const reference to the stored shared pointer
virtual void* madness::detail::RemoteCounterBase::key ( ) const
pure virtual

Counter key accessor.

The key is the pointer for which the remote counter is counting references.

Returns
The pointer that is being counted.

Implemented in madness::detail::RemoteCounterImpl< T >.

Referenced by add_ref(), and release().

bool madness::detail::RemoteCounterBase::release ( )
inline

Decrement the reference count.

Returns
true if the reference count has dropped to zero
Exceptions
nothing

References c, madness::AtomicInt::dec_and_test(), key(), and madness::print().

long madness::detail::RemoteCounterBase::use_count ( ) const
inline

Remote and local counter accessor.

The use counter tracks local copies of the counter an references that have been copied as part othe communication process


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