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

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