MADNESS  0.10.1
Public Member Functions | Private Member Functions | Private Attributes | 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]
Collaboration diagram for madness::detail::RemoteCounterBase:
Collaboration graph
[legend]

Public Member Functions

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

Private Member Functions

 RemoteCounterBase (const RemoteCounterBase &)
 
RemoteCounterBaseoperator= (const RemoteCounterBase &)
 

Private Attributes

madness::AtomicInt count_
 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

◆ RemoteCounterBase() [1/2]

madness::detail::RemoteCounterBase::RemoteCounterBase ( const RemoteCounterBase )
private

◆ RemoteCounterBase() [2/2]

madness::detail::RemoteCounterBase::RemoteCounterBase ( )
inline

References count_.

◆ ~RemoteCounterBase()

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

Member Function Documentation

◆ add_ref()

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, count_, key(), and madness::print().

◆ get_shared()

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

◆ key()

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().

◆ operator=()

RemoteCounterBase& madness::detail::RemoteCounterBase::operator= ( const RemoteCounterBase )
private

◆ 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, count_, madness::AtomicInt::dec_and_test(), key(), and madness::print().

◆ use_count()

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

References count_.

Member Data Documentation

◆ count_

madness::AtomicInt madness::detail::RemoteCounterBase::count_
private

reference count

Referenced by RemoteCounterBase(), add_ref(), release(), and use_count().


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