otsdaq  v1_01_02
 All Classes Namespaces Functions
CoutHeaderMacros.h
1 #ifndef _ots_Utilities_Macro_h_
2 #define _ots_Utilities_Macro_h_
3 
4 
5 #include <string.h> //for strstr
6 
7 //take filename only after srcs/ (this gives by repo name)
8 #define __SHORTFILE__ (strstr(&__FILE__[0], "/srcs/") ? strstr(&__FILE__[0], "/srcs/") + 6 : __FILE__)
9 
10 //take only file name
11 #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
12 
13 //#define __COUT_HDR__ __FILE__ << " : " << __PRETTY_FUNCTION__ << " [" << __LINE__ << "]\t"
14 #define __COUT_HDR_FL__ __SHORTFILE__ << " [" << __LINE__ << "]\t"
15 #define __COUT_HDR_FP__ __SHORTFILE__ << " : " << __PRETTY_FUNCTION__ << "\t"
16 #define __COUT_HDR_PL__ __PRETTY_FUNCTION__ << " [" << __LINE__ << "]\t"
17 #define __COUT_HDR_F__ __SHORTFILE__ << "\t"
18 #define __COUT_HDR_L__ __LINE__ << "\t"
19 #define __COUT_HDR_P__ __PRETTY_FUNCTION__ << "\t"
20 #define __COUT_HDR__ __COUT_HDR_PL__
21 
22 
26 
27 #define __MF_SUBJECT__ "ots" //default subject.. others can #undef and re-#define
28 //Note: to turn off MF everywhere, just replace with std::cout here at __MF_TYPE__(X)!
29 
30 #define Q(X) #X
31 #define QUOTE(X) Q(X)
32 //#define __MF_TYPE__(X) FIXME ?? how to do this ...(getenv("OTSDAQ_USING_MF")=="1"? mf::X (__MF_SUBJECT__) : std::cout << QUOTE(X) << ":" << __MF_SUBJECT__ << ":")
33 #define __MF_TYPE__(X) std::cout << QUOTE(X) << ":" << __MF_SUBJECT__ << ":"
34 //#define __MF_TYPE__(X) mf::X (__MF_SUBJECT__)
35 
36 
37 #define __MF_HDR__ __COUT_HDR_FL__
38 #define __MOUT_ERR__ __MF_TYPE__(LogError) << __MF_HDR__
39 #define __MOUT_WARN__ __MF_TYPE__(LogWarning) << __MF_HDR__
40 #define __MOUT_INFO__ __MF_TYPE__(LogInfo) << __MF_HDR__
41 #define __MOUT__ __MF_TYPE__(LogDebug) << __MF_HDR__
42 //#define __MOUT__ std::cout << __PRETTY_FUNCTION__ << " [" << __LINE__ << "]\t"
43 #define __SS__ std::stringstream ss; ss << __MF_HDR__
44 
46 
47 
48 
49 
50 
51 //========================================================================================================================
52 //const_cast away the const
53 // so that otsdaq is compatible with slf6 and slf7 versions of xdaq
54 // where they changed to const xdaq::ApplicationDescriptor* in slf7
55 #ifdef XDAQ_NOCONST
56 #define XDAQ_CONST_CALL
57 #else
58 #define XDAQ_CONST_CALL const
59 #endif
60 //========================================================================================================================
61 
62 
63 
64 
65 #endif