Electroneum
el::base::HitCounter Class Reference

Class that keeps record of current line hit for occasional logging. More...

#include <easylogging++.h>

Classes

class  Predicate
 

Public Member Functions

 HitCounter (void)
 
 HitCounter (const char *filename, base::type::LineNumber lineNumber)
 
 HitCounter (const HitCounter &hitCounter)
 
HitCounteroperator= (const HitCounter &hitCounter)
 
virtual ~HitCounter (void)
 
void resetLocation (const char *filename, base::type::LineNumber lineNumber)
 Resets location of current hit counter. More...
 
void validateHitCounts (std::size_t n)
 Validates hit counts and resets it if necessary. More...
 
const char * filename (void) const
 
base::type::LineNumber lineNumber (void) const
 
std::size_t hitCounts (void) const
 
void increment (void)
 

Detailed Description

Class that keeps record of current line hit for occasional logging.

Definition at line 2055 of file easylogging++.h.

Constructor & Destructor Documentation

◆ HitCounter() [1/3]

el::base::HitCounter::HitCounter ( void  )
inline

Definition at line 2057 of file easylogging++.h.

2057  :
2058  m_filename(""),
2059  m_lineNumber(0),
2060  m_hitCounts(0) {
2061  }

◆ HitCounter() [2/3]

el::base::HitCounter::HitCounter ( const char *  filename,
base::type::LineNumber  lineNumber 
)
inline

Definition at line 2063 of file easylogging++.h.

2063  :
2064  m_filename(filename),
2065  m_lineNumber(lineNumber),
2066  m_hitCounts(0) {
2067  }
const char * filename(void) const
base::type::LineNumber lineNumber(void) const

◆ HitCounter() [3/3]

el::base::HitCounter::HitCounter ( const HitCounter hitCounter)
inline

Definition at line 2069 of file easylogging++.h.

2069  :
2070  m_filename(hitCounter.m_filename),
2071  m_lineNumber(hitCounter.m_lineNumber),
2072  m_hitCounts(hitCounter.m_hitCounts) {
2073  }

◆ ~HitCounter()

virtual el::base::HitCounter::~HitCounter ( void  )
inlinevirtual

Definition at line 2084 of file easylogging++.h.

2084  {
2085  }

Member Function Documentation

◆ filename()

const char* el::base::HitCounter::filename ( void  ) const
inline

Definition at line 2101 of file easylogging++.h.

2101  {
2102  return m_filename;
2103  }
Here is the caller graph for this function:

◆ hitCounts()

std::size_t el::base::HitCounter::hitCounts ( void  ) const
inline

Definition at line 2109 of file easylogging++.h.

2109  {
2110  return m_hitCounts;
2111  }

◆ increment()

void el::base::HitCounter::increment ( void  )
inline

Definition at line 2113 of file easylogging++.h.

2113  {
2114  ++m_hitCounts;
2115  }

◆ lineNumber()

base::type::LineNumber el::base::HitCounter::lineNumber ( void  ) const
inline

Definition at line 2105 of file easylogging++.h.

2105  {
2106  return m_lineNumber;
2107  }
Here is the caller graph for this function:

◆ operator=()

HitCounter& el::base::HitCounter::operator= ( const HitCounter hitCounter)
inline

Definition at line 2075 of file easylogging++.h.

2075  {
2076  if (&hitCounter != this) {
2077  m_filename = hitCounter.m_filename;
2078  m_lineNumber = hitCounter.m_lineNumber;
2079  m_hitCounts = hitCounter.m_hitCounts;
2080  }
2081  return *this;
2082  }

◆ resetLocation()

void el::base::HitCounter::resetLocation ( const char *  filename,
base::type::LineNumber  lineNumber 
)
inline

Resets location of current hit counter.

Definition at line 2088 of file easylogging++.h.

2088  {
2089  m_filename = filename;
2090  m_lineNumber = lineNumber;
2091  }
const char * filename(void) const
base::type::LineNumber lineNumber(void) const
Here is the call graph for this function:

◆ validateHitCounts()

void el::base::HitCounter::validateHitCounts ( std::size_t  n)
inline

Validates hit counts and resets it if necessary.

Definition at line 2094 of file easylogging++.h.

2094  {
2095  if (m_hitCounts >= base::consts::kMaxLogPerCounter) {
2096  m_hitCounts = (n >= 1 ? base::consts::kMaxLogPerCounter % n : 0);
2097  }
2098  ++m_hitCounts;
2099  }

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