The Battle for Wesnoth  1.15.1+dev
Public Types | Public Member Functions | Private Attributes | List of all members
n_ref_counter::ref_counter< T_integral > Class Template Reference

ref_counter is a reference counter. More...

#include <reference_counter.hpp>

Public Types

enum  { NEW =0, NOT_COUNTED = -1 }
 

Public Member Functions

 ref_counter (T_integral x=0)
 
 ref_counter (const ref_counter &a)
 
ref_counteroperator= (const ref_counter &a)
 
 operator T_integral const () const
 
T_integral const set (T_integral const a)
 
T_integral const inc ()
 
T_integral const dec ()
 
T_integral const enable_count ()
 
T_integral const disable_count ()
 
T_integral const operator++ ()
 
T_integral const operator++ (int)
 
T_integral const operator-- ()
 
T_integral const operator-- (int)
 

Private Attributes

T_integral count_
 

Detailed Description

template<typename T_integral>
class n_ref_counter::ref_counter< T_integral >

ref_counter is a reference counter.

If the counter overflows it stops counting. So any negative count disables reference counting.

Definition at line 32 of file reference_counter.hpp.

Member Enumeration Documentation

◆ anonymous enum

template<typename T_integral>
anonymous enum
Enumerator
NEW 
NOT_COUNTED 

Definition at line 38 of file reference_counter.hpp.

Constructor & Destructor Documentation

◆ ref_counter() [1/2]

template<typename T_integral>
n_ref_counter::ref_counter< T_integral >::ref_counter ( T_integral  x = 0)
inlineexplicit

Definition at line 40 of file reference_counter.hpp.

◆ ref_counter() [2/2]

template<typename T_integral>
n_ref_counter::ref_counter< T_integral >::ref_counter ( const ref_counter< T_integral > &  a)
inline

Definition at line 41 of file reference_counter.hpp.

Member Function Documentation

◆ dec()

template<typename T_integral>
T_integral const n_ref_counter::ref_counter< T_integral >::dec ( )
inline

◆ disable_count()

template<typename T_integral>
T_integral const n_ref_counter::ref_counter< T_integral >::disable_count ( )
inline

Definition at line 56 of file reference_counter.hpp.

◆ enable_count()

template<typename T_integral>
T_integral const n_ref_counter::ref_counter< T_integral >::enable_count ( )
inline

Definition at line 53 of file reference_counter.hpp.

◆ inc()

template<typename T_integral>
T_integral const n_ref_counter::ref_counter< T_integral >::inc ( )
inline

◆ operator T_integral const()

template<typename T_integral>
n_ref_counter::ref_counter< T_integral >::operator T_integral const ( ) const
inline

◆ operator++() [1/2]

template<typename T_integral>
T_integral const n_ref_counter::ref_counter< T_integral >::operator++ ( )
inline

Definition at line 60 of file reference_counter.hpp.

◆ operator++() [2/2]

template<typename T_integral>
T_integral const n_ref_counter::ref_counter< T_integral >::operator++ ( int  )
inline

Definition at line 61 of file reference_counter.hpp.

◆ operator--() [1/2]

template<typename T_integral>
T_integral const n_ref_counter::ref_counter< T_integral >::operator-- ( )
inline

Definition at line 62 of file reference_counter.hpp.

◆ operator--() [2/2]

template<typename T_integral>
T_integral const n_ref_counter::ref_counter< T_integral >::operator-- ( int  )
inline

Definition at line 63 of file reference_counter.hpp.

◆ operator=()

template<typename T_integral>
ref_counter& n_ref_counter::ref_counter< T_integral >::operator= ( const ref_counter< T_integral > &  a)
inline

Definition at line 42 of file reference_counter.hpp.

◆ set()

template<typename T_integral>
T_integral const n_ref_counter::ref_counter< T_integral >::set ( T_integral const  a)
inline

Definition at line 46 of file reference_counter.hpp.

Member Data Documentation

◆ count_

template<typename T_integral>
T_integral n_ref_counter::ref_counter< T_integral >::count_
private

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