1 #ifndef _ots_Cout_Macros_h_
2 #define _ots_Cout_Macros_h_
10 #define TRACEMF_USE_VERBATIM 1 //for trace longer path filenames
15 #define __SHORTFILE__ (__builtin_strstr(&__FILE__[0], "/srcs/") ? __builtin_strstr(&__FILE__[0], "/srcs/") + 6 : __FILE__)
18 #define __FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
20 #define __E__ std::endl
22 #define __THROW__(X) throw std::runtime_error(X)
31 #define __MF_SUBJECT__ __FILENAME__ // default subject.. others can #undef and re-#define
39 #define __COUT_HDR_F__ __SHORTFILE__ << "\t"
40 #define __COUT_HDR_L__ "[" << std::dec << __LINE__ << "]\t"
41 #define __COUT_HDR_P__ __PRETTY_FUNCTION__ << "\t"
42 #define __COUT_HDR_FL__ __SHORTFILE__ << " " << __COUT_HDR_L__
43 #define __COUT_HDR_FP__ __SHORTFILE__ << " : " << __COUT_HDR_P__
44 #define __COUT_HDR__ ""//__COUT_HDR_FL__
45 #define __MF_HDR__ ""//__COUT_HDR__
48 #define __MF_DECOR__ (__MF_SUBJECT__)
49 #define __MF_TYPE__(X) TLOG(X, __MF_DECOR__)
51 #ifndef __COUT_TO_STD__
52 #define __COUT_TYPE__(X) __MF_TYPE__(X)
54 #define __COUT_TYPE__(X) std::cout << QUOTE(X) << ":" << __MF_DECOR__ << ":" << __COUT_HDR_FL__
57 #define __MOUT_ERR__ __MF_TYPE__(TLVL_ERROR) << __MF_HDR__
58 #define __MOUT_WARN__ __MF_TYPE__(TLVL_WARNING) << __MF_HDR__
59 #define __MOUT_INFO__ __MF_TYPE__(TLVL_INFO) << __MF_HDR__
60 #define __MOUT__ __MF_TYPE__(TLVL_DEBUG) << __MF_HDR__
61 #define __MOUTV__(X) __MOUT__ << QUOTE(X) << " = " << X
63 #define __COUT_ERR__ __COUT_TYPE__(TLVL_ERROR) << __COUT_HDR__
64 #define __COUT_WARN__ __COUT_TYPE__(TLVL_WARNING) << __COUT_HDR__
65 #define __COUT_INFO__ __COUT_TYPE__(TLVL_INFO) << __COUT_HDR__
66 #define __COUT__ __COUT_TYPE__(TLVL_DEBUG) << __COUT_HDR__
67 #define __COUTT__ __COUT_TYPE__(TLVL_TRACE) << __COUT_HDR__
68 #define __COUTV__(X) __COUT__ << QUOTE(X) << " = " << X << __E__
69 #define __COUTTV__(X) __COUTT__ << QUOTE(X) << " = " << X << __E__
76 #define __MCOUT_ERR__(X) { __MOUT_ERR__ << X;} //causes duplicate with mf improvements: { __MOUT_ERR__ << X; __COUT_ERR__ << X; }
77 #define __MCOUT_WARN__(X) { __MOUT_WARN__ << X;} //causes duplicate with mf improvements: { __MOUT_WARN__ << X; __COUT_WARN__ << X; }
78 #define __MCOUT_INFO__(X) { __MOUT_INFO__ << X;} //causes duplicate with mf improvements: { __MOUT_INFO__ << X; __COUT_INFO__ << X; }
79 #define __MCOUT__(X) { __MOUT__ << X;} //causes duplicate with mf improvements: { __MOUT__ << X; __COUT__ << X; }
80 #define __MCOUTV__(X) { __MOUTV__(X);} //causes duplicate with mf improvements: { __MOUTV__(X); __COUTV__(X); }
84 #define __SS__ std::stringstream ss; ss << ":" << __MF_DECOR__ << ":" << __COUT_HDR_FL__ << __COUT_HDR__
85 #define __SS_THROW__ { __COUT_ERR__ << "\n" << ss.str(); throw std::runtime_error(ss.str()); } //put in {}'s to prevent surprises, e.g. if ... else __SS_THROW__;
86 #define __SS_ONLY_THROW__ throw std::runtime_error(ss.str())
87 #define __SSV__(X) __SS__ << QUOTE(X) << " = " << X
91 #define __CFG_MF_DECOR__ (theConfigurationRecordName_ + "\t<> ")
92 #define __CFG_MF_TYPE__(X) TLOG(X, __MF_SUBJECT__) << __CFG_MF_DECOR__
94 #ifndef __COUT_TO_STD__
95 #define __CFG_COUT_TYPE__(X) __CFG_MF_TYPE__(X)
97 #define __CFG_COUT_TYPE__(X) std::cout << QUOTE(X) << ":" << __CFG_MF_DECOR__ << ":" << __COUT_HDR_FL__ << __COUT_HDR__
100 #define __CFG_MOUT_ERR__ __CFG_MF_TYPE__(TLVL_ERROR) << __COUT_HDR__
101 #define __CFG_MOUT_WARN__ __CFG_MF_TYPE__(TLVL_WARNING) << __COUT_HDR__
102 #define __CFG_MOUT_INFO__ __CFG_MF_TYPE__(TLVL_INFO) << __COUT_HDR__
103 #define __CFG_MOUT__ __CFG_MF_TYPE__(TLVL_DEBUG) << __COUT_HDR__
104 #define __CFG_MOUTV__(X) __CFG_MOUT__ << QUOTE(X) << " = " << X
105 #define __CFG_COUT_ERR__ __CFG_COUT_TYPE__(TLVL_ERROR) << __COUT_HDR__
106 #define __CFG_COUT_WARN__ __CFG_COUT_TYPE__(TLVL_WARNING) << __COUT_HDR__
107 #define __CFG_COUT_INFO__ __CFG_COUT_TYPE__(TLVL_INFO) << __COUT_HDR__
108 #define __CFG_COUT__ __CFG_COUT_TYPE__(TLVL_DEBUG) << __COUT_HDR__
109 #define __CFG_COUTV__(X) __CFG_COUT__ << QUOTE(X) << " = " << X << __E__
111 #define __CFG_MCOUT_ERR__(X) { __CFG_MOUT_ERR__ << X;} //causes duplicate with mf improvements: { __CFG_MOUT_ERR__ << X; __CFG_COUT_ERR__ << X; }
112 #define __CFG_MCOUT_WARN__(X) { __CFG_MOUT_WARN__ << X;} //causes duplicate with mf improvements: { __CFG_MOUT_WARN__ << X; __CFG_COUT_WARN__ << X; }
113 #define __CFG_MCOUT_INFO__(X) { __CFG_MOUT_INFO__ << X;} //causes duplicate with mf improvements: { __CFG_MOUT_INFO__ << X; __CFG_COUT_INFO__ << X; }
114 #define __CFG_MCOUT__(X) { __CFG_MOUT__ << X;} //causes duplicate with mf improvements: { __CFG_MOUT__ << X; __CFG_COUT__ << X; }
115 #define __CFG_MCOUTV__(X) { __CFG_MOUTV__(X);} //causes duplicate with mf improvements: { __CFG_MOUTV__(X); __CFG_COUTV__(X); }
117 #define __CFG_SS__ std::stringstream ss; ss << ":" << __CFG_MF_DECOR__ << ":" << __COUT_HDR_FL__ << __COUT_HDR__
118 #define __CFG_SS_THROW__ { __CFG_COUT_ERR__ << "\n" << ss.str(); throw std::runtime_error(ss.str()); }
123 #define __FE_MF_DECOR__ ("FE:" + getInterfaceType() + std::string(":") + getInterfaceUID() + ":" + theConfigurationRecordName_ + "\t<> ")
124 #define __FE_MF_TYPE__(X) TLOG(X, __MF_SUBJECT__) << __FE_MF_DECOR__
126 #ifndef __COUT_TO_STD__
127 #define __FE_COUT_TYPE__(X) __FE_MF_TYPE__(X)
129 #define __FE_COUT_TYPE__(X) std::cout << QUOTE(X) << ":" << __FE_MF_DECOR__ << ":" << __COUT_HDR_FL__ << __COUT_HDR__
132 #define __FE_MOUT_ERR__ __FE_MF_TYPE__(TLVL_ERROR) << __COUT_HDR__
133 #define __FE_MOUT_WARN__ __FE_MF_TYPE__(TLVL_WARNING) << __COUT_HDR__
134 #define __FE_MOUT_INFO__ __FE_MF_TYPE__(TLVL_INFO) << __COUT_HDR__
135 #define __FE_MOUT__ __FE_MF_TYPE__(TLVL_DEBUG) << __COUT_HDR__
136 #define __FE_MOUTV__(X) __FE_MOUT__ << QUOTE(X) << " = " << X
137 #define __FE_COUT_ERR__ __FE_COUT_TYPE__(TLVL_ERROR) << __COUT_HDR__
138 #define __FE_COUT_WARN__ __FE_COUT_TYPE__(TLVL_WARNING) << __COUT_HDR__
139 #define __FE_COUT_INFO__ __FE_COUT_TYPE__(TLVL_INFO) << __COUT_HDR__
140 #define __FE_COUT__ __FE_COUT_TYPE__(TLVL_DEBUG) << __COUT_HDR__
141 #define __FE_COUTV__(X) __FE_COUT__ << QUOTE(X) << " = " << X << __E__
143 #define __FE_MCOUT_ERR__(X) { __FE_MOUT_ERR__ << X;} //causes duplicate with mf improvements: { __FE_MOUT_ERR__ << X; __FE_COUT_ERR__ << X; }
144 #define __FE_MCOUT_WARN__(X) { __FE_MOUT_WARN__ << X;} //causes duplicate with mf improvements: { __FE_MOUT_WARN__ << X; __FE_COUT_WARN__ << X; }
145 #define __FE_MCOUT_INFO__(X) { __FE_MOUT_INFO__ << X;} //causes duplicate with mf improvements: { __FE_MOUT_INFO__ << X; __FE_COUT_INFO__ << X; }
146 #define __FE_MCOUT__(X) { __FE_MOUT__ << X;} //causes duplicate with mf improvements: { __FE_MOUT__ << X; __FE_COUT__ << X; }
147 #define __FE_MCOUTV__(X) { __FE_MOUTV__(X);} //causes duplicate with mf improvements: { __FE_MOUTV__(X); __FE_COUTV__(X); }
149 #define __FE_SS__ std::stringstream ss; ss << ":" << __FE_MF_DECOR__ << ":" << __COUT_HDR_FL__ << __COUT_HDR__
150 #define __FE_SS_THROW__ { __FE_COUT_ERR__ << "\n" << ss.str(); throw std::runtime_error(ss.str()); }
155 #define __GEN_MF_DECOR__ (mfSubject_ + "\t<> ")
156 #define __GEN_MF_TYPE__(X) TLOG(X, __MF_SUBJECT__) << __GEN_MF_DECOR__
158 #ifndef __COUT_TO_STD__
159 #define __GEN_COUT_TYPE__(X) __GEN_MF_TYPE__(X)
161 #define __GEN_COUT_TYPE__(X) std::cout << QUOTE(X) << ":" << __GEN_MF_DECOR__ << ":" << __COUT_HDR_FL__ << __COUT_HDR__
164 #define __GEN_MOUT_ERR__ __GEN_MF_TYPE__(TLVL_ERROR) << __COUT_HDR__
165 #define __GEN_MOUT_WARN__ __GEN_MF_TYPE__(TLVL_WARNING) << __COUT_HDR__
166 #define __GEN_MOUT_INFO__ __GEN_MF_TYPE__(TLVL_INFO) << __COUT_HDR__
167 #define __GEN_MOUT__ __GEN_MF_TYPE__(TLVL_DEBUG) << __COUT_HDR__
168 #define __GEN_MOUTV__(X) __GEN_MOUT__ << QUOTE(X) << " = " << X
169 #define __GEN_COUT_ERR__ __GEN_COUT_TYPE__(TLVL_ERROR) << __COUT_HDR__
170 #define __GEN_COUT_WARN__ __GEN_COUT_TYPE__(TLVL_WARNING) << __COUT_HDR__
171 #define __GEN_COUT_INFO__ __GEN_COUT_TYPE__(TLVL_INFO) << __COUT_HDR__
172 #define __GEN_COUT__ __GEN_COUT_TYPE__(TLVL_DEBUG) << __COUT_HDR__
173 #define __GEN_COUTV__(X) __GEN_COUT__ << QUOTE(X) << " = " << X << __E__
175 #define __GEN_MCOUT_ERR__(X) { __GEN_MOUT_ERR__ << X;} //causes duplicate with mf improvements: { __GEN_MOUT_ERR__ << X; __GEN_COUT_ERR__ << X; }
176 #define __GEN_MCOUT_WARN__(X) { __GEN_MOUT_WARN__ << X;} //causes duplicate with mf improvements: { __GEN_MOUT_WARN__ << X; __GEN_COUT_WARN__ << X; }
177 #define __GEN_MCOUT_INFO__(X) { __GEN_MOUT_INFO__ << X;} //causes duplicate with mf improvements: { __GEN_MOUT_INFO__ << X; __GEN_COUT_INFO__ << X; }
178 #define __GEN_MCOUT__(X) { __GEN_MOUT__ << X;} //causes duplicate with mf improvements: { __GEN_MOUT__ << X; __GEN_COUT__ << X; }
179 #define __GEN_MCOUTV__(X) { __GEN_MOUTV__(X);} //causes duplicate with mf improvements: { __GEN_MOUTV__(X); __GEN_COUTV__(X); }
181 #define __GEN_SS__ std::stringstream ss; ss << ":" << __GEN_MF_DECOR__ << ":" << __COUT_HDR_FL__ << __COUT_HDR__
182 #define __GEN_SS_THROW__ { __GEN_COUT_ERR__ << "\n" << ss.str(); throw std::runtime_error(ss.str()); }
188 #define __SUP_MF_DECOR__ (supervisorClassNoNamespace_ + std::string(":") + CorePropertySupervisorBase::getSupervisorUID() + "\t<> ")
189 #define __SUP_MF_TYPE__(X) TLOG(X, __MF_SUBJECT__) << __SUP_MF_DECOR__ //mf::X(supervisorClassNoNamespace_ + "-" + CorePropertySupervisorBase::getSupervisorUID())
191 #ifndef __COUT_TO_STD__
192 #define __SUP_COUT_TYPE__(X) __SUP_MF_TYPE__(X)
194 #define __SUP_COUT_TYPE__(X) std::cout << QUOTE(X) << ":" << __SUP_MF_DECOR__ << ":" << __COUT_HDR_FL__ << __COUT_HDR__
197 #define __SUP_MOUT_ERR__ __SUP_MF_TYPE__(TLVL_ERROR) << __COUT_HDR__
198 #define __SUP_MOUT_WARN__ __SUP_MF_TYPE__(TLVL_WARNING) << __COUT_HDR__
199 #define __SUP_MOUT_INFO__ __SUP_MF_TYPE__(TLVL_INFO) << __COUT_HDR__
200 #define __SUP_MOUT__ __SUP_MF_TYPE__(TLVL_DEBUG) << __COUT_HDR__
201 #define __SUP_MOUTV__(X) __SUP_MOUT__ << QUOTE(X) << " = " << X
203 #define __SUP_COUT_ERR__ __SUP_COUT_TYPE__(TLVL_ERROR) << __COUT_HDR__
204 #define __SUP_COUT_WARN__ __SUP_COUT_TYPE__(TLVL_WARNING) << __COUT_HDR__
205 #define __SUP_COUT_INFO__ __SUP_COUT_TYPE__(TLVL_INFO) << __COUT_HDR__
206 #define __SUP_COUT__ __SUP_COUT_TYPE__(TLVL_DEBUG) << __COUT_HDR__
207 #define __SUP_COUTV__(X) __SUP_COUT__ << QUOTE(X) << " = " << X << __E__
209 #define __SUP_MCOUT_ERR__(X) { __SUP_MOUT_ERR__ << X;} //causes duplicate with mf improvements: { __SUP_MOUT_ERR__ << X; __SUP_COUT_ERR__ << X; }
210 #define __SUP_MCOUT_WARN__(X) { __SUP_MOUT_WARN__ << X;} //causes duplicate with mf improvements: { __SUP_MOUT_WARN__ << X; __SUP_COUT_WARN__ << X; }
211 #define __SUP_MCOUT_INFO__(X) { __SUP_MOUT_INFO__ << X;} //causes duplicate with mf improvements: { __SUP_MOUT_INFO__ << X; __SUP_COUT_INFO__ << X; }
212 #define __SUP_MCOUT__(X) { __SUP_MOUT__ << X;} //causes duplicate with mf improvements: { __SUP_MOUT__ << X; __SUP_COUT__ << X; }
213 #define __SUP_MCOUTV__(X) { __SUP_MOUTV__(X);} //causes duplicate with mf improvements: { __SUP_MOUTV__(X); __SUP_COUTV__(X); }
215 #define __SUP_SS__ std::stringstream ss; ss << ":" << __SUP_MF_DECOR__ << ":" << __COUT_HDR_FL__ << __COUT_HDR__
216 #define __SUP_SS_THROW__ { __SUP_COUT_ERR__ << "\n" << ss.str(); throw std::runtime_error(ss.str()); }
218 #define __ENV__(X) StringMacros::otsGetEnvironmentVarable(X, std::string(__SHORTFILE__), __LINE__)
225 #define XDAQ_CONST_CALL
227 #define XDAQ_CONST_CALL const
240 virtual char const* what()
const throw() {
return what_.c_str(); }