Jpp  17.2.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
Log::Counter Class Reference

#include <log.hh>

Public Member Functions

void add (std::string const &tag)
 
void reset ()
 
void reset (std::string const &tag)
 

Static Public Member Functions

static Counterget ()
 

Private Types

typedef std::map< std::string,
unsigned int > 
container_t
 

Private Member Functions

 Counter ()
 
 Counter (Counter const &)
 
Counteroperator= (Counter const &)
 

Private Attributes

container_t m_counters
 
boost::mutex m_mutex
 

Friends

std::ostream & operator<< (std::ostream &stream, Counter const &c)
 

Detailed Description

Definition at line 38 of file log.hh.

Member Typedef Documentation

typedef std::map< std::string, unsigned int> Log::Counter::container_t
private

Definition at line 40 of file log.hh.

Constructor & Destructor Documentation

Log::Counter::Counter ( )
inlineprivate

Definition at line 45 of file log.hh.

45 {}
Log::Counter::Counter ( Counter const &  )
private

Member Function Documentation

Counter& Log::Counter::operator= ( Counter const &  )
private
static Counter& Log::Counter::get ( )
inlinestatic

Definition at line 53 of file log.hh.

54  {
55  static Counter c;
56 
57  return c;
58  }
Counter()
Definition: log.hh:45
$WORKDIR ev_configure_domsimulator txt echo process $DOM_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DOM_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'
void Log::Counter::add ( std::string const &  tag)
inline

Definition at line 60 of file log.hh.

61  {
62  boost::mutex::scoped_lock lock(m_mutex);
63 
64  container_t::iterator const it = m_counters.find(tag);
65 
66  if (it != m_counters.end()) {
67  ++it->second;
68  } else {
69  m_counters.insert(std::make_pair(tag, 1));
70  }
71  }
container_t m_counters
Definition: log.hh:42
boost::mutex m_mutex
Definition: log.hh:43
void Log::Counter::reset ( )
inline

Definition at line 73 of file log.hh.

74  {
75  boost::mutex::scoped_lock lock(m_mutex);
76  m_counters.clear();
77  }
container_t m_counters
Definition: log.hh:42
boost::mutex m_mutex
Definition: log.hh:43
void Log::Counter::reset ( std::string const &  tag)
inline

Definition at line 79 of file log.hh.

80  {
81  boost::mutex::scoped_lock lock(m_mutex);
82 
83  container_t::iterator const it = m_counters.find(tag);
84 
85  if (it != m_counters.end()) {
86  it->second = 0;
87  }
88  }
container_t m_counters
Definition: log.hh:42
boost::mutex m_mutex
Definition: log.hh:43

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  stream,
Counter const &  c 
)
friend

Definition at line 91 of file log.hh.

92  {
93  boost::mutex::scoped_lock lock(c.m_mutex);
94 
95  for (
96  container_t::const_iterator it = c.m_counters.begin(), et = c.m_counters.end();
97  it != et;
98  ++it
99  ) {
100  stream << it->first << ": " << it->second << ", ";
101  }
102 
103  return stream;
104  }
$WORKDIR ev_configure_domsimulator txt echo process $DOM_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DOM_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'

Member Data Documentation

container_t Log::Counter::m_counters
private

Definition at line 42 of file log.hh.

boost::mutex Log::Counter::m_mutex
mutableprivate

Definition at line 43 of file log.hh.


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