C++ Actor Framework  0.18
Public Member Functions | Protected Attributes | Related Functions | List of all members
caf::ref_counted Class Reference

Base class for reference counted objects with an atomic reference count. More...

#include <ref_counted.hpp>

Inheritance diagram for caf::ref_counted:
Inheritance graph
Collaboration diagram for caf::ref_counted:
Collaboration graph

Public Member Functions

 ref_counted (const ref_counted &)
 
ref_countedoperator= (const ref_counted &)
 
void ref () const noexcept
 Increases reference count by one.
 
void deref () const noexcept
 Decreases reference count by one and calls request_deletion when it drops to zero. More...
 
bool unique () const noexcept
 Queries whether there is exactly one reference.
 
size_t get_reference_count () const noexcept
 

Protected Attributes

std::atomic< size_t > rc_
 

Related Functions

(Note that these are not member functions.)

template<class T , class... Ts>
intrusive_cow_ptr< T > make_copy_on_write (Ts &&... xs)
 Constructs an object of type T in an intrusive_cow_ptr. More...
 
template<class T , class... Ts>
intrusive_ptr< T > make_counted (Ts &&... xs)
 Constructs an object of type T in an intrusive_ptr.
 
void intrusive_ptr_add_ref (const ref_counted *p)
 
void intrusive_ptr_release (const ref_counted *p)
 

Detailed Description

Base class for reference counted objects with an atomic reference count.

Serves the requirements of intrusive_ptr.

Note
All instances of ref_counted start with a reference count of 1.

Member Function Documentation

◆ deref()

void caf::ref_counted::deref ( ) const
noexcept

Decreases reference count by one and calls request_deletion when it drops to zero.

Friends And Related Function Documentation

◆ intrusive_ptr_add_ref()

void intrusive_ptr_add_ref ( const ref_counted p)
related

◆ intrusive_ptr_release()

void intrusive_ptr_release ( const ref_counted p)
related

◆ make_copy_on_write()

template<class T , class... Ts>
intrusive_cow_ptr< T > make_copy_on_write ( Ts &&...  xs)
related

Constructs an object of type T in an intrusive_cow_ptr.

intrusive_cow_ptr


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