ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
base::core::counted_base Class Reference

The base class for reference-counted objects. More...

#include <refcount.h>

Inheritance diagram for base::core::counted_base:
Collaboration diagram for base::core::counted_base:

Public Member Functions

 counted_base ()
 Default constructor. Initializes the reference count to one.
 
void ref () const
 Increases the reference count by one.
 
bool unref () const
 Decreases the reference count by one.
 
int_fast32_t ref_count () const
 Gets the current reference count.
 
bool ref_count_is_one () const
 Checks if the reference count is one.
 

Protected Member Functions

virtual ~counted_base ()
 Virtual destructor.
 

Private Member Functions

 counted_base (const counted_base &)=delete
 
void operator= (const counted_base &)=delete
 

Private Attributes

std::atomic_int_fast32_t ref_
 

Detailed Description

The base class for reference-counted objects.

Constructor & Destructor Documentation

◆ counted_base() [1/2]

base::core::counted_base::counted_base ( )

Default constructor. Initializes the reference count to one.

◆ ~counted_base()

virtual base::core::counted_base::~counted_base ( )
inlineprotectedvirtual

Virtual destructor.

The destructor is protected to prevent the explicit initialization of the base class.

◆ counted_base() [2/2]

base::core::counted_base::counted_base ( const counted_base )
privatedelete

Member Function Documentation

◆ operator=()

void base::core::counted_base::operator= ( const counted_base )
privatedelete

◆ ref()

void base::core::counted_base::ref ( ) const

Increases the reference count by one.

Here is the caller graph for this function:

◆ ref_count()

int_fast32_t base::core::counted_base::ref_count ( ) const

Gets the current reference count.

Returns
The current reference count.
Here is the caller graph for this function:

◆ ref_count_is_one()

bool base::core::counted_base::ref_count_is_one ( ) const

Checks if the reference count is one.

Returns
True if the reference count is one, otherwise false.
Here is the call graph for this function:

◆ unref()

bool base::core::counted_base::unref ( ) const

Decreases the reference count by one.

Returns
True if the object is deleted, otherwise false.
Here is the caller graph for this function:

Member Data Documentation

◆ ref_

std::atomic_int_fast32_t base::core::counted_base::ref_
mutableprivate

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