ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
LArSamples::ClassCounts Class Reference

#include <ClassCounts.h>

Collaboration diagram for LArSamples::ClassCounts:

Public Member Functions

 ClassCounts (const TString &name)
 Constructor
More...
 
virtual ~ClassCounts ()
 
const TString & className () const
 
void incrementInstanceCount () const
 
void decrementInstanceCount () const
 
int instanceCount () const
 
 ClassCounts (const TString &name)
 Constructor
More...
 
virtual ~ClassCounts ()
 
const TString & className () const
 
void incrementInstanceCount () const
 
void decrementInstanceCount () const
 
int instanceCount () const
 

Static Public Member Functions

static std::map< TString, int > & counts ()
 
static void incrementInstanceCount (const TString &name)
 
static void decrementInstanceCount (const TString &name)
 
static int instanceCount (const TString &name)
 
static void printCountsTable ()
 
static std::map< TString, int > & counts ()
 
static void incrementInstanceCount (const TString &name)
 
static void decrementInstanceCount (const TString &name)
 
static int instanceCount (const TString &name)
 
static void printCountsTable ()
 

Private Attributes

TString m_className
 

Static Private Attributes

static std::map< TString, int > * m_counts = nullptr
 

Detailed Description

Definition at line 20 of file LArCafJobs/LArCafJobs/ClassCounts.h.

Constructor & Destructor Documentation

◆ ClassCounts() [1/2]

ClassCounts::ClassCounts ( const TString &  name)

Constructor

Definition at line 16 of file ClassCounts.cxx.

18 {
19  counts()[className] = 0;
20 }

◆ ~ClassCounts() [1/2]

ClassCounts::~ClassCounts ( )
virtual

Definition at line 23 of file ClassCounts.cxx.

24 {
25  m_counts->erase(className());
26  if (m_counts->empty()) {
27  delete m_counts;
28  m_counts = nullptr;
29  }
30 }

◆ ClassCounts() [2/2]

LArSamples::ClassCounts::ClassCounts ( const TString &  name)

Constructor

◆ ~ClassCounts() [2/2]

virtual LArSamples::ClassCounts::~ClassCounts ( )
virtual

Member Function Documentation

◆ className() [1/2]

const TString& LArSamples::ClassCounts::className ( ) const
inline

Definition at line 28 of file LArSamplesMon/LArSamplesMon/ClassCounts.h.

28 { return m_className; }

◆ className() [2/2]

const TString& LArSamples::ClassCounts::className ( ) const
inline

Definition at line 29 of file LArCafJobs/LArCafJobs/ClassCounts.h.

29 { return m_className; }

◆ counts() [1/2]

static std::map<TString, int>& LArSamples::ClassCounts::counts ( )
static

◆ counts() [2/2]

std::map< TString, int > & ClassCounts::counts ( )
static

Definition at line 33 of file ClassCounts.cxx.

34 {
35  if (!m_counts) m_counts = new std::map<TString, int>();
36  return *m_counts;
37 }

◆ decrementInstanceCount() [1/4]

void LArSamples::ClassCounts::decrementInstanceCount ( ) const
inline

◆ decrementInstanceCount() [2/4]

void LArSamples::ClassCounts::decrementInstanceCount ( ) const
inline

◆ decrementInstanceCount() [3/4]

static void LArSamples::ClassCounts::decrementInstanceCount ( const TString &  name)
inlinestatic

Definition at line 35 of file LArSamplesMon/LArSamplesMon/ClassCounts.h.

35 { counts()[name]--; }

◆ decrementInstanceCount() [4/4]

static void LArSamples::ClassCounts::decrementInstanceCount ( const TString &  name)
inlinestatic

Definition at line 36 of file LArCafJobs/LArCafJobs/ClassCounts.h.

36 { counts()[name]--; }

◆ incrementInstanceCount() [1/4]

void LArSamples::ClassCounts::incrementInstanceCount ( ) const
inline

◆ incrementInstanceCount() [2/4]

void LArSamples::ClassCounts::incrementInstanceCount ( ) const
inline

◆ incrementInstanceCount() [3/4]

static void LArSamples::ClassCounts::incrementInstanceCount ( const TString &  name)
inlinestatic

Definition at line 34 of file LArSamplesMon/LArSamplesMon/ClassCounts.h.

34 { counts()[name]++; }

◆ incrementInstanceCount() [4/4]

static void LArSamples::ClassCounts::incrementInstanceCount ( const TString &  name)
inlinestatic

Definition at line 35 of file LArCafJobs/LArCafJobs/ClassCounts.h.

35 { counts()[name]++; }

◆ instanceCount() [1/4]

int LArSamples::ClassCounts::instanceCount ( ) const
inline

Definition at line 37 of file LArSamplesMon/LArSamplesMon/ClassCounts.h.

37 { return instanceCount(className()); }

◆ instanceCount() [2/4]

int LArSamples::ClassCounts::instanceCount ( ) const
inline

Definition at line 38 of file LArCafJobs/LArCafJobs/ClassCounts.h.

38 { return instanceCount(className()); }

◆ instanceCount() [3/4]

static int LArSamples::ClassCounts::instanceCount ( const TString &  name)
inlinestatic

Definition at line 38 of file LArSamplesMon/LArSamplesMon/ClassCounts.h.

38 { return m_counts ? (*m_counts)[name] : 0; }

◆ instanceCount() [4/4]

static int LArSamples::ClassCounts::instanceCount ( const TString &  name)
inlinestatic

Definition at line 39 of file LArCafJobs/LArCafJobs/ClassCounts.h.

39 { return m_counts ? (*m_counts)[name] : 0; }

◆ printCountsTable() [1/2]

static void LArSamples::ClassCounts::printCountsTable ( )
static

◆ printCountsTable() [2/2]

void ClassCounts::printCountsTable ( )
static

Definition at line 40 of file ClassCounts.cxx.

41 {
42  cout << "Class instance counts : " << endl;
43  if (!m_counts) return;
44  for (const std::pair<const TString, int>& p : counts())
45  cout << Form("%20s : %-d", p.first.Data(), p.second) << endl;
46 }

Member Data Documentation

◆ m_className

TString ClassCounts::m_className
private

Definition at line 45 of file LArCafJobs/LArCafJobs/ClassCounts.h.

◆ m_counts

static std::map< TString, int > * ClassCounts::m_counts = nullptr
staticprivate

Definition at line 46 of file LArCafJobs/LArCafJobs/ClassCounts.h.


The documentation for this class was generated from the following files:
LArSamples::ClassCounts::m_className
TString m_className
Definition: LArCafJobs/LArCafJobs/ClassCounts.h:45
LArSamples::ClassCounts::m_counts
static std::map< TString, int > * m_counts
Definition: LArCafJobs/LArCafJobs/ClassCounts.h:46
LArSamples::ClassCounts::instanceCount
int instanceCount() const
Definition: LArCafJobs/LArCafJobs/ClassCounts.h:38
LArSamples::ClassCounts::counts
static std::map< TString, int > & counts()
Definition: ClassCounts.cxx:33
LArSamples::ClassCounts::className
const TString & className() const
Definition: LArCafJobs/LArCafJobs/ClassCounts.h:29
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
LArSamples::ClassCounts::decrementInstanceCount
void decrementInstanceCount() const
Definition: LArCafJobs/LArCafJobs/ClassCounts.h:33
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
LArSamples::ClassCounts::incrementInstanceCount
void incrementInstanceCount() const
Definition: LArCafJobs/LArCafJobs/ClassCounts.h:32