OpendTect-6_4  6.4
errmsg.h
Go to the documentation of this file.
1 #ifndef errmsg_h
2 #define errmsg_h
3 
4 /*
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert
9  Date: Sep 2013
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 */
14 
15 #ifndef commondefs_h
16 # include "commondefs.h"
17 #endif
18 
19 mGlobal(Basic) void ErrMsg(const char*,bool progr=false);
20 
21 #include <typeinfo>
22 template <class T>
23 inline const char* className( const T& t )
24 {
25  const char* nm = typeid(t).name();
26  while ( *nm >= '0' && *nm <= '9' ) nm++;
27  return nm;
28 }
29 
30 
31 #ifdef __debug__
32 
33 
34  namespace OD {
35  mGlobal(Basic) void programmerErrMsg(const char* msg,const char* cname,
36  const char* fnm,int linenr);
37 }
38 
39 # define pErrMsg(msg) \
40  OD::programmerErrMsg(msg,::className(*this),__FILE__,__LINE__)
41 
43 #define pErrMsgOnce(msg) \
44 { \
45  mDefineStaticLocalObject( bool, __message_shown__, = false ); \
46  if ( !__message_shown__ ) \
47  { \
48  __message_shown__ = true; \
49  pErrMsg(msg); \
50  } \
51 }
52 
53 
54 # define pFreeFnErrMsg(msg) \
55  OD::programmerErrMsg( msg, __func__, __FILE__, __LINE__ )
56 
58 #else
59 
60 # define pErrMsg(msg)
61 # define pErrMsgOnce(msg)
62 # define pFreeFnErrMsg(msg)
63 
64 #endif
65 
66 #endif
const char * className(const T &t)
Definition: errmsg.h:23
#define mGlobal(module)
Definition: commondefs.h:163
void ErrMsg(const char *, bool progr=false)
OpendTect.
Definition: commontypes.h:29

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019