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

#include <SelfDocumenterFingerprintCalculator.h>

Inheritance diagram for inet::SelfDocumenterFingerprintCalculator:

Public Member Functions

virtual SelfDocumenterFingerprintCalculatordup () const override
 
virtual void addEvent (cEvent *event) override
 

Member Function Documentation

◆ addEvent()

void inet::SelfDocumenterFingerprintCalculator::addEvent ( cEvent *  event)
overridevirtual
21 {
22  if (SelfDoc::generateSelfdoc && event->isMessage()) {
23  cMessage *msg = static_cast<cMessage *>(event);
24  auto ctrl = msg->getControlInfo();
25  auto context = msg->getContextPointer();
26 
27  auto from = msg->getSenderModule();
28  if (msg->isSelfMessage()) {
29  std::ostringstream os;
30  std::string msgName = msg->getName();
31  std::replace_if(msgName.begin(), msgName.end(), isNum, 'N');
32  os << "=SelfDoc={ " << SelfDoc::keyVal("module", from->getComponentType()->getFullName())
33  << ", " << SelfDoc::keyVal("action", "SCHEDULE")
34  << ", " << SelfDoc::val("details") << " : {"
35  << SelfDoc::keyVal("msg", opp_typename(typeid(*msg)))
36  << ", " << SelfDoc::keyVal("kind", SelfDoc::kindToStr(msg->getKind(), from->getProperties(), "selfMessageKinds", nullptr, ""))
37  << ", " << SelfDoc::keyVal("ctrl", ctrl ? opp_typename(typeid(*ctrl)) : "")
38  << ", " << SelfDoc::tagsToJson("tags", msg)
39  << ", " << SelfDoc::keyVal("msgname", msgName)
40  << ", " << SelfDoc::keyVal("context", context ? "filled" : "")
41  << " } }"
42  ;
43  globalSelfDoc.insert(os.str());
44  }
45  else {
46  auto senderGate = msg->getSenderGate();
47  auto arrivalGate = msg->getArrivalGate();
48  if (senderGate == nullptr) {
49  std::ostringstream os;
50  os << "=SelfDoc={ " << SelfDoc::keyVal("module", from->getComponentType()->getFullName())
51  << ", " << SelfDoc::keyVal("action", "OUTPUTDIRECT")
52  << ", " << SelfDoc::val("details") << " : {"
53  << SelfDoc::keyVal("msg", opp_typename(typeid(*msg)))
54  << ", " << SelfDoc::keyVal("kind", SelfDoc::kindToStr(msg->getKind(), from->getProperties(), "directSendKinds", arrivalGate->getProperties(), "messageKinds"))
55  << ", " << SelfDoc::keyVal("ctrl", ctrl ? opp_typename(typeid(*ctrl)) : "")
56  << ", " << SelfDoc::tagsToJson("tags", msg)
57  << " } }"
58  ;
59  globalSelfDoc.insert(os.str());
60  }
61  else {
62  std::ostringstream os;
63  os << "=SelfDoc={ " << SelfDoc::keyVal("module", from->getComponentType()->getFullName())
64  << ", " << SelfDoc::keyVal("action", "OUTPUT")
65  << ", " << SelfDoc::val("details") << " : {"
66  << SelfDoc::keyVal("gate", SelfDoc::gateInfo(senderGate))
67  << ", "<< SelfDoc::keyVal("msg", opp_typename(typeid(*msg)))
68  << ", " << SelfDoc::keyVal("kind", SelfDoc::kindToStr(msg->getKind(), senderGate->getProperties(), "messageKinds", arrivalGate->getProperties(), "messageKinds"))
69  << ", " << SelfDoc::keyVal("ctrl", ctrl ? opp_typename(typeid(*ctrl)) : "")
70  << ", " << SelfDoc::tagsToJson("tags", msg)
71  << " } }"
72  ;
73  globalSelfDoc.insert(os.str());
74  }
75 
76  {
77  std::ostringstream os;
78  auto to = msg->getArrivalModule();
79  os << "=SelfDoc={ " << SelfDoc::keyVal("module", to->getComponentType()->getFullName())
80  << ", " << SelfDoc::keyVal("action", "INPUT")
81  << ", " << SelfDoc::val("details") << " : {"
82  << SelfDoc::keyVal("gate", SelfDoc::gateInfo(arrivalGate))
83  << ", " << SelfDoc::keyVal("msg", opp_typename(typeid(*msg)))
84  << ", " << SelfDoc::keyVal("kind", SelfDoc::kindToStr(msg->getKind(), arrivalGate->getProperties(), "messageKinds", senderGate ? senderGate->getProperties() : nullptr, "messageKinds"))
85  << ", " << SelfDoc::keyVal("ctrl", ctrl ? opp_typename(typeid(*ctrl)) : "")
86  << ", " << SelfDoc::tagsToJson("tags", msg)
87  << " } }"
88  ;
89  globalSelfDoc.insert(os.str());
90  }
91  }
92  }
93  cSingleFingerprintCalculator::addEvent(event);
94 }

◆ dup()

virtual SelfDocumenterFingerprintCalculator* inet::SelfDocumenterFingerprintCalculator::dup ( ) const
inlineoverridevirtual
15 { return new SelfDocumenterFingerprintCalculator(); }

The documentation for this class was generated from the following files:
inet::SelfDoc::keyVal
static std::string keyVal(const std::string &key, const std::string &value)
Definition: SelfDoc.h:34
inet::SelfDoc::generateSelfdoc
static bool generateSelfdoc
Definition: SelfDoc.h:20
ctrl
removed ctrl
Definition: IUdp-gates.txt:7
inet::SelfDoc::tagsToJson
static std::string tagsToJson(const char *key, cMessage *msg)
Definition: SelfDoc.cc:125
inet::SelfDoc::gateInfo
static std::string gateInfo(cGate *gate)
Definition: SelfDoc.cc:148
inet::SelfDoc::kindToStr
static std::string kindToStr(int kind, cProperties *properties1, const char *propName1, cProperties *properties2, const char *propName2)
Definition: SelfDoc.cc:54
inet::globalSelfDoc
SelfDoc globalSelfDoc
Definition: SelfDoc.cc:19
inet::SelfDoc::insert
void insert(const std::string &text)
Definition: SelfDoc.h:25
inet::SelfDoc::val
static std::string val(const char *str)
Definition: SelfDoc.cc:79