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, long l, cObject *details) override
 
virtual void receiveSignal (cResultFilter *prev, simtime_t_cref t, unsigned long 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

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

Member Function Documentation

void inet::GroupCountRecorder::collect ( std::string  val)
protectedvirtual

Referenced by receiveSignal().

25  {
26  groupcounts[value]++;
27 }
std::map< std::string, long > groupcounts
Definition: ResultRecorders.h:32
void inet::GroupCountRecorder::finish ( cResultFilter *  prev)
overridevirtual
63  {
64  opp_string_map attributes = getStatisticAttributes();
65 
66  for(auto & elem : groupcounts) {
67  std::stringstream name;
68  name << getResultName().c_str() << ":" << elem.first;
69  getEnvir()->recordScalar(getComponent(), name.str().c_str(), elem.second, &attributes); // note: this is NaN if count==0
70  }
71 }
std::map< std::string, long > groupcounts
Definition: ResultRecorders.h:32
void inet::GroupCountRecorder::receiveSignal ( cResultFilter *  prev,
simtime_t_cref  t,
bool  b,
cObject *  details 
)
overrideprotectedvirtual
29  {
30  collect(b ? "true" : "false");
31 }
virtual void collect(std::string val)
Definition: ResultRecorders.cc:25
value< double, units::m > b
Definition: Units.h:1054
void inet::GroupCountRecorder::receiveSignal ( cResultFilter *  prev,
simtime_t_cref  t,
long  l,
cObject *  details 
)
overrideprotectedvirtual
33  {
34  std::stringstream s;
35  s << l;
36  collect(s.str());
37 }
virtual void collect(std::string val)
Definition: ResultRecorders.cc:25
value< double, units::s > s
Definition: Units.h:1049
void inet::GroupCountRecorder::receiveSignal ( cResultFilter *  prev,
simtime_t_cref  t,
unsigned long  l,
cObject *  details 
)
overrideprotectedvirtual
39  {
40  std::stringstream s;
41  s << l;
42  collect(s.str());
43 }
virtual void collect(std::string val)
Definition: ResultRecorders.cc:25
value< double, units::s > s
Definition: Units.h:1049
void inet::GroupCountRecorder::receiveSignal ( cResultFilter *  prev,
simtime_t_cref  t,
double  d,
cObject *  details 
)
overrideprotectedvirtual
45  {
46  std::stringstream s;
47  s << d;
48  collect(s.str());
49 }
virtual void collect(std::string val)
Definition: ResultRecorders.cc:25
value< double, units::s > s
Definition: Units.h:1049
void inet::GroupCountRecorder::receiveSignal ( cResultFilter *  prev,
simtime_t_cref  t,
const SimTime &  v,
cObject *  details 
)
overrideprotectedvirtual
51  {
52  collect(v.str());
53 }
virtual void collect(std::string val)
Definition: ResultRecorders.cc:25
void inet::GroupCountRecorder::receiveSignal ( cResultFilter *  prev,
simtime_t_cref  t,
const char *  s,
cObject *  details 
)
overrideprotectedvirtual
55  {
56  collect(s);
57 }
virtual void collect(std::string val)
Definition: ResultRecorders.cc:25
value< double, units::s > s
Definition: Units.h:1049
void inet::GroupCountRecorder::receiveSignal ( cResultFilter *  prev,
simtime_t_cref  t,
cObject *  obj,
cObject *  details 
)
overrideprotectedvirtual
59  {
60  collect(obj->getFullPath());
61 }
virtual void collect(std::string val)
Definition: ResultRecorders.cc:25

Member Data Documentation

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: