Orxonox
0.0.5 Codename: Arcturus
|
OutputManager acts as the center of the output system and is implemented as a singleton. More...
#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/util/output/OutputManager.h>
Classes | |
struct | Testing |
Public Member Functions | |
OutputManager () | |
Constructor, initializes all values. More... | |
virtual | ~OutputManager () |
Destructor. More... | |
bool | acceptsOutput (OutputLevel level, const OutputContextContainer &context) const |
Returns true if at least one of the output listeners will accept output with the given level and context. More... | |
OutputLevel | getCombinedAdditionalContextsLevelMask () const |
OutputContextMask | getCombinedAdditionalContextsMask () const |
OutputLevel | getCombinedLevelMask () const |
ConsoleWriter * | getConsoleWriter () |
std::string | getDefaultPrefix (OutputLevel level, const OutputContextContainer &context) const |
Returns a string containing the name of the level and the context (if any) which can be prepended to an output message if it is written to the console or the log file. More... | |
const std::string & | getLevelName (OutputLevel level) const |
Returns a human readable string for each output level. More... | |
const std::vector< OutputListener * > & | getListeners () const |
LogWriter * | getLogWriter () |
MemoryWriter * | getMemoryWriter () |
virtual void | pushMessage (OutputLevel level, const OutputContextContainer &context, const std::string &message) |
Sends an output message to all output listeners. More... | |
const OutputContextContainer & | registerContext (const std::string &name, const std::string &subname="") |
Registers a context (or sub-context) and returns the container which identifies the context. More... | |
virtual void | registerListener (OutputListener *listener) |
Adds an output listener to the list of listeners. More... | |
virtual void | unregisterListener (OutputListener *listener) |
Removes an output listener from the list of listeners. More... | |
virtual void | updatedAdditionalContextsLevelMask (const OutputListener *listener) override |
virtual void | updatedAdditionalContextsMask (const OutputListener *listener) override |
virtual void | updatedLevelMask (const OutputListener *listener) override |
Public Member Functions inherited from orxonox::AdditionalContextListener | |
virtual | ~AdditionalContextListener () |
Static Public Member Functions | |
static OutputManager & | getInstance () |
Returns the only existing instance of the OutputManager singleton. More... | |
static OutputManager & | getInstanceAndCreateListeners () |
Returns the only existing instance of the OutputManager singleton and ensures that the most important output listeners exist. More... | |
Private Member Functions | |
OutputManager (const OutputManager &)=delete | |
OutputManager & | operator= (const OutputManager &)=delete |
void | updateCombinedAdditionalContextsLevelMask () |
Updates the combined additional contexts level mask. More... | |
void | updateCombinedAdditionalContextsMask () |
Updates the combined additional contexts mask. More... | |
void | updateCombinedLevelMask () |
Updates the combined level mask. More... | |
void | updateMasks () |
Updates all three combined level- and context-masks. More... | |
Private Attributes | |
OutputLevel | combinedAdditionalContextsLevelMask_ |
The combined mask of accepted additional contexts levels of all listeners. More... | |
OutputContextMask | combinedAdditionalContextsMask_ |
The combined mask of accepted additional contexts of all listeners. More... | |
OutputLevel | combinedLevelMask_ |
The combined mask of accepted levels of all listeners. More... | |
ConsoleWriter * | consoleWriterInstance_ |
The main instance of ConsoleWriter, managed by OutputManager. More... | |
std::map< std::string, OutputContextContainer > | contextContainers_ |
Contains all contexts including sub-contexts and their containers. More... | |
std::map< std::string, OutputContextMask > | contextMasks_ |
Contains all main-contexts and their masks. More... | |
bool | isInitialized_ |
Becomes true once the following instances were created. More... | |
std::vector< OutputListener * > | listeners_ |
List of all registered output listeners. More... | |
LogWriter * | logWriterInstance_ |
The main instance of LogWriter, managed by OutputManager. More... | |
MemoryWriter * | memoryWriterInstance_ |
The main instance of MemoryWriter, managed by OutputManager. More... | |
OutputContextSubID | subcontextCounter_ |
Counts the number of sub-contexts (and generates their IDs) More... | |
OutputManager acts as the center of the output system and is implemented as a singleton.
All instances of OutputStream (and hence also the orxout() function) send their buffered output to OutputManager. OutputManager then distributes this output to all registered instances of OutputListener.
For each listener OutputManager checks if it wants to receive output with the given level and context. OutputManager itself also maintains masks that define the accepted levels and concept. They are a combination of the masks of all output listeners. See the description of OutputListener for a more conclusive description of these masks.
Additionally OutputManager is used to register output contexts.
orxonox::OutputManager::OutputManager | ( | ) |
Constructor, initializes all values.
|
virtual |
Destructor.
|
privatedelete |
|
inline |
Returns true if at least one of the output listeners will accept output with the given level and context.
For the sake of performance, output messages with levels or contexts that are not accepted should be ignored or, even better, not generated at all.
|
inline |
|
inline |
|
inline |
|
inline |
std::string orxonox::OutputManager::getDefaultPrefix | ( | OutputLevel | level, |
const OutputContextContainer & | context | ||
) | const |
Returns a string containing the name of the level and the context (if any) which can be prepended to an output message if it is written to the console or the log file.
|
static |
Returns the only existing instance of the OutputManager singleton.
|
static |
Returns the only existing instance of the OutputManager singleton and ensures that the most important output listeners exist.
You should use this function if you send output to OutputManager and want to be sure that the most important output listeners exist. Don't use it elsewhere inside the output system to avoid circular calls.
const std::string & orxonox::OutputManager::getLevelName | ( | OutputLevel | level | ) | const |
Returns a human readable string for each output level.
|
inline |
|
inline |
|
inline |
|
privatedelete |
|
virtual |
Sends an output message to all output listeners.
level | The level of the message |
context | The context of the message |
message | The output message (may contain '\n') |
This function splits the message into lines (if it contains '\n') and sends it to the output listeners. They may ignore the message if it doesn't match their level- and context-masks.
const OutputContextContainer & orxonox::OutputManager::registerContext | ( | const std::string & | name, |
const std::string & | subname = "" |
||
) |
Registers a context (or sub-context) and returns the container which identifies the context.
name | The name of the context |
subname | The name of the sub-context (or "" if it is not a sub-context) |
If the context doesn't exist, it gets created. Otherwise the existing instance is returned.
|
virtual |
Adds an output listener to the list of listeners.
|
virtual |
Removes an output listener from the list of listeners.
|
private |
Updates the combined additional contexts level mask.
The masks of all listeners are ORed to form the combined mask.
|
private |
Updates the combined additional contexts mask.
The masks of all listeners are ORed to form the combined mask.
|
private |
Updates the combined level mask.
The masks of all listeners are ORed to form the combined mask.
|
inlineoverridevirtual |
Implements orxonox::AdditionalContextListener.
|
inlineoverridevirtual |
Implements orxonox::AdditionalContextListener.
|
inlineoverridevirtual |
Implements orxonox::AdditionalContextListener.
|
private |
Updates all three combined level- and context-masks.
|
private |
The combined mask of accepted additional contexts levels of all listeners.
|
private |
The combined mask of accepted additional contexts of all listeners.
|
private |
The combined mask of accepted levels of all listeners.
|
private |
The main instance of ConsoleWriter, managed by OutputManager.
|
private |
Contains all contexts including sub-contexts and their containers.
|
private |
Contains all main-contexts and their masks.
|
private |
Becomes true once the following instances were created.
|
private |
List of all registered output listeners.
|
private |
The main instance of LogWriter, managed by OutputManager.
|
private |
The main instance of MemoryWriter, managed by OutputManager.
|
private |
Counts the number of sub-contexts (and generates their IDs)