00001
00015 #ifndef OSOUTPUT_H
00016 #define OSOUTPUT_H
00017
00018 #include "OSConfig.h"
00019 #include "OSParameters.h"
00020 #include "OSReferenced.hpp"
00021 #include "OSSmartPtr.hpp"
00022
00023 #include <string>
00024 #include <vector>
00025
00026 #ifdef HAVE_CSTDIO
00027 # include <cstdio>
00028 #else
00029 # ifdef HAVE_STDIO_H
00030 # include <stdio.h>
00031 # else
00032 # error "don't have header file for stdio"
00033 # endif
00034 #endif
00035
00036
00041 class OSOutputChannel
00042 {
00043 private:
00047 std::string name;
00048
00052 FILE* file;
00053
00057 int printLevel[ENUM_OUTPUT_AREA_NUMBER_OF_AREAS];
00058
00059
00060 public:
00066 OSOutputChannel(std::string name);
00067
00071 ~OSOutputChannel();
00072
00076 std::string Name();
00077
00084 bool setPrintLevel(ENUM_OUTPUT_AREA area, ENUM_OUTPUT_LEVEL level);
00085
00090 bool setAllPrintLevels(ENUM_OUTPUT_LEVEL level);
00091
00097 bool setAllPrintLevels(ENUM_OUTPUT_LEVEL* level, int dim);
00098
00102 bool isAccepted(ENUM_OUTPUT_AREA area, ENUM_OUTPUT_LEVEL level);
00103
00114 void OSPrintf(ENUM_OUTPUT_AREA area, ENUM_OUTPUT_LEVEL level, std::string str);
00115
00119 void flushBuffer();
00120
00125 bool Open();
00126 };
00127
00146 class OSOutput : public OSReferencedObject
00147 {
00148 private:
00149 OSOutput(const OSOutput&);
00150 OSOutput& operator =(const OSOutput&);
00151 public:
00155 OSOutput();
00156
00160 ~OSOutput();
00161
00171 bool OSPrint(ENUM_OUTPUT_AREA area, ENUM_OUTPUT_LEVEL level, std::string outStr);
00172
00176 void FlushAllBuffers();
00177
00184 bool SetPrintLevel(std::string name, ENUM_OUTPUT_LEVEL* level, int dim);
00185
00193 bool SetPrintLevel(std::string name, ENUM_OUTPUT_LEVEL level);
00194
00203 int AddChannel(std::string name);
00204
00205
00210 bool DeleteChannel(std::string name);
00211
00217 int FindChannel(std::string name);
00218
00219 private:
00223 int nOfOutputs;
00224
00228 OSOutputChannel** outputChannel;
00229 };
00230
00231
00232
00233
00234
00235
00236 extern const OSSmartPtr<OSOutput> osoutput;
00237
00238 #endif