Changeset 1586 for code/branches/core3/src/util/OutputHandler.h
- Timestamp:
- Jun 10, 2008, 3:35:50 PM (16 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core3/src/util/OutputHandler.h
r1574 r1586 38 38 #define _OutputHandler_H__ 39 39 40 #include " CorePrereqs.h"40 #include "UtilPrereqs.h" 41 41 42 42 #include <iostream> … … 49 49 { 50 50 //! The OutputHandler acts like std::cout, but redirects output to the console AND the logfile. 51 class _ CoreExport OutputHandler51 class _UtilExport OutputHandler 52 52 { 53 53 public: 54 54 enum OutputDevice 55 55 { 56 LD_All ,57 LD_Console ,58 LD_Logfile ,59 LD_Shell 56 LD_All = 0, 57 LD_Console = 1, 58 LD_Logfile = 2, 59 LD_Shell = 3 60 60 }; 61 61 … … 86 86 { return this->logfile_; } 87 87 88 /** @brief Returns a pointer to the OutputBuffer. @return The OutputBuffer */ 89 inline OutputBuffer* getOutputBuffer() 90 { return this->outputBuffer_; } 91 88 92 /** @brief Sets the level of the incoming output. @param level The level of the incoming output @return The OutputHandler itself */ 89 93 inline OutputHandler& setOutputLevel(int level) … … 94 98 { return this->outputLevel_; } 95 99 96 static int getSoftDebugLevel(OutputHandler::OutputDevice device); 97 98 OutputBuffer& getShellOutputBuffer(); 100 static void setSoftDebugLevel(OutputHandler::OutputDevice device, int level); 101 static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All); 102 103 void setOutputBuffer(OutputBuffer& buffer); 99 104 100 105 template <class T> … … 136 141 OutputHandler(const OutputHandler& oh); // don't copy 137 142 virtual ~OutputHandler(); 138 std::ofstream logfile_; //!< The logfile where the output is logged 139 std::string logfilename_; //!< The name of the logfile 140 int outputLevel_; //!< The level of the incoming output 143 144 std::ofstream logfile_; //!< The logfile where the output is logged 145 std::string logfilename_; //!< The name of the logfile 146 OutputBuffer fallbackBuffer_; //!< The OutputBuffer that gets used if there is no other OutputBuffer 147 OutputBuffer* outputBuffer_; //!< The OutputBuffer to put output in (usually used by the Shell) 148 int outputLevel_; //!< The level of the incoming output 149 int softDebugLevel_[4]; //!< The soft debug level for each OutputDevice - the configurable maximal output level 141 150 }; 142 151 … … 159 168 160 169 if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_) 161 OutputHandler::getOutStream().getShellOutputBuffer() << output;170 (*this->outputBuffer_) << output; 162 171 163 172 return *this; … … 183 192 184 193 if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= out.getOutputLevel()) 185 OutputHandler::getOutStream().getShellOutputBuffer() << output;194 (*out.getOutputBuffer()) << output; 186 195 187 196 return out; 188 197 } 189 190 198 } 191 199
Note: See TracChangeset
for help on using the changeset viewer.