Orxonox
0.0.5 Codename: Arcturus
|
OutputListener is an interface which is used to receive output of a certain level and context from OutputManager. More...
#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/util/output/OutputListener.h>
Public Member Functions | |
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 | |
const std::vector< AdditionalContextListener * > & | getListeners () const |
virtual void | output (OutputLevel level, const OutputContextContainer &context, const std::vector< std::string > &lines)=0 |
Pure virtual function, needs to be implemented in order to receive output. More... | |
Private Attributes | |
OutputLevel | additionalContextsLevelMask_ |
Mask of accepted output levels of the additional contexts. More... | |
OutputContextMask | additionalContextsMask_ |
Mask of accepted additional contexts. More... | |
OutputLevel | levelMask_ |
Mask of accepted output levels, independent of contexts. More... | |
std::vector< AdditionalContextListener * > | listeners_ |
List of all registered additional context listeners. More... | |
OutputListener is an interface which is used to receive output of a certain level and context from OutputManager.
An instance of OutputListener registers itself at OutputManager and declares the desired output levels and contexts.
OutputManager will then send output to it by calling the output() function.
OutputListener has 3 masks to define the desired output. These masks can be used in two different ways (or as a combination of both):
This can be illustrated as follows:
| Contexts: | | A | B | C | D | --------|---|---|---|---| debug | - | - | - | - | --------|---|---|---|---| error | x | x | x | x | --------|---|---|---|---| [x] Receives output warning | x | x | x | x | [-] Does not receive output --------|---|---|---|---| status | - | - | - | - | --------|---|---|---|---| verbose | - | - | - | - | --------|---|---|---|---|
| Contexts: | | A | B | C | D | --------|---|---|---|---| debug | - | x | - | x | --------|---|---|---|---| error | - | - | - | - | --------|---|---|---|---| [x] Receives output warning | - | - | - | - | [-] Does not receive output --------|---|---|---|---| status | - | - | - | - | --------|---|---|---|---| verbose | - | x | - | x | --------|---|---|---|---|
| Contexts: | | A | B | C | D | --------|---|---|---|---| debug | - | x | - | x | --------|---|---|---|---| error | x | x | x | x | --------|---|---|---|---| [x] Receives output warning | x | x | x | x | [-] Does not receive output --------|---|---|---|---| status | - | - | - | - | --------|---|---|---|---| verbose | - | x | - | x | --------|---|---|---|---|
orxonox::OutputListener::OutputListener | ( | bool | bRegister = true | ) |
Constructor, initializes the values and registers the instance at OutputManager if requested.
bRegister | If true , the instance is automatically registered at OutputManager. Should be false if the constructor of the derived class generates output. |
|
virtual |
Destructor, unregisters the instance from OutputManager.
|
virtual |
Returns true if this listener accepts output of the given level and context, based on the levels and contexts masks.
Reimplemented in orxonox::SubcontextOutputListener.
|
inline |
Returns the additional contexts level mask.
|
inline |
Returns the additional contexts mask.
|
inline |
Returns the level mask.
|
inlineprotected |
|
protectedpure virtual |
Pure virtual function, needs to be implemented in order to receive output.
Implemented in orxonox::BaseWriter, and orxonox::MemoryWriter.
void orxonox::OutputListener::registerListener | ( | AdditionalContextListener * | listener | ) |
Adds a listener to the list.
void orxonox::OutputListener::setAdditionalContextsLevelMask | ( | OutputLevel | mask | ) |
Defines the level mask of additional contexts.
void orxonox::OutputListener::setAdditionalContextsLevelMax | ( | OutputLevel | max | ) |
Defines the level mask of additional contexts in a way which accepts all output up to the level max
.
void orxonox::OutputListener::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
.
|
virtual |
Defines the mask of additional contexts.
Reimplemented in orxonox::SubcontextOutputListener.
void orxonox::OutputListener::setLevelMask | ( | OutputLevel | mask | ) |
Defines the level mask.
void orxonox::OutputListener::setLevelMax | ( | OutputLevel | max | ) |
Defines the level mask in a way which accepts all output up to the level max
.
void orxonox::OutputListener::setLevelRange | ( | OutputLevel | min, |
OutputLevel | max | ||
) |
Defines the level mask in a way which accepts all output between the levels min
and max
.
|
inlinevirtual |
Called by OutputManager for each line of output, checks if this listener actually accepts this output before it calls the output() function.
void orxonox::OutputListener::unregisterListener | ( | AdditionalContextListener * | listener | ) |
Removes a listener from the list.
|
private |
Mask of accepted output levels of the additional contexts.
|
private |
Mask of accepted additional contexts.
|
private |
Mask of accepted output levels, independent of contexts.
|
private |
List of all registered additional context listeners.