1 #ifndef _ots_Cout_Macros_h_
2 #define _ots_Cout_Macros_h_
7 #if MESSAGEFACILITY_HEX_VERSION > 0x20106
12 #define __SHORTFILE__ \
13 (strstr(&__FILE__[0], "/srcs/") ? strstr(&__FILE__[0], "/srcs/") + 6 : __FILE__)
16 #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
18 #define __E__ std::endl
23 #define __COUT_HDR_FL__ __SHORTFILE__ << " [" << std::dec << __LINE__ << "]\t"
24 #define __COUT_HDR_FP__ __SHORTFILE__ << " : " << __PRETTY_FUNCTION__ << "\t"
26 #define __COUT_HDR_F__ __SHORTFILE__ << "\t"
27 #define __COUT_HDR_L__ std::dec << __LINE__ << "\t"
28 #define __COUT_HDR_P__ __PRETTY_FUNCTION__ << "\t"
29 #define __COUT_HDR__ __COUT_HDR_FL__
31 #define __COUT_TYPE__(X) std::cout << QUOTE(X) << ":" << __MF_SUBJECT__ << ":"
33 #define __COUT_ERR__ __COUT_TYPE__(LogError) << __COUT_HDR__
34 #define __COUT_WARN__ __COUT_TYPE__(LogWarning) << __COUT_HDR__
35 #define __COUT_INFO__ __COUT_TYPE__(LogInfo) << __COUT_HDR__
36 #define __COUT__ __COUT_TYPE__(LogDebug) << __COUT_HDR__
37 #define __COUTV__(X) __COUT__ << QUOTE(X) << " = " << X << __E__
39 #define __THROW__(X) throw std::runtime_error(X)
45 #define __MF_SUBJECT__ "ots" // default subject.. others can #undef and re-#define
53 #define __MF_HDR__ __COUT_HDR__
54 #if MESSAGEFACILITY_HEX_VERSION > 0x20106
55 #define __MF_TYPE__(X) TLOG(X, __MF_SUBJECT__) // for latest artdaq
56 #define __MOUT_ERR__ __MF_TYPE__(TLVL_ERROR) << __MF_HDR__
57 #define __MOUT_WARN__ __MF_TYPE__(TLVL_WARNING) << __MF_HDR__
58 #define __MOUT_INFO__ __MF_TYPE__(TLVL_INFO) << __MF_HDR__
59 #define __MOUT__ __MF_TYPE__(TLVL_DEBUG) << __MF_HDR__
61 #define __MF_TYPE__(X) mf::X(__MF_SUBJECT__)
62 #define __MOUT_ERR__ __MF_TYPE__(LogError) << __MF_HDR__
63 #define __MOUT_WARN__ __MF_TYPE__(LogWarning) << __MF_HDR__
64 #define __MOUT_INFO__ __MF_TYPE__(LogInfo) << __MF_HDR__
65 #define __MOUT__ __MF_TYPE__(LogDebug) << __MF_HDR__
69 #define __MOUTV__(X) __MOUT__ << QUOTE(X) << " = " << X
75 #define __MCOUT_ERR__(X) \
80 #define __MCOUT_WARN__(X) \
85 #define __MCOUT_INFO__(X) \
90 #define __MCOUT__(X) \
95 #define __MCOUTV__(X) \
104 std::stringstream ss; \
105 ss << ":" << __MF_SUBJECT__ << ":" << __COUT_HDR__
106 #define __SS_THROW__ \
107 __COUT_ERR__ << "\n" << ss.str(); \
108 throw std::runtime_error(ss.str())
109 #define __SS_ONLY_THROW__ throw std::runtime_error(ss.str())
110 #define __SSV__(X) << QUOTE(X) << " = " << X
115 #define __CFG_COUT_TYPE__(X) \
116 std::cout << QUOTE(X) << ":" << __MF_SUBJECT__ << ":" << theConfigurationRecordName_ \
118 #define __CFG_MF_TYPE__(X) \
119 mf::X(std::string(__MF_SUBJECT__) + "-" + theConfigurationRecordName_)
121 #define __CFG_MOUT_ERR__ __CFG_MF_TYPE__(LogError) << __COUT_HDR__
122 #define __CFG_MOUT_WARN__ __CFG_MF_TYPE__(LogWarning) << __COUT_HDR__
123 #define __CFG_MOUT_INFO__ __CFG_MF_TYPE__(LogInfo) << __COUT_HDR__
124 #define __CFG_MOUT__ __CFG_MF_TYPE__(LogDebug) << __COUT_HDR__
125 #define __CFG_MOUTV__(X) __CFG_MOUT__ << QUOTE(X) << " = " << X
126 #define __CFG_COUT_ERR__ __CFG_COUT_TYPE__(LogError) << __COUT_HDR__
127 #define __CFG_COUT_WARN__ __CFG_COUT_TYPE__(LogWarning) << __COUT_HDR__
128 #define __CFG_COUT_INFO__ __CFG_COUT_TYPE__(LogInfo) << __COUT_HDR__
129 #define __CFG_COUT__ __CFG_COUT_TYPE__(LogDebug) << __COUT_HDR__
130 #define __CFG_COUTV__(X) __CFG_COUT__ << QUOTE(X) << " = " << X << __E__
132 #define __CFG_MCOUT_ERR__(X) \
134 __CFG_MOUT_ERR__ << X; \
135 __CFG_COUT_ERR__ << X; \
137 #define __CFG_MCOUT_WARN__(X) \
139 __CFG_MOUT_WARN__ << X; \
140 __CFG_COUT_WARN__ << X; \
142 #define __CFG_MCOUT_INFO__(X) \
144 __CFG_MOUT_INFO__ << X; \
145 __CFG_COUT_INFO__ << X; \
147 #define __CFG_MCOUT__(X) \
152 #define __CFG_MCOUTV__(X) \
159 std::stringstream ss; \
160 ss << ":" << __MF_SUBJECT__ << ":" << theConfigurationRecordName_ << ":" \
162 #define __CFG_SS_THROW__ \
163 __CFG_COUT_ERR__ << "\n" << ss.str(); \
164 throw std::runtime_error(ss.str())
169 #define __FE_COUT_TYPE__(X) \
170 std::cout << QUOTE(X) << ":FE:" << getInterfaceType() << ":" << getInterfaceUID() \
171 << ":" << theConfigurationRecordName_ << ":"
172 #define __FE_MF_TYPE__(X) \
173 mf::X(std::string("FE-") + getInterfaceType() + "-" + getInterfaceUID() + "-" + \
174 theConfigurationRecordName_)
176 #define __FE_MOUT_ERR__ __FE_MF_TYPE__(LogError) << __COUT_HDR__
177 #define __FE_MOUT_WARN__ __FE_MF_TYPE__(LogWarning) << __COUT_HDR__
178 #define __FE_MOUT_INFO__ __FE_MF_TYPE__(LogInfo) << __COUT_HDR__
179 #define __FE_MOUT__ __FE_MF_TYPE__(LogDebug) << __COUT_HDR__
180 #define __FE_MOUTV__(X) __FE_MOUT__ << QUOTE(X) << " = " << X
181 #define __FE_COUT_ERR__ __FE_COUT_TYPE__(LogError) << __COUT_HDR__
182 #define __FE_COUT_WARN__ __FE_COUT_TYPE__(LogWarning) << __COUT_HDR__
183 #define __FE_COUT_INFO__ __FE_COUT_TYPE__(LogInfo) << __COUT_HDR__
184 #define __FE_COUT__ __FE_COUT_TYPE__(LogDebug) << __COUT_HDR__
185 #define __FE_COUTV__(X) __FE_COUT__ << QUOTE(X) << " = " << X << __E__
187 #define __FE_MCOUT_ERR__(X) \
189 __FE_MOUT_ERR__ << X; \
190 __FE_COUT_ERR__ << X; \
192 #define __FE_MCOUT_WARN__(X) \
194 __FE_MOUT_WARN__ << X; \
195 __FE_COUT_WARN__ << X; \
197 #define __FE_MCOUT_INFO__(X) \
199 __FE_MOUT_INFO__ << X; \
200 __FE_COUT_INFO__ << X; \
202 #define __FE_MCOUT__(X) \
207 #define __FE_MCOUTV__(X) \
214 std::stringstream ss; \
215 ss << ":FE:" << getInterfaceType() << ":" << getInterfaceUID() << ":" \
216 << theConfigurationRecordName_ << ":" << __COUT_HDR__
217 #define __FE_SS_THROW__ \
218 __FE_COUT_ERR__ << "\n" << ss.str(); \
219 throw std::runtime_error(ss.str())
224 #define __GEN_COUT_TYPE__(X) std::cout << QUOTE(X) << ":" << mfSubject_ << ":"
225 #define __GEN_MF_TYPE__(X) mf::X(mfSubject_)
227 #define __GEN_MOUT_ERR__ __GEN_MF_TYPE__(LogError) << __COUT_HDR__
228 #define __GEN_MOUT_WARN__ __GEN_MF_TYPE__(LogWarning) << __COUT_HDR__
229 #define __GEN_MOUT_INFO__ __GEN_MF_TYPE__(LogInfo) << __COUT_HDR__
230 #define __GEN_MOUT__ __GEN_MF_TYPE__(LogDebug) << __COUT_HDR__
231 #define __GEN_MOUTV__(X) __GEN_MOUT__ << QUOTE(X) << " = " << X
232 #define __GEN_COUT_ERR__ __GEN_COUT_TYPE__(LogError) << __COUT_HDR__
233 #define __GEN_COUT_WARN__ __GEN_COUT_TYPE__(LogWarning) << __COUT_HDR__
234 #define __GEN_COUT_INFO__ __GEN_COUT_TYPE__(LogInfo) << __COUT_HDR__
235 #define __GEN_COUT__ __GEN_COUT_TYPE__(LogDebug) << __COUT_HDR__
236 #define __GEN_COUTV__(X) __GEN_COUT__ << QUOTE(X) << " = " << X << __E__
238 #define __GEN_MCOUT_ERR__(X) \
240 __GEN_MOUT_ERR__ << X; \
241 __GEN_COUT_ERR__ << X; \
243 #define __GEN_MCOUT_WARN__(X) \
245 __GEN_MOUT_WARN__ << X; \
246 __GEN_COUT_WARN__ << X; \
248 #define __GEN_MCOUT_INFO__(X) \
250 __GEN_MOUT_INFO__ << X; \
251 __GEN_COUT_INFO__ << X; \
253 #define __GEN_MCOUT__(X) \
258 #define __GEN_MCOUTV__(X) \
265 std::stringstream ss; \
266 ss << ":" << mfSubject_ << ":" << __COUT_HDR__
267 #define __GEN_SS_THROW__ \
268 __GEN_COUT_ERR__ << "\n" << ss.str(); \
269 throw std::runtime_error(ss.str())
275 #define __SUP_COUT_TYPE__(X) \
276 std::cout << QUOTE(X) << ":" << supervisorClassNoNamespace_ << ":" \
277 << CorePropertySupervisorBase::getSupervisorUID() << ":"
278 #define __SUP_MF_TYPE__(X) \
279 mf::X(supervisorClassNoNamespace_ + "-" + \
280 CorePropertySupervisorBase::getSupervisorUID())
282 #define __SUP_MOUT_ERR__ __SUP_MF_TYPE__(LogError) << __COUT_HDR__
283 #define __SUP_MOUT_WARN__ __SUP_MF_TYPE__(LogWarning) << __COUT_HDR__
284 #define __SUP_MOUT_INFO__ __SUP_MF_TYPE__(LogInfo) << __COUT_HDR__
285 #define __SUP_MOUT__ __SUP_MF_TYPE__(LogDebug) << __COUT_HDR__
286 #define __SUP_MOUTV__(X) __SUP_MOUT__ << QUOTE(X) << " = " << X
287 #define __SUP_COUT_ERR__ __SUP_COUT_TYPE__(LogError) << __COUT_HDR__
288 #define __SUP_COUT_WARN__ __SUP_COUT_TYPE__(LogWarning) << __COUT_HDR__
289 #define __SUP_COUT_INFO__ __SUP_COUT_TYPE__(LogInfo) << __COUT_HDR__
290 #define __SUP_COUT__ __SUP_COUT_TYPE__(LogDebug) << __COUT_HDR__
291 #define __SUP_COUTV__(X) __SUP_COUT__ << QUOTE(X) << " = " << X << __E__
293 #define __SUP_MCOUT_ERR__(X) \
295 __SUP_MOUT_ERR__ << X; \
296 __SUP_COUT_ERR__ << X; \
298 #define __SUP_MCOUT_WARN__(X) \
300 __SUP_MOUT_WARN__ << X; \
301 __SUP_COUT_WARN__ << X; \
303 #define __SUP_MCOUT_INFO__(X) \
305 __SUP_MOUT_INFO__ << X; \
306 __SUP_COUT_INFO__ << X; \
308 #define __SUP_MCOUT__(X) \
313 #define __SUP_MCOUTV__(X) \
320 std::stringstream ss; \
321 ss << ":" << supervisorClassNoNamespace_ << ":" \
322 << CorePropertySupervisorBase::getSupervisorUID() << ":" << __COUT_HDR__
323 #define __SUP_SS_THROW__ \
324 __SUP_COUT_ERR__ << "\n" << ss.str(); \
325 throw std::runtime_error(ss.str())
328 StringMacros::otsGetEnvironmentVarable(X, std::string(__SHORTFILE__), __LINE__)
335 #define XDAQ_CONST_CALL
337 #define XDAQ_CONST_CALL const
350 virtual char const* what()
const throw() {
return what_.c_str(); }