Message.h
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003  * 
00004  * Copyright (c) 2012 
00005  * 
00006  * SCHUNK GmbH & Co. KG
00007  *  
00008  * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
00009  * 
00010  * Project name: Drivers for "Amtec M5 Protocol" Electronics V4
00011  *                                                                        
00012  * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
00013  * 
00014  * Email:robotics@schunk.com
00015  * 
00016  * ToDo: 
00017  * 
00018  * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
00019  * 
00020  * Redistribution and use in source and binary forms, with or without 
00021  * modification, are permitted provided that the following conditions are met: 
00022  * 
00023  *  * Redistributions of source code must retain the above copyright 
00024  *    notice, this list of conditions and the following disclaimer. 
00025  *  * Redistributions in binary form must reproduce the above copyright 
00026  *    notice, this list of conditions and the following disclaimer in the 
00027  *    documentation and/or other materials provided with the distribution. 
00028  *  * Neither the name of SCHUNK GmbH & Co. KG nor the names of its 
00029  *    contributors may be used to endorse or promote products derived from 
00030  *    this software without specific prior written permission. 
00031  * 
00032  * This program is free software: you can redistribute it and/or modify 
00033  * it under the terms of the GNU Lesser General Public License LGPL as 
00034  * published by the Free Software Foundation, either version 3 of the 
00035  * License, or (at your option) any later version. 
00036  * 
00037  * This program is distributed in the hope that it will be useful, 
00038  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
00039  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
00040  * GNU Lesser General Public License LGPL for more details. 
00041  * 
00042  * You should have received a copy of the GNU Lesser General Public 
00043  * License LGPL along with this program. 
00044  * If not, see <http://www.gnu.org/licenses/>.
00045  * 
00046  ******************************************************************************/
00047 
00048 
00049 #ifndef UTIL_MESSAGE
00050 #define UTIL_MESSAGE
00051 
00052 // ---- local includes ------------------------------------------------------ ;
00053 
00054 #include "../Util/GlobalDefines.h"
00055 #include "../Util/InlineFunctions.h"
00056 
00057 // ---- global includes ----------------------------------------------------- ;
00058 
00059 #include <stdio.h>
00060 #include <stdlib.h>
00061 #include <stdarg.h>
00062 #include <string.h>
00063 
00064 // ---- globals ----------------------------------------------------------- ;
00065 extern int g_iDebugLevel;
00066 
00067 extern bool g_bDebugFile;
00068 
00069 extern bool g_bDebug;
00070 
00071 extern char* g_pcDebugFileName;
00072 
00073 // ---- typedefs ------------------------------------------------------------ ;
00074 
00075 // ---- class definition ---------------------------------------------------- ;
00076 
00077 class CMessage
00078 {
00079 
00080 private:
00081 
00082         // ---- private data ---------------------------------------------------- ;
00083 
00084         static CRITICAL_SECTION *m_csMessage;
00085 
00086 protected:
00087         
00088         // ---- protected data -------------------------------------------------- ;
00089 
00090                 char m_acClassName[50];
00091                 bool m_bDebug;
00092                 bool m_bDebugFile;
00093                 int m_iDebugLevel;
00094                 static double m_fInitTime;
00095 public:
00096 
00097         // ---- public data ------------------------------------------------------- ;
00098 
00099         // ---- constructors / destructor ----------------------------------------- ;
00100 
00101                 // default constructor
00102                 CMessage(void); 
00103                 CMessage(char* pcClassName, int iDebugLevel = 0, bool bDebug = true, bool bDebugFile = false);  
00104                 // copy constructor
00105                 CMessage(const CMessage& clMessage);
00106                 // destructor
00107                 virtual ~CMessage(void);
00108 
00109         // ---- operators --------------------------------------------------------- ;
00110         
00111                 // assignment operator
00112                 CMessage& operator=(const CMessage& clMessage);
00113 
00114         // ---- query functions --------------------------------------------------- ;
00115 
00116                 int getDebugLevel() const;
00117 
00118         // ---- modify functions -------------------------------------------------- ;
00119         
00120                 int initMessage(char* pcClassName, int iDebuglevel = 0, bool bDebug = true, bool bDebugFile = false);
00121 
00122                 void setInitTime(void);
00123                 void setDebug(bool bFlag);
00124                 void setDebugFile(bool bFlag);
00125                 void setDebugLevel(int iLevel);
00126 
00127                 static void setCriticalSection(CRITICAL_SECTION *cs);
00128 
00129         // ---- I/O functions ----------------------------------------------------- ;
00130 
00131         // ---- exec functions ---------------------------------------------------- ;
00132                 void logging(const char *pcLoggingMessage,...);
00133 
00134                 // output of a debug message with a debug level
00135                 void debug(const int iDebugLevel,                      
00136                                                   const char *pcDebugMessage,...) const;
00137 
00138                 // output of a warning message
00139                 void warning(const char *pcWarningMessage,...) const;
00140                       
00141                 // output of an error message
00142                 void error(const int iErrorCode,                      
00143                                                 const char *pcErrorMessage,...) const;
00144                 void error(const char *pcErrorMessage,...) const;
00145 };
00146 
00147 #endif


schunk_libm5api
Author(s): Florian Weisshardt
autogenerated on Mon Oct 6 2014 07:30:34