Message.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2012 SCHUNK GmbH & Co. KG
00003  * Copyright (c) 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *   http://www.apache.org/licenses/LICENSE-2.0
00010 
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef UTIL_MESSAGE
00019 #define UTIL_MESSAGE
00020 
00021 // ---- local includes ------------------------------------------------------ ;
00022 
00023 #include "../Util/GlobalDefines.h"
00024 #include "../Util/InlineFunctions.h"
00025 
00026 // ---- global includes ----------------------------------------------------- ;
00027 
00028 #include <stdio.h>
00029 #include <stdlib.h>
00030 #include <stdarg.h>
00031 #include <string.h>
00032 
00033 // ---- globals ----------------------------------------------------------- ;
00034 extern int g_iDebugLevel;
00035 
00036 extern bool g_bDebugFile;
00037 
00038 extern bool g_bDebug;
00039 
00040 extern const char* g_pcDebugFileName;
00041 
00042 // ---- typedefs ------------------------------------------------------------ ;
00043 
00044 // ---- class definition ---------------------------------------------------- ;
00045 
00046 class CMessage
00047 {
00048 
00049 private:
00050 
00051         // ---- private data ---------------------------------------------------- ;
00052 
00053         static CRITICAL_SECTION *m_csMessage;
00054 
00055 protected:
00056         
00057         // ---- protected data -------------------------------------------------- ;
00058 
00059                 char m_acClassName[50];
00060                 bool m_bDebug;
00061                 bool m_bDebugFile;
00062                 int m_iDebugLevel;
00063                 static double m_fInitTime;
00064 public:
00065 
00066         // ---- public data ------------------------------------------------------- ;
00067 
00068         // ---- constructors / destructor ----------------------------------------- ;
00069 
00070                 // default constructor
00071                 CMessage(void); 
00072                 CMessage(const char* pcClassName, int iDebugLevel = 0, bool bDebug = true, bool bDebugFile = false);    
00073                 // copy constructor
00074                 CMessage(const CMessage& clMessage);
00075                 // destructor
00076                 virtual ~CMessage(void);
00077 
00078         // ---- operators --------------------------------------------------------- ;
00079         
00080                 // assignment operator
00081                 CMessage& operator=(const CMessage& clMessage);
00082 
00083         // ---- query functions --------------------------------------------------- ;
00084 
00085                 int getDebugLevel() const;
00086 
00087         // ---- modify functions -------------------------------------------------- ;
00088         
00089                 int initMessage(const char* pcClassName, int iDebuglevel = 0, bool bDebug = true, bool bDebugFile = false);
00090 
00091                 void setInitTime(void);
00092                 void setDebug(bool bFlag);
00093                 void setDebugFile(bool bFlag);
00094                 void setDebugLevel(int iLevel);
00095 
00096                 static void setCriticalSection(CRITICAL_SECTION *cs);
00097 
00098         // ---- I/O functions ----------------------------------------------------- ;
00099 
00100         // ---- exec functions ---------------------------------------------------- ;
00101                 void logging(const char *pcLoggingMessage,...);
00102 
00103                 // output of a debug message with a debug level
00104                 void debug(const int iDebugLevel,                      
00105                                                   const char *pcDebugMessage,...) const;
00106 
00107                 // output of a warning message
00108                 void warning(const char *pcWarningMessage,...) const;
00109                       
00110                 // output of an error message
00111                 void error(const int iErrorCode,                      
00112                                                 const char *pcErrorMessage,...) const;
00113                 void error(const char *pcErrorMessage,...) const;
00114 };
00115 
00116 #endif


schunk_libm5api
Author(s): Florian Weisshardt
autogenerated on Sat Jun 8 2019 20:25:13