Generated on Tue Feb 11 2025 17:33:26 for Gecode by doxygen 1.12.0
Gecode::Support::RefCount Class Reference

A class for thread-safe reference counting. More...

#include <ref-count.hpp>

Public Member Functions

 RefCount (unsigned long int n)
 Initialize.
 
void inc (void)
 Increment counter.
 
bool dec (void)
 Decrement counter and return true if it hits zero.
 
 operator bool (void) const
 Test whether reference count is non-zero.
 

Protected Attributes

std::atomic_ulong n
 The reference count.
 

Detailed Description

A class for thread-safe reference counting.

Definition at line 39 of file ref-count.hpp.

Constructor & Destructor Documentation

◆ RefCount()

Gecode::Support::RefCount::RefCount ( unsigned long int n)
inline

Initialize.

Definition at line 55 of file ref-count.hpp.

Member Function Documentation

◆ inc()

void Gecode::Support::RefCount::inc ( void )
inline

Increment counter.

Definition at line 59 of file ref-count.hpp.

◆ dec()

bool Gecode::Support::RefCount::dec ( void )
inline

Decrement counter and return true if it hits zero.

Definition at line 63 of file ref-count.hpp.

◆ operator bool()

Gecode::Support::RefCount::operator bool ( void ) const
inline

Test whether reference count is non-zero.

Definition at line 67 of file ref-count.hpp.

Member Data Documentation

◆ n

std::atomic_ulong Gecode::Support::RefCount::n
protected

The reference count.

Definition at line 42 of file ref-count.hpp.


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