ewmscp  ..
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
counterType Class Reference
Collaboration diagram for counterType:
[legend]

Classes

class  itemDescriptor
 

Public Types

enum  specials : unsigned char { denied = 253, noent = 254, notdir = 255 }
 

Public Member Functions

 counterType ()
 
void count (unsigned char what)
 
void sum (counterType &other)
 
void print ()
 

Static Public Member Functions

static void init ()
 

Static Private Member Functions

static const std::vector< itemDescriptor > & keyToName ()
 

Private Attributes

std::array< uint64_t, 256 > counters
 

Detailed Description

Definition at line 70 of file dirCount.cpp.

Member Enumeration Documentation

◆ specials

enum counterType::specials : unsigned char
Enumerator
denied 
noent 
notdir 

Definition at line 72 of file dirCount.cpp.

72  : unsigned char {
73  denied = 253,
74  noent = 254,
75  notdir = 255
76  };

Constructor & Destructor Documentation

◆ counterType()

counterType::counterType ( )
inline

Definition at line 112 of file dirCount.cpp.

112 : counters{0} {};

Member Function Documentation

◆ count()

void counterType::count ( unsigned char  what)
inline

Definition at line 116 of file dirCount.cpp.

116  {
117  counters[what]++;
118  }

References counters.

Referenced by handleDir(), and runnerType::process().

Here is the caller graph for this function:

◆ init()

static void counterType::init ( )
inlinestatic

Definition at line 113 of file dirCount.cpp.

113  {
114  keyToName();
115  }

References keyToName().

Referenced by main().

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

◆ keyToName()

static const std::vector<itemDescriptor>& counterType::keyToName ( )
inlinestaticprivate

Definition at line 95 of file dirCount.cpp.

95  {
96  const static std::vector<itemDescriptor> kTN{
97  {DT_BLK, "blockDevice", 'b'},
98  {DT_CHR, "characterDevice", 'c'},
99  {DT_DIR, "directory", 'd'},
100  {DT_FIFO, "fifo", 'p'},
101  {DT_LNK, "symlink", 'l'},
102  {DT_REG, "file", 'f'},
103  {DT_SOCK, "socket", 's'},
104  {DT_UNKNOWN, "unknown", 'u'},
105  {specials::denied, "accesDenied", 'D'},
106  {specials::noent, "noSuchFile", 'M'},
107  {specials::notdir, "notADirectory", 'N'}
108  };
109  return kTN;
110  }

Referenced by init(), print(), and sum().

Here is the caller graph for this function:

◆ print()

void counterType::print ( )
inline

Definition at line 124 of file dirCount.cpp.

124  {
125  bool printAll(true);
126  for (const auto& item : keyToName()) {
127  if (*item.option) {
128  printAll = false;
129  }
130  }
131  for (const auto& item : keyToName()) {
132  if (printAll || *item.option) {
133  if (!quiet) {
134  std::cout << item.name << " ";
135  }
136  std::cout << counters[item.index] << "\n";
137  }
138  }
139  }

References counters, keyToName(), and quiet.

Referenced by main().

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

◆ sum()

void counterType::sum ( counterType other)
inline

Definition at line 119 of file dirCount.cpp.

119  {
120  for (const auto& item : keyToName()) {
121  other.counters[item.index] += counters[item.index];
122  }
123  }

References counters, and keyToName().

Referenced by runnerType::sum().

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

Member Data Documentation

◆ counters

std::array<uint64_t, 256> counterType::counters
private

Definition at line 94 of file dirCount.cpp.

Referenced by count(), print(), and sum().


The documentation for this class was generated from the following file:
counterType::keyToName
static const std::vector< itemDescriptor > & keyToName()
Definition: dirCount.cpp:95
counterType::counters
std::array< uint64_t, 256 > counters
Definition: dirCount.cpp:94
counterType::notdir
@ notdir
Definition: dirCount.cpp:75
counterType::noent
@ noent
Definition: dirCount.cpp:74
quiet
static options::single< bool > quiet('q', "quiet", "be quiet, no prefix to output lines")
counterType::denied
@ denied
Definition: dirCount.cpp:73