OpendTect  7.0
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
RefCount::Counter Class Reference

Public Member Functions

 Counter ()
 
 Counter (const Counter &a)
 
void addObserver (WeakPtrBase *obj)
 
void clearAllObservers ()
 
std::int32_t count () const
 
void ref ()
 
bool refIfReffed ()
 Don't use in production, for debugging. More...
 
void removeObserver (WeakPtrBase *obj)
 
bool tryRef ()
 
bool unRef ()
 
void unRefDontInvalidate ()
 Will allow it to go to zero. More...
 

Static Public Member Functions

static std::int32_t cInvalidRefCount ()
 
static std::int32_t cStartRefCount ()
 

Private Attributes

Threads::Atomic< std::int32_t > count_
 
ObjectSet< WeakPtrBaseobservers_
 
Threads::SpinLock observerslock_
 

Detailed Description

Actual implementation of the reference counting. Normally not used by application developers.

<>

Constructor & Destructor Documentation

◆ Counter() [1/2]

RefCount::Counter::Counter ( )

◆ Counter() [2/2]

RefCount::Counter::Counter ( const Counter a)

Member Function Documentation

◆ addObserver()

void RefCount::Counter::addObserver ( WeakPtrBase obj)

◆ cInvalidRefCount()

static std::int32_t RefCount::Counter::cInvalidRefCount ( )
static

◆ clearAllObservers()

void RefCount::Counter::clearAllObservers ( )

◆ count()

std::int32_t RefCount::Counter::count ( ) const
inline

◆ cStartRefCount()

static std::int32_t RefCount::Counter::cStartRefCount ( )
static

◆ ref()

void RefCount::Counter::ref ( )

◆ refIfReffed()

bool RefCount::Counter::refIfReffed ( )

Don't use in production, for debugging.

◆ removeObserver()

void RefCount::Counter::removeObserver ( WeakPtrBase obj)

◆ tryRef()

bool RefCount::Counter::tryRef ( )

Refs if not invalid. Note that you have to have guarantees that object is not dead. *.

◆ unRef()

bool RefCount::Counter::unRef ( )

Unref to zero will set it to an deleted state, and return true.

◆ unRefDontInvalidate()

void RefCount::Counter::unRefDontInvalidate ( )

Will allow it to go to zero.

Member Data Documentation

◆ count_

Threads::Atomic< std::int32_t > RefCount::Counter::count_
private

◆ observers_

ObjectSet<WeakPtrBase> RefCount::Counter::observers_
private

◆ observerslock_

Threads::SpinLock RefCount::Counter::observerslock_
private

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2024