• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

epics/apps/crucible/stream/src/StreamError.h (r4864/r2310)

Go to the documentation of this file.
00001 /***************************************************************
00002 * StreamDevice Support                                         *
00003 *                                                              *
00004 * (C) 2005 Dirk Zimoch (dirk.zimoch@psi.ch)                    *
00005 *                                                              *
00006 * This is error and debug message handling of StreamDevice.    *
00007 * Please refer to the HTML files in ../doc/ for a detailed     *
00008 * documentation.                                               *
00009 *                                                              *
00010 * If you do any changes in this file, you are not allowed to   *
00011 * redistribute it any more. If there is a bug or a missing     *
00012 * feature, send me an email and/or your patch. If I accept     *
00013 * your changes, they will go to the next release.              *
00014 *                                                              *
00015 * DISCLAIMER: If this software breaks something or harms       *
00016 * someone, it's your problem.                                  *
00017 *                                                              *
00018 ***************************************************************/
00019 
00020 #ifndef StreamError_h
00021 #define StreamError_h
00022 
00023 #include <stdio.h>
00024 #include <stdarg.h>
00025 
00026 #ifndef __GNUC__
00027 #define __attribute__(x)
00028 #endif
00029 
00030 extern int streamDebug;
00031 extern void (*StreamPrintTimestampFunction)(char* buffer, int size);
00032 
00033 void StreamError(int line, const char* file, const char* fmt, ...)
00034 __attribute__ ((format(printf,3,4)));
00035 
00036 void StreamVError(int line, const char* file, const char* fmt, va_list args)
00037 __attribute__ ((format(printf,3,0)));
00038 
00039 void StreamError(const char* fmt, ...)
00040 __attribute__ ((format(printf,1,2)));
00041 
00042 inline void StreamVError(const char* fmt, va_list args)
00043 {
00044     StreamVError(0, NULL, fmt, args); 
00045 }
00046 
00047 class StreamDebugClass
00048 {
00049     const char* file;
00050     int line;
00051 public:
00052     StreamDebugClass(const char* file, int line) :
00053         file(file), line(line) {}
00054     int print(const char* fmt, ...)
00055         __attribute__ ((format(printf,2,3)));
00056 };
00057 
00058 inline StreamDebugClass
00059 StreamDebugObject(const char* file, int line)
00060 { return StreamDebugClass(file, line); }
00061 
00062 #define error StreamError
00063 #define debug (!streamDebug)?0:StreamDebugObject(__FILE__,__LINE__).print
00064 
00065 #if (__GNUC__ == 2 && __GNUC_MINOR__ == 7)
00066 /* Bug in cygnus-2.7.2 compiler: temporary objects crash the compiler */
00067 #define NO_TEMPORARY
00068 #endif
00069 
00070 #endif

Generated on Tue Dec 10 2013 04:52:22 for ROCsoft by  doxygen 1.7.1