Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::SharedReference Class Referenceabstract

Implementation of a reference counter using std::atomic. More...

#include <arcane/core/SharedReference.h>

Inheritance diagram for Arcane::SharedReference:
Collaboration diagram for Arcane::SharedReference:

Public Member Functions

void addRef () override
 Increments the reference counter.
void removeRef () override
 Decrements the reference counter.
Int32 refCount () const override
 Returns the value of the reference counter.
virtual void deleteMe ()=0
 Destroys the referenced object.
Public Member Functions inherited from Arcane::ISharedReference
virtual ~ISharedReference ()=default
 Releases resources.

Private Attributes

std::atomic< Int32m_ref_count
 Number of references on the object.

Detailed Description

Implementation of a reference counter using std::atomic.

Definition at line 34 of file SharedReference.h.

Constructor & Destructor Documentation

◆ SharedReference()

Arcane::SharedReference::SharedReference ( )
inline

Definition at line 39 of file SharedReference.h.

Member Function Documentation

◆ addRef()

void Arcane::SharedReference::addRef ( )
overridevirtual

Increments the reference counter.

Implements Arcane::ISharedReference.

Definition at line 27 of file SharedReference.cc.

References m_ref_count.

Referenced by Arcane::ItemPairGroupImpl::addRef().

Here is the caller graph for this function:

◆ deleteMe()

virtual void Arcane::SharedReference::deleteMe ( )
pure virtual

Destroys the referenced object.

Implemented in Arcane::ItemGroupImpl, Arcane::ItemPairGroupImpl, Arcane::PropertiesImpl, and Arcane::VariableCollection::Impl.

Referenced by removeRef().

Here is the caller graph for this function:

◆ refCount()

Int32 Arcane::SharedReference::refCount ( ) const
inlineoverridevirtual

Returns the value of the reference counter.

Implements Arcane::ISharedReference.

Definition at line 47 of file SharedReference.h.

References m_ref_count.

Referenced by Arcane::ItemGroupImpl::nbRef(), and Arcane::ItemPairGroupImpl::nbRef().

Here is the caller graph for this function:

◆ removeRef()

void Arcane::SharedReference::removeRef ( )
overridevirtual

Decrements the reference counter.

Implements Arcane::ISharedReference.

Definition at line 36 of file SharedReference.cc.

References Arcane::arcaneNoReferenceErrorCallTerminate(), deleteMe(), and m_ref_count.

Referenced by Arcane::ItemPairGroupImpl::removeRef().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_ref_count

std::atomic<Int32> Arcane::SharedReference::m_ref_count
private

Number of references on the object.

Definition at line 54 of file SharedReference.h.

Referenced by addRef(), refCount(), and removeRef().


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