MySQL 8.4.2
Source Code Documentation
my_ref_counted Class Reference

Helper class for reference counting. More...

#include <my_ref_counted.h>

Inheritance diagram for my_ref_counted:
[legend]

Public Member Functions

 my_ref_counted ()
 default constructor More...
 
 my_ref_counted (my_ref_counted &other)
 copy constructor More...
 
virtual ~my_ref_counted ()
 
uint64 add_reference ()
 Increases a reference count. More...
 
bool release_reference (uint64 *new_count=nullptr)
 Decreases a reference count. More...
 
uint64 get_reference_count () const
 Returns the reference counter value. More...
 

Private Attributes

std::atomic< uint64m_count
 the reference count value More...
 

Detailed Description

Helper class for reference counting.

Constructor & Destructor Documentation

◆ my_ref_counted() [1/2]

my_ref_counted::my_ref_counted ( )

default constructor

◆ my_ref_counted() [2/2]

my_ref_counted::my_ref_counted ( my_ref_counted other)

copy constructor

◆ ~my_ref_counted()

my_ref_counted::~my_ref_counted ( )
virtualdefault

Member Function Documentation

◆ add_reference()

uint64 my_ref_counted::add_reference ( )

Increases a reference count.

Returns
old value

◆ get_reference_count()

uint64 my_ref_counted::get_reference_count ( ) const

Returns the reference counter value.

Returns
current value

◆ release_reference()

bool my_ref_counted::release_reference ( uint64 new_count = nullptr)

Decreases a reference count.

Doesn't allow to decrease below 0.

Parameters
[out]new_countPointer to variable to store new count. May be NULL.
Returns
Status of performed operation
Return values
falsesuccess
trueFailure. Will be returned in case counter is already 0.

Member Data Documentation

◆ m_count

std::atomic<uint64> my_ref_counted::m_count
private

the reference count value


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