OMNeT++ API 6.1
Discrete Event Simulation Library
cmessageprinter.h
1 //==========================================================================
2 // CMESSAGEPRINTER.H - part of
3 // OMNeT++/OMNEST
4 // Discrete System Simulation in C++
5 //
6 //==========================================================================
7 
8 /*--------------------------------------------------------------*
9  Copyright (C) 1992-2017 Andras Varga
10  Copyright (C) 2006-2017 OpenSim Ltd.
11 
12  This file is distributed WITHOUT ANY WARRANTY. See the file
13  `license' for details on this and other legal matters.
14 *--------------------------------------------------------------*/
15 
16 #ifndef __OMNETPP_CMESSAGEPRINTER_H
17 #define __OMNETPP_CMESSAGEPRINTER_H
18 
19 #include <set>
20 #include <vector>
21 #include "cownedobject.h"
22 
23 namespace omnetpp {
24 
25 class cMessage;
26 
49 {
50  public:
54  struct Options {
55  std::set<std::string> enabledTags;
56  };
57 
58  public:
63 
67  virtual ~cMessagePrinter() {}
68 
77  virtual int getScoreFor(cMessage *msg) const = 0;
78 
87  virtual std::set<std::string> getSupportedTags() const {return {};}
88 
93  virtual std::set<std::string> getDefaultEnabledTags() const {return {};}
94 
101  virtual std::vector<std::string> getColumnNames(const Options *options) const {(void)options; return {};}
102 
110  virtual void printMessage(std::ostream& os, cMessage *msg, const Options *options) const = 0;
111 };
112 
121 {
122  public:
124  virtual ~cDefaultMessagePrinter() {}
125  virtual int getScoreFor(cMessage *msg) const override;
126 
127  virtual std::set<std::string> getSupportedTags() const override;
128  virtual std::set<std::string> getDefaultEnabledTags() const override;
129  virtual std::vector<std::string> getColumnNames(const Options *options) const override;
130 
131  virtual void printMessage(std::ostream& os, cMessage *msg, const Options *options) const override;
132 };
133 
134 } // namespace omnetpp
135 
136 #endif
137 
138 
omnetpp::cMessagePrinter::getDefaultEnabledTags
virtual std::set< std::string > getDefaultEnabledTags() const
Definition: cmessageprinter.h:93
omnetpp::cMessagePrinter::cMessagePrinter
cMessagePrinter()
Definition: cmessageprinter.h:62
omnetpp::cDefaultMessagePrinter
A default message printer that displays the ID, kind, and length (for packets) of the message.
Definition: cmessageprinter.h:120
omnetpp::cMessagePrinter
Base class for message printers.
Definition: cmessageprinter.h:48
omnetpp::cMessagePrinter::getColumnNames
virtual std::vector< std::string > getColumnNames(const Options *options) const
Definition: cmessageprinter.h:101
omnetpp::cMessagePrinter::Options
Definition: cmessageprinter.h:54
omnetpp::cMessagePrinter::getSupportedTags
virtual std::set< std::string > getSupportedTags() const
Definition: cmessageprinter.h:87
omnetpp::cMessage
The message class in OMNeT++. cMessage objects may represent events, messages, jobs or other entities...
Definition: cmessage.h:95
omnetpp::cNoncopyableOwnedObject
Base class for cOwnedObject-based classes that do not wish to support assignment and duplication.
Definition: cownedobject.h:242
omnetpp::cMessagePrinter::~cMessagePrinter
virtual ~cMessagePrinter()
Definition: cmessageprinter.h:67