Public Member Functions | Private Member Functions | Private Attributes | List of all members
FIX::atomic_count Class Reference

Atomic count class - consider using interlocked functions. More...

#include <AtomicCount.h>

Collaboration diagram for FIX::atomic_count:
Collaboration graph
[legend]

Public Member Functions

 atomic_count (long v)
 
long operator++ ()
 
long operator-- ()
 
 operator long () const
 

Private Member Functions

 atomic_count (atomic_count const &)
 
atomic_countoperator= (atomic_count const &)
 

Private Attributes

Mutex m_mutex
 
long m_counter
 

Detailed Description

Atomic count class - consider using interlocked functions.

Definition at line 71 of file AtomicCount.h.

Constructor & Destructor Documentation

◆ atomic_count() [1/2]

FIX::atomic_count::atomic_count ( long  v)
inlineexplicit

Definition at line 74 of file AtomicCount.h.

Referenced by operator long().

74  : m_counter( v )
75  {
76  }

◆ atomic_count() [2/2]

FIX::atomic_count::atomic_count ( atomic_count const &  )
private

Member Function Documentation

◆ operator long()

FIX::atomic_count::operator long ( ) const
inline

Definition at line 90 of file AtomicCount.h.

References atomic_count(), m_counter, and operator=().

91  {
92  return static_cast<long const volatile &>( m_counter );
93  }

◆ operator++()

long FIX::atomic_count::operator++ ( )
inline

Definition at line 78 of file AtomicCount.h.

References m_counter, and m_mutex.

79  {
80  Locker _lock(m_mutex);
81  return ++m_counter;
82  }

◆ operator--()

long FIX::atomic_count::operator-- ( )
inline

Definition at line 84 of file AtomicCount.h.

References m_counter, and m_mutex.

85  {
86  Locker _lock(m_mutex);
87  return --m_counter;
88  }

◆ operator=()

atomic_count& FIX::atomic_count::operator= ( atomic_count const &  )
private

Referenced by operator long().

Member Data Documentation

◆ m_counter

long FIX::atomic_count::m_counter
private

Definition at line 101 of file AtomicCount.h.

Referenced by operator long(), operator++(), and operator--().

◆ m_mutex

Mutex FIX::atomic_count::m_mutex
private

Definition at line 100 of file AtomicCount.h.

Referenced by operator++(), and operator--().


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

Generated on Thu Sep 5 2019 11:07:58 for QuickFIX by doxygen 1.8.13 written by Dimitri van Heesch, © 1997-2001