gramods
Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
gramods::gmCore::MessageSink Class Referenceabstract

This is the base type for back-ends taking care of information sent to the Console class. More...

#include <MessageSink.hh>

Inheritance diagram for gramods::gmCore::MessageSink:
Inheritance graph
[legend]
Collaboration diagram for gramods::gmCore::MessageSink:
Collaboration graph
[legend]

Classes

struct  Message
 

Public Member Functions

virtual void initialize () override
 Called to initialize the MessageSink. More...
 
void setShowTime (bool on)
 Activate or deactivate the output of the time of each message. More...
 
virtual void output (Message msg)=0
 Outputs the provided message to the implementation specific channel. More...
 
- Public Member Functions inherited from gramods::gmCore::Object
 Object ()
 Initializes internal data. More...
 
virtual ~Object ()
 Cleaning up internal data. More...
 
virtual void accept (Visitor *visitor)
 Calls the visitors apply method with this as argument. More...
 
virtual void traverse (Visitor *visitor)
 Calls the child Object's accept method, if such exist. More...
 
virtual std::string getDefaultKey ()
 Returns the default key for the Object when automatically instantiated in a Configuration, i.e. More...
 
bool isInitialized ()
 Returns true if the Object is initialized. More...
 

Static Public Attributes

static gramods::gmCore::OFactory::OFactoryInformation _gm_ofi
 

Protected Member Functions

void outputMetadata (std::ostream &out, Message msg)
 Write metadata from the specified message to the specified stream. More...
 

Detailed Description

This is the base type for back-ends taking care of information sent to the Console class.

A sink will register itself as a sink of the Console class upon initialization. To remove a registered message sink, call removeSink or removeAllSinks to remove all sinks.

Member Function Documentation

◆ initialize()

void gramods::gmCore::MessageSink::initialize ( )
overridevirtual

Called to initialize the MessageSink.

This should be called once only!

Reimplemented from gramods::gmCore::Object.

◆ output()

virtual void gramods::gmCore::MessageSink::output ( Message  msg)
pure virtual

Outputs the provided message to the implementation specific channel.

This method may be called concurrently from multiple thread and must therefore be thread safe.

Implemented in gramods::gmCore::NullMessageSink, gramods::gmCore::OStreamMessageSink, and gramods::gmCore::LogFileMessageSink.

◆ outputMetadata()

void gramods::gmCore::MessageSink::outputMetadata ( std::ostream &  out,
Message  msg 
)
protected

Write metadata from the specified message to the specified stream.

◆ setShowTime()

gramods::gmCore::OFactory::ParamSetterInsert gm_ofi_MessageSink_param_showTime &MessageSink::_gm_ofi(& gramods::gmCore::MessageSink::setShowTime ( bool  on)
inline

Activate or deactivate the output of the time of each message.

Default is false, not showing time.

XML-attribute: showTime


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