foobar2000 SDK  2015-08-03
Public Types | Public Member Functions | Private Member Functions | Private Attributes
pfc::counter

#include <ref_counter.h>

Public Types

typedef long t_val
 

Public Member Functions

 counter (t_val p_val=0)
 
 operator t_val () const throw ()
 
long operator++ () throw ()
 
long operator++ (int) throw ()
 
long operator-- () throw ()
 
long operator-- (int) throw ()
 

Private Member Functions

t_val dec ()
 
t_val inc ()
 

Private Attributes

volatile t_val m_val
 

Detailed Description

Definition at line 6 of file ref_counter.h.

Member Typedef Documentation

typedef long pfc::counter::t_val

Definition at line 8 of file ref_counter.h.

Constructor & Destructor Documentation

pfc::counter::counter ( t_val  p_val = 0)
inline

Definition at line 10 of file ref_counter.h.

10 : m_val(p_val) {}
volatile t_val m_val
Definition: ref_counter.h:32

Member Function Documentation

t_val pfc::counter::dec ( )
inlineprivate

Definition at line 24 of file ref_counter.h.

24  {
25 #ifdef _MSC_VER
26  return _InterlockedDecrement(&m_val);
27 #else
28  return __sync_sub_and_fetch(&m_val, 1);
29 #endif
30  }
volatile t_val m_val
Definition: ref_counter.h:32
t_val pfc::counter::inc ( )
inlineprivate

Definition at line 17 of file ref_counter.h.

17  {
18 #ifdef _MSC_VER
19  return _InterlockedIncrement(&m_val);
20 #else
21  return __sync_add_and_fetch(&m_val, 1);
22 #endif
23  }
volatile t_val m_val
Definition: ref_counter.h:32
pfc::counter::operator t_val ( ) const
throw (
)
inline

Definition at line 15 of file ref_counter.h.

15 {return m_val;}
volatile t_val m_val
Definition: ref_counter.h:32
long pfc::counter::operator++ ( )
throw (
)
inline

Definition at line 11 of file ref_counter.h.

11 {return inc();}
t_val inc()
Definition: ref_counter.h:17
long pfc::counter::operator++ ( int  )
throw (
)
inline

Definition at line 13 of file ref_counter.h.

13 {return inc()-1;}
t_val inc()
Definition: ref_counter.h:17
long pfc::counter::operator-- ( )
throw (
)
inline

Definition at line 12 of file ref_counter.h.

12 {return dec();}
t_val dec()
Definition: ref_counter.h:24
long pfc::counter::operator-- ( int  )
throw (
)
inline

Definition at line 14 of file ref_counter.h.

14 {return dec()+1;}
t_val dec()
Definition: ref_counter.h:24

Field Documentation

volatile t_val pfc::counter::m_val
private

Definition at line 32 of file ref_counter.h.


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