Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 21, 2011, 11:18:20 PM (14 years ago)
Author:
landauf
Message:

documented the remaining code of the output system
created a build unit for the output system

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/output/src/libraries/util/output/BaseWriter.h

    r8850 r8853  
    2727 */
    2828
     29/**
     30    @file
     31    @ingroup Output
     32    @brief Declaration of the BaseWriter class, the base of all output writers.
     33*/
     34
    2935#ifndef _BaseWriter_H__
    3036#define _BaseWriter_H__
     
    3541namespace orxonox
    3642{
     43    /**
     44        @brief BaseWriter is an output listener and makes the accepted output levels and contexts configurable.
     45
     46        All output writers like ConsoleWriter and LogWriter are inherited from
     47        this class. BaseWriter itself inherits from SubcontextOutputListener.
     48        It adds helper functions to configure the accepted levels and contexts.
     49
     50        The levels are not fully configurable, only the "max" form is allowed
     51        (which means that it's only possible to define a maximum level, not
     52        the full mask).
     53
     54        Contexts are defined by a vector of strings, each context is defined
     55        by it's name. Sub-contexts have the form \a "main-name::sub-name", i.e.
     56        their name is concatenated with :: in between.
     57
     58        Each instance of BaseWriter needs a name to generate distinguishable
     59        config values.
     60
     61        Received output messages are split into lines and sent line by line to
     62        the virtual printLine() function. Each line has a prepended prefix
     63        which describes the level and context of the output.
     64    */
    3765    class _UtilExport BaseWriter : public SubcontextOutputListener
    3866    {
     
    4472            void setAdditionalContextsLevelMax(OutputLevel max);
    4573
     74            /// @brief Returns the name of this instance.
    4675            const std::string& getName() const
    4776                { return this->name_; }
    4877
     78            /// Config value, used to define the maximum output level (independent of contexts)
    4979            int configurableMaxLevel_;
     80            /// @brief Returns the name of the config value which defines the maximum output level (independent of contexts).
    5081            inline std::string getConfigurableMaxLevelName() const
    5182                { return this->name_ + "Level"; }
    5283
     84            /// Config value, used to define the maximum output level of additional context
    5385            int configurableAdditionalContextsMaxLevel_;
     86            /// @brief Returns the name of the config value which defines the maximum output level of additional context.
    5487            inline std::string getConfigurableAdditionalContextsMaxLevelName() const
    5588                { return this->name_ + "AdditionalContextsLevel"; }
    5689
     90            /// Config vector, used to define the additional contexts (and sub-contexts)
    5791            std::vector<std::string> configurableAdditionalContexts_;
     92            /// @brief Returns the name of the config vector which defines the additional contexts (and sub-contexts)
    5893            inline std::string getConfigurableAdditionalContextsName() const
    5994                { return this->name_ + "AdditionalContexts"; }
     
    6398            void changedConfigurableAdditionalContexts();
    6499
     100            /// Returns the (static) name of the section wherein the config-values are defined.
    65101            static inline std::string getConfigurableSectionName()
    66102                { return "Output"; }
     
    70106
    71107        private:
    72             virtual void printLine(const std::string& line, OutputLevel level) = 0;
     108            virtual void printLine(const std::string& line, OutputLevel level) = 0; ///< Pure virtual function, gets called for each line of output together with a prefix which describes level and context of the output.
    73109
    74             void setLevelRange(OutputLevel min, OutputLevel max);
    75             void setLevelMask(OutputLevel mask);
     110            void setLevelRange(OutputLevel min, OutputLevel max);                   ///< Inherited function, overwritten as private because it is not supported by the config-value
     111            void setLevelMask(OutputLevel mask);                                    ///< Inherited function, overwritten as private because it is not supported by the config-value
    76112
    77             void setAdditionalContextsLevelRange(OutputLevel min, OutputLevel max);
    78             void setAdditionalContextsLevelMask(OutputLevel mask);
     113            void setAdditionalContextsLevelRange(OutputLevel min, OutputLevel max); ///< Inherited function, overwritten as private because it is not supported by the config-value
     114            void setAdditionalContextsLevelMask(OutputLevel mask);                  ///< Inherited function, overwritten as private because it is not supported by the config-value
    79115
    80             std::string name_;
     116            std::string name_; ///< The name of this instance, used to generate unique config-values
    81117    };
    82118}
Note: See TracChangeset for help on using the changeset viewer.