INET Framework for OMNeT++/OMNEST
inet::GroupCountRecorder Class Reference

Listener for counting the occurrences of signals with the same attribute. More...

#include <ResultRecorders.h>

Inheritance diagram for inet::GroupCountRecorder:

Public Member Functions

 GroupCountRecorder ()
 
virtual void finish (cResultFilter *prev) override
 

Protected Member Functions

virtual void collect (std::string val)
 
virtual void receiveSignal (cResultFilter *prev, simtime_t_cref t, bool b, cObject *details) override
 
virtual void receiveSignal (cResultFilter *prev, simtime_t_cref t, intval_t l, cObject *details) override
 
virtual void receiveSignal (cResultFilter *prev, simtime_t_cref t, uintval_t l, cObject *details) override
 
virtual void receiveSignal (cResultFilter *prev, simtime_t_cref t, double d, cObject *details) override
 
virtual void receiveSignal (cResultFilter *prev, simtime_t_cref t, const SimTime &v, cObject *details) override
 
virtual void receiveSignal (cResultFilter *prev, simtime_t_cref t, const char *s, cObject *details) override
 
virtual void receiveSignal (cResultFilter *prev, simtime_t_cref t, cObject *obj, cObject *details) override
 

Protected Attributes

std::map< std::string, long > groupcounts
 

Detailed Description

Listener for counting the occurrences of signals with the same attribute.

Constructor & Destructor Documentation

◆ GroupCountRecorder()

inet::GroupCountRecorder::GroupCountRecorder ( )
inline
35 {}

Member Function Documentation

◆ collect()

void inet::GroupCountRecorder::collect ( std::string  val)
protectedvirtual
16  {
17  groupcounts[value]++;
18 }

Referenced by receiveSignal().

◆ finish()

void inet::GroupCountRecorder::finish ( cResultFilter *  prev)
overridevirtual
54  {
55  opp_string_map attributes = getStatisticAttributes();
56 
57  for (auto& elem : groupcounts) {
58  std::stringstream name;
59  name << getResultName().c_str() << ":" << elem.first;
60  getEnvir()->recordScalar(getComponent(), name.str().c_str(), elem.second, &attributes); // note: this is NaN if count==0
61  }
62 }

◆ receiveSignal() [1/7]

void inet::GroupCountRecorder::receiveSignal ( cResultFilter *  prev,
simtime_t_cref  t,
bool  b,
cObject *  details 
)
overrideprotectedvirtual
20  {
21  collect(b ? "true" : "false");
22 }

◆ receiveSignal() [2/7]

void inet::GroupCountRecorder::receiveSignal ( cResultFilter *  prev,
simtime_t_cref  t,
cObject *  obj,
cObject *  details 
)
overrideprotectedvirtual
50  {
51  collect(obj->getFullPath());
52 }

◆ receiveSignal() [3/7]

void inet::GroupCountRecorder::receiveSignal ( cResultFilter *  prev,
simtime_t_cref  t,
const char *  s,
cObject *  details 
)
overrideprotectedvirtual
46  {
47  collect(s);
48 }

◆ receiveSignal() [4/7]

void inet::GroupCountRecorder::receiveSignal ( cResultFilter *  prev,
simtime_t_cref  t,
const SimTime &  v,
cObject *  details 
)
overrideprotectedvirtual
42  {
43  collect(v.str());
44 }

◆ receiveSignal() [5/7]

void inet::GroupCountRecorder::receiveSignal ( cResultFilter *  prev,
simtime_t_cref  t,
double  d,
cObject *  details 
)
overrideprotectedvirtual
36  {
37  std::stringstream s;
38  s << d;
39  collect(s.str());
40 }

◆ receiveSignal() [6/7]

void inet::GroupCountRecorder::receiveSignal ( cResultFilter *  prev,
simtime_t_cref  t,
intval_t  l,
cObject *  details 
)
overrideprotectedvirtual
24  {
25  std::stringstream s;
26  s << l;
27  collect(s.str());
28 }

◆ receiveSignal() [7/7]

void inet::GroupCountRecorder::receiveSignal ( cResultFilter *  prev,
simtime_t_cref  t,
uintval_t  l,
cObject *  details 
)
overrideprotectedvirtual
30  {
31  std::stringstream s;
32  s << l;
33  collect(s.str());
34 }

Member Data Documentation

◆ groupcounts

std::map<std::string, long> inet::GroupCountRecorder::groupcounts
protected

Referenced by collect(), and finish().


The documentation for this class was generated from the following files:
inet::GroupCountRecorder::collect
virtual void collect(std::string val)
Definition: ResultRecorders.cc:16
inet::units::values::s
value< double, units::s > s
Definition: Units.h:1235
inet::units::values::b
value< int64_t, units::b > b
Definition: Units.h:1241
inet::GroupCountRecorder::groupcounts
std::map< std::string, long > groupcounts
Definition: ResultRecorders.h:22