Scroom  0.14
Scroom::Utils::Count Class Reference

#include <utilities.hh>

Collaboration diagram for Scroom::Utils::Count:
Collaboration graph

Public Types

using Ptr = boost::shared_ptr< Count >
 

Public Member Functions

void ping ()
 
void inc ()
 
void dec ()
 

Static Public Member Functions

static Ptr create (const std::string &name)
 

Public Attributes

const std::string name
 
boost::mutex mut
 
long count {0}
 

Private Member Functions

 Count (std::string name)
 

Member Typedef Documentation

◆ Ptr

using Scroom::Utils::Count::Ptr = boost::shared_ptr<Count>

Constructor & Destructor Documentation

◆ Count()

Count::Count ( std::string  name)
explicitprivate
34  : name(std::move(name_))
35 
36 {
37 }

Referenced by create().

Here is the caller graph for this function:

Member Function Documentation

◆ create()

Count::Ptr Count::create ( const std::string &  name)
static
40 {
41  Ptr result = Ptr(new Count(name));
43  return result;
44 }

Referenced by Scroom::Utils::Counted< TestCounted >::count_instance().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dec()

void Scroom::Utils::Count::dec ( )
inline
148  {
149  boost::unique_lock<boost::mutex> const lock(mut);
150  --count;
151  ping();
152  }
Here is the call graph for this function:

◆ inc()

void Scroom::Utils::Count::inc ( )
inline
142  {
143  boost::unique_lock<boost::mutex> const lock(mut);
144  ++count;
145  ping();
146  }
Here is the call graph for this function:

◆ ping()

void Scroom::Utils::Count::ping ( )
inline
139  { /* dumpCounts(); */
140  }

Referenced by dec(), and inc().

Here is the caller graph for this function:

Member Data Documentation

◆ count

long Scroom::Utils::Count::count {0}

Referenced by dec(), and inc().

◆ mut

boost::mutex Scroom::Utils::Count::mut

Referenced by dec(), and inc().

◆ name

const std::string Scroom::Utils::Count::name

Referenced by create().


The documentation for this class was generated from the following files:
Scroom::Utils::Count::Ptr
boost::shared_ptr< Count > Ptr
Definition: utilities.hh:129
Scroom::Utils::Counter::registerCount
void registerCount(const Count::Ptr &count)
Definition: counter.cc:56
Scroom::Utils::Counter::instance
static Counter * instance()
Definition: counter.cc:48
Scroom::Utils::Count::ping
void ping()
Definition: utilities.hh:138
Scroom::Utils::Count::name
const std::string name
Definition: utilities.hh:132
Scroom::Utils::Count::count
long count
Definition: utilities.hh:134
Scroom::Utils::Count::Count
Count(std::string name)
Definition: counter.cc:33
Scroom::Utils::Count::mut
boost::mutex mut
Definition: utilities.hh:133