Orxonox  0.0.5 Codename: Arcturus
Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
orxonox::MemoryWriter Class Reference

MemoryWriter is a singleton which is derived from OutputListener and writes all output to a list. More...

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/util/output/MemoryWriter.h>

Inheritance diagram for orxonox::MemoryWriter:
orxonox::OutputListener

Classes

struct  Message
 A helper struct which is used to store output and its properties. More...
 

Public Member Functions

 MemoryWriter ()
 Constructor, initializes the level mask with all levels activated. More...
 
virtual ~MemoryWriter ()
 Destructor. More...
 
void disable ()
 Unregisters the instance from OutputManager, hence it will not receive any further output. More...
 
void resendOutput (OutputListener *listener) const
 Iterates over all stored output messages and sends them to the OutputListener. More...
 
- Public Member Functions inherited from orxonox::OutputListener
 OutputListener (bool bRegister=true)
 Constructor, initializes the values and registers the instance at OutputManager if requested. More...
 
virtual ~OutputListener ()
 Destructor, unregisters the instance from OutputManager. More...
 
virtual bool acceptsOutput (OutputLevel level, const OutputContextContainer &context) const
 Returns true if this listener accepts output of the given level and context, based on the levels and contexts masks. More...
 
OutputLevel getAdditionalContextsLevelMask () const
 Returns the additional contexts level mask. More...
 
OutputContextMask getAdditionalContextsMask () const
 Returns the additional contexts mask. More...
 
OutputLevel getLevelMask () const
 Returns the level mask. More...
 
void registerListener (AdditionalContextListener *listener)
 Adds a listener to the list. More...
 
void setAdditionalContextsLevelMask (OutputLevel mask)
 Defines the level mask of additional contexts. More...
 
void setAdditionalContextsLevelMax (OutputLevel max)
 Defines the level mask of additional contexts in a way which accepts all output up to the level max. More...
 
void setAdditionalContextsLevelRange (OutputLevel min, OutputLevel max)
 Defines the level mask of additional contexts in a way which accepts all output between the levels min and max. More...
 
virtual void setAdditionalContextsMask (OutputContextMask mask)
 Defines the mask of additional contexts. More...
 
void setLevelMask (OutputLevel mask)
 Defines the level mask. More...
 
void setLevelMax (OutputLevel max)
 Defines the level mask in a way which accepts all output up to the level max. More...
 
void setLevelRange (OutputLevel min, OutputLevel max)
 Defines the level mask in a way which accepts all output between the levels min and max. More...
 
virtual void unfilteredOutput (OutputLevel level, const OutputContextContainer &context, const std::vector< std::string > &lines)
 Called by OutputManager for each line of output, checks if this listener actually accepts this output before it calls the output() function. More...
 
void unregisterListener (AdditionalContextListener *listener)
 Removes a listener from the list. More...
 

Protected Member Functions

virtual void output (OutputLevel level, const OutputContextContainer &context, const std::vector< std::string > &lines) override
 Implementation of the output() function inherited from OutputListener, stores the received output in memory. More...
 
- Protected Member Functions inherited from orxonox::OutputListener
const std::vector< AdditionalContextListener * > & getListeners () const
 

Private Member Functions

 MemoryWriter (const MemoryWriter &)=delete
 
MemoryWriteroperator= (const MemoryWriter &)=delete
 

Private Attributes

std::vector< Messagemessages_
 Stores all output messages from the creation of this instance until disable() is called. More...
 

Detailed Description

MemoryWriter is a singleton which is derived from OutputListener and writes all output to a list.

This list can be used to re-send old output to other instances of OutputListener, e.g. if they were newly created or to re-write the log-file.

Since MemoryWriter receives output of all levels, this means also that all possible output needs to be generated as long as MemoryWriter stays active. Hence disable() should be called as soon as possible.

Constructor & Destructor Documentation

orxonox::MemoryWriter::MemoryWriter ( )

Constructor, initializes the level mask with all levels activated.

orxonox::MemoryWriter::~MemoryWriter ( )
virtual

Destructor.

orxonox::MemoryWriter::MemoryWriter ( const MemoryWriter )
privatedelete

Member Function Documentation

void orxonox::MemoryWriter::disable ( )

Unregisters the instance from OutputManager, hence it will not receive any further output.

MemoryWriter& orxonox::MemoryWriter::operator= ( const MemoryWriter )
privatedelete
void orxonox::MemoryWriter::output ( OutputLevel  level,
const OutputContextContainer context,
const std::vector< std::string > &  lines 
)
overrideprotectedvirtual

Implementation of the output() function inherited from OutputListener, stores the received output in memory.

Implements orxonox::OutputListener.

void orxonox::MemoryWriter::resendOutput ( OutputListener listener) const

Iterates over all stored output messages and sends them to the OutputListener.

Member Data Documentation

std::vector<Message> orxonox::MemoryWriter::messages_
private

Stores all output messages from the creation of this instance until disable() is called.


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