- Timestamp:
- Aug 21, 2011, 11:18:20 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/output/src/libraries/util/output/BaseWriter.h
r8850 r8853 27 27 */ 28 28 29 /** 30 @file 31 @ingroup Output 32 @brief Declaration of the BaseWriter class, the base of all output writers. 33 */ 34 29 35 #ifndef _BaseWriter_H__ 30 36 #define _BaseWriter_H__ … … 35 41 namespace orxonox 36 42 { 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 */ 37 65 class _UtilExport BaseWriter : public SubcontextOutputListener 38 66 { … … 44 72 void setAdditionalContextsLevelMax(OutputLevel max); 45 73 74 /// @brief Returns the name of this instance. 46 75 const std::string& getName() const 47 76 { return this->name_; } 48 77 78 /// Config value, used to define the maximum output level (independent of contexts) 49 79 int configurableMaxLevel_; 80 /// @brief Returns the name of the config value which defines the maximum output level (independent of contexts). 50 81 inline std::string getConfigurableMaxLevelName() const 51 82 { return this->name_ + "Level"; } 52 83 84 /// Config value, used to define the maximum output level of additional context 53 85 int configurableAdditionalContextsMaxLevel_; 86 /// @brief Returns the name of the config value which defines the maximum output level of additional context. 54 87 inline std::string getConfigurableAdditionalContextsMaxLevelName() const 55 88 { return this->name_ + "AdditionalContextsLevel"; } 56 89 90 /// Config vector, used to define the additional contexts (and sub-contexts) 57 91 std::vector<std::string> configurableAdditionalContexts_; 92 /// @brief Returns the name of the config vector which defines the additional contexts (and sub-contexts) 58 93 inline std::string getConfigurableAdditionalContextsName() const 59 94 { return this->name_ + "AdditionalContexts"; } … … 63 98 void changedConfigurableAdditionalContexts(); 64 99 100 /// Returns the (static) name of the section wherein the config-values are defined. 65 101 static inline std::string getConfigurableSectionName() 66 102 { return "Output"; } … … 70 106 71 107 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. 73 109 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 76 112 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 79 115 80 std::string name_; 116 std::string name_; ///< The name of this instance, used to generate unique config-values 81 117 }; 82 118 }
Note: See TracChangeset
for help on using the changeset viewer.