Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

LOW_helper_msglog.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           LOW_helper_msglog.h  -  description
00003                              -------------------
00004     begin                : Sun Jul 21 2002
00005     copyright            : (C) 2002 by Harald Roelle, Helmut Reiser
00006     email                : roelle@informatik.uni-muenchen.de, reiser@informatik.uni-muenchen.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef LOW_HELPER_MSGLOG_H
00019 #define LOW_HELPER_MSGLOG_H
00020 
00021 
00022 #include <stdint.h>
00023 #include <stdarg.h>
00024 #include <stdio.h>
00025 
00026 
00027 #include "LOW_semaphoreSet.h"
00028 
00029 
00030 /**
00031     @todo Documentation of class.
00032 
00033     @todo Finish implementation of class.
00034 
00035     @bug printXXX( "\n") gives "(NULL)" output.
00036 
00037   *@author Harald Roelle, Helmut Reiser
00038   */
00039 class LOW_helper_msglog {
00040 
00041 //=======================================================================================
00042 public:
00043 
00044   //=====================================================================================
00045   //
00046   // type definitions
00047   //
00048   
00049   typedef enum {
00050     portSerial_dl,
00051     devDS1820_dl,
00052     linkLock_dl,
00053     all_dl  // this one MUST be the last
00054   } debugLevel_t;
00055 
00056   
00057   //=====================================================================================
00058   //
00059   // static methods
00060   //
00061   
00062   static void enableDebugLevel( const debugLevel_t inLevel, const bool isEnabled = true);
00063   
00064   /**
00065    * Print error message
00066    */
00067   static void printPerror( const int inErrno, const char *inFormat, ...);
00068 
00069   /**
00070    * Print error message
00071    */
00072   static void printError( const char *inFormat, ...);
00073   
00074   /**
00075    * Print warning
00076    */
00077   static void printWarning( const char *inFormat, ...);
00078   
00079   /**
00080    * Print message
00081    */
00082   static void printMessage( const char *inFormat, ...);
00083   
00084   /**
00085    * Print debug message
00086    */
00087   static void printDebug( const debugLevel_t inLevel, const char *inFormat, ...);
00088 
00089 
00090 //=======================================================================================
00091 private:
00092   
00093   //=====================================================================================
00094   //
00095   // locks
00096   //
00097   
00098   class msgLock {
00099     public:
00100       msgLock();
00101       ~msgLock();
00102       static LOW_semaphoreSet* semaphoreInit();
00103     
00104     private:
00105       static LOW_semaphoreSet  *semSet;
00106   };
00107 
00108   
00109   //=====================================================================================
00110   //
00111   // type definitions
00112   //
00113   
00114   typedef enum { msg_log, warn_log, err_log, debug_log} logType_t;
00115   
00116   
00117   //=====================================================================================
00118   //
00119   // static attributes
00120   //
00121   
00122   static bool errorOccured;
00123   static bool debugLevels[all_dl];
00124 
00125   static bool useStdMsgStream;
00126   static bool useStdWarnStream;
00127   static bool useStdErrStream;
00128   static bool useStdDebugStream;
00129   static bool useExtraMsgStream;
00130   static bool useExtraWarnStream;
00131   static bool useExtraErrStream;
00132   static bool useExtraDebugStream;
00133   
00134   static FILE* stdOutStream;
00135   static FILE* stdWarnStream;
00136   static FILE* stdErrStream;
00137   static FILE* stdDebugStream;
00138   static FILE* extraOutStream;
00139   static FILE* extraWarnStream;
00140   static FILE* extraErrStream;
00141   static FILE* extraDebugStream;
00142   
00143   
00144   //=====================================================================================
00145   //
00146   // static methods
00147   //
00148   
00149   static void va_printToLog( const logType_t inLogType, const char *inFormat, va_list inParamList);
00150   static unsigned int fprintLogHeader( FILE *inExtraStream, FILE *inStdStream);
00151   static void fprintfMulti( FILE *inExtraStream, FILE *inStdStream, const char *inFormat, ...);
00152   static void vfprintfMulti( FILE *inExtraStream, FILE *inStdStream, const char *inFormat, va_list inAp);
00153   static void* callocCheck( const size_t inSize);
00154 
00155 };
00156 
00157 #endif
00158 

Generated on Sun Jan 12 21:07:43 2003 by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001