OMNeT++ Simulation Library  6.0.3
cMessagePrinter Class Referenceabstract

#include <cmessageprinter.h>

Description

Base class for message printers.

Message printers is a somewhat experimental feature, intended at giving models a way to control how network packets or in general, cMessage objects) are displayed. Currently, message printer output is used for the Messages mode display of the Log viewer in Qtenv.

Several message printers may be registered (with Register_MessagePrinter()), independent of each other, and OMNeT++ will choose the "best" or most specific one for each message object. The best one is decided based on scoring: every message printer will be polled by passing the message object to its getScoreFor() method, and the message printer returning the highest score will "win".

OMNeT++ calls printMessage() to obtain information to be displayed about a message.

See also
Register_MessagePrinter()
Inheritance diagram for cMessagePrinter:
cNoncopyableOwnedObject cOwnedObject noncopyable cNamedObject cObject cDefaultMessagePrinter

Classes

struct  Options
 

Public Member Functions

 cMessagePrinter ()
 
virtual ~cMessagePrinter ()
 
virtual int getScoreFor (cMessage *msg) const =0
 
virtual std::set< std::string > getSupportedTags () const
 
virtual std::set< std::string > getDefaultEnabledTags () const
 
virtual std::vector< std::string > getColumnNames (const Options *options) const
 
virtual void printMessage (std::ostream &os, cMessage *msg, const Options *options) const =0
 
- Public Member Functions inherited from cNoncopyableOwnedObject
 cNoncopyableOwnedObject (const char *name=nullptr, bool namepooling=true)
 
virtual cNoncopyableOwnedObjectdup () const override
 
- Public Member Functions inherited from cOwnedObject
 cOwnedObject ()
 
 cOwnedObject (const char *name, bool namepooling=true)
 
 cOwnedObject (const cOwnedObject &obj)
 
virtual ~cOwnedObject ()
 
cOwnedObjectoperator= (const cOwnedObject &o)
 
virtual cObjectgetOwner () const override
 
virtual bool isOwnedObject () const override
 
- Public Member Functions inherited from cNamedObject
 cNamedObject ()
 
 cNamedObject (const char *name, bool namepooling=true)
 
 cNamedObject (const cNamedObject &obj)
 
virtual ~cNamedObject ()
 
cNamedObjectoperator= (const cNamedObject &o)
 
virtual void setName (const char *s)
 
virtual const char * getName () const override
 
virtual void setNamePooling (bool b)
 
virtual bool getNamePooling ()
 
- Public Member Functions inherited from cObject
 cObject ()
 
 cObject (const cObject &other)=default
 
virtual ~cObject ()
 
virtual const char * getClassName () const
 
bool isName (const char *s) const
 
virtual const char * getFullName () const
 
virtual std::string getFullPath () const
 
virtual std::string getClassAndFullName () const
 
virtual std::string getClassAndFullPath () const
 
const cObjectgetThisPtr () const
 
virtual std::string str () const
 
virtual std::ostream & printOn (std::ostream &os) const
 
virtual bool isSoftOwner () const
 
virtual void forEachChild (cVisitor *v)
 
cObjectfindObject (const char *name, bool deep=true)
 
virtual cClassDescriptorgetDescriptor () const
 
void copyNotSupported () const
 

Additional Inherited Members

- Static Public Member Functions inherited from cOwnedObject
static long getTotalObjectCount ()
 
static long getLiveObjectCount ()
 
static void resetObjectCounters ()
 
static cSoftOwnergetOwningContext ()
 
- Protected Member Functions inherited from cObject
virtual void take (cOwnedObject *obj)
 
virtual void drop (cOwnedObject *obj)
 
void dropAndDelete (cOwnedObject *obj)
 

Constructor & Destructor Documentation

◆ cMessagePrinter()

cMessagePrinter ( )
inline

Constructor

◆ ~cMessagePrinter()

virtual ~cMessagePrinter ( )
inlinevirtual

Destructor

Member Function Documentation

◆ getScoreFor()

virtual int getScoreFor ( cMessage msg) const
pure virtual

Scoring function that lets OMNeT++ decide which message printer to use for a particular message object. The "better", more specific the message printer is for that message, the higher score it should return. Guideline: 0 or negative: does not support this message; 10: returned by cDefaultMessagePrinter

Implemented in cDefaultMessagePrinter.

◆ getSupportedTags()

virtual std::set<std::string> getSupportedTags ( ) const
inlinevirtual

Returns the tags supported by this printer.

Note
These are normally presented to the user on the graphical interfaces unmodified, and there are no constraints on the format or content of the tags, so for example using "Show 'Details' column" is preferred to using "col_details".

Reimplemented in cDefaultMessagePrinter.

◆ getDefaultEnabledTags()

virtual std::set<std::string> getDefaultEnabledTags ( ) const
inlinevirtual

Returns the list of tags that this printer recommends to enable by default. The result must only contain tags that are also returned by "getSupportedTags()".

Reimplemented in cDefaultMessagePrinter.

◆ getColumnNames()

virtual std::vector<std::string> getColumnNames ( const Options options) const
inlinevirtual

Returns column names for the specified options. The options parameter should never be nullptr. The list of enabled tags in "options" may contain tags not known or supported by this printer. Those should be silently ignored.

Reimplemented in cDefaultMessagePrinter.

◆ printMessage()

virtual void printMessage ( std::ostream &  os,
cMessage msg,
const Options options 
) const
pure virtual

Print a single-line text about the message object into the given output stream. Use Tab characters to separate columns. Splitting the text into more or fewer columns than returned by getColumnNames is allowed, but being consistent with those is highly recommended. The options parameter should never be nullptr.

Implemented in cDefaultMessagePrinter.


The documentation for this class was generated from the following file: