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"
25 #define __COUT_HDR_PL__ __PRETTY_FUNCTION__ << " [" << std::dec << __LINE__ << "]\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 << _E__
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())
114 #define __CFG_COUT_TYPE__(X) \
115 std::cout << QUOTE(X) << ":" << __MF_SUBJECT__ << ":" << theConfigurationRecordName_ \
117 #define __CFG_MF_TYPE__(X) \
118 mf::X(std::string(__MF_SUBJECT__) + "-" + theConfigurationRecordName_)
120 #define __CFG_MOUT_ERR__ __CFG_MF_TYPE__(LogError) << __COUT_HDR__
121 #define __CFG_MOUT_WARN__ __CFG_MF_TYPE__(LogWarning) << __COUT_HDR__
122 #define __CFG_MOUT_INFO__ __CFG_MF_TYPE__(LogInfo) << __COUT_HDR__
123 #define __CFG_MOUT__ __CFG_MF_TYPE__(LogDebug) << __COUT_HDR__
124 #define __CFG_MOUTV__(X) __CFG_MOUT__ << QUOTE(X) << " = " << X
125 #define __CFG_COUT_ERR__ __CFG_COUT_TYPE__(LogError) << __COUT_HDR__
126 #define __CFG_COUT_WARN__ __CFG_COUT_TYPE__(LogWarning) << __COUT_HDR__
127 #define __CFG_COUT_INFO__ __CFG_COUT_TYPE__(LogInfo) << __COUT_HDR__
128 #define __CFG_COUT__ __CFG_COUT_TYPE__(LogDebug) << __COUT_HDR__
129 #define __CFG_COUTV__(X) __CFG_COUT__ << QUOTE(X) << " = " << X << __E__
131 #define __CFG_MCOUT_ERR__(X) \
133 __CFG_MOUT_ERR__ << X; \
134 __CFG_COUT_ERR__ << X; \
136 #define __CFG_MCOUT_WARN__(X) \
138 __CFG_MOUT_WARN__ << X; \
139 __CFG_COUT_WARN__ << X; \
141 #define __CFG_MCOUT_INFO__(X) \
143 __CFG_MOUT_INFO__ << X; \
144 __CFG_COUT_INFO__ << X; \
146 #define __CFG_MCOUT__(X) \
151 #define __CFG_MCOUTV__(X) \
158 std::stringstream ss; \
159 ss << ":" << __MF_SUBJECT__ << ":" << theConfigurationRecordName_ << ":" \
161 #define __CFG_SS_THROW__ \
162 __CFG_COUT_ERR__ << "\n" << ss.str(); \
163 throw std::runtime_error(ss.str())
168 #define __FE_COUT_TYPE__(X) \
169 std::cout << QUOTE(X) << ":FE:" << getInterfaceType() << ":" << getInterfaceUID() \
170 << ":" << theConfigurationRecordName_ << ":"
171 #define __FE_MF_TYPE__(X) \
172 mf::X(std::string("FE-") + getInterfaceType() + "-" + getInterfaceUID() + "-" + \
173 theConfigurationRecordName_)
175 #define __FE_MOUT_ERR__ __FE_MF_TYPE__(LogError) << __COUT_HDR__
176 #define __FE_MOUT_WARN__ __FE_MF_TYPE__(LogWarning) << __COUT_HDR__
177 #define __FE_MOUT_INFO__ __FE_MF_TYPE__(LogInfo) << __COUT_HDR__
178 #define __FE_MOUT__ __FE_MF_TYPE__(LogDebug) << __COUT_HDR__
179 #define __FE_MOUTV__(X) __FE_MOUT__ << QUOTE(X) << " = " << X
180 #define __FE_COUT_ERR__ __FE_COUT_TYPE__(LogError) << __COUT_HDR__
181 #define __FE_COUT_WARN__ __FE_COUT_TYPE__(LogWarning) << __COUT_HDR__
182 #define __FE_COUT_INFO__ __FE_COUT_TYPE__(LogInfo) << __COUT_HDR__
183 #define __FE_COUT__ __FE_COUT_TYPE__(LogDebug) << __COUT_HDR__
184 #define __FE_COUTV__(X) __FE_COUT__ << QUOTE(X) << " = " << X << __E__
186 #define __FE_MCOUT_ERR__(X) \
188 __FE_MOUT_ERR__ << X; \
189 __FE_COUT_ERR__ << X; \
191 #define __FE_MCOUT_WARN__(X) \
193 __FE_MOUT_WARN__ << X; \
194 __FE_COUT_WARN__ << X; \
196 #define __FE_MCOUT_INFO__(X) \
198 __FE_MOUT_INFO__ << X; \
199 __FE_COUT_INFO__ << X; \
201 #define __FE_MCOUT__(X) \
206 #define __FE_MCOUTV__(X) \
213 std::stringstream ss; \
214 ss << ":FE:" << getInterfaceType() << ":" << getInterfaceUID() << ":" \
215 << theConfigurationRecordName_ << ":" << __COUT_HDR__
216 #define __FE_SS_THROW__ \
217 __FE_COUT_ERR__ << "\n" << ss.str(); \
218 throw std::runtime_error(ss.str())
223 #define __GEN_COUT_TYPE__(X) std::cout << QUOTE(X) << ":" << mfSubject_ << ":"
224 #define __GEN_MF_TYPE__(X) mf::X(mfSubject_)
226 #define __GEN_MOUT_ERR__ __GEN_MF_TYPE__(LogError) << __COUT_HDR__
227 #define __GEN_MOUT_WARN__ __GEN_MF_TYPE__(LogWarning) << __COUT_HDR__
228 #define __GEN_MOUT_INFO__ __GEN_MF_TYPE__(LogInfo) << __COUT_HDR__
229 #define __GEN_MOUT__ __GEN_MF_TYPE__(LogDebug) << __COUT_HDR__
230 #define __GEN_MOUTV__(X) __GEN_MOUT__ << QUOTE(X) << " = " << X
231 #define __GEN_COUT_ERR__ __GEN_COUT_TYPE__(LogError) << __COUT_HDR__
232 #define __GEN_COUT_WARN__ __GEN_COUT_TYPE__(LogWarning) << __COUT_HDR__
233 #define __GEN_COUT_INFO__ __GEN_COUT_TYPE__(LogInfo) << __COUT_HDR__
234 #define __GEN_COUT__ __GEN_COUT_TYPE__(LogDebug) << __COUT_HDR__
235 #define __GEN_COUTV__(X) __GEN_COUT__ << QUOTE(X) << " = " << X << __E__
237 #define __GEN_MCOUT_ERR__(X) \
239 __GEN_MOUT_ERR__ << X; \
240 __GEN_COUT_ERR__ << X; \
242 #define __GEN_MCOUT_WARN__(X) \
244 __GEN_MOUT_WARN__ << X; \
245 __GEN_COUT_WARN__ << X; \
247 #define __GEN_MCOUT_INFO__(X) \
249 __GEN_MOUT_INFO__ << X; \
250 __GEN_COUT_INFO__ << X; \
252 #define __GEN_MCOUT__(X) \
257 #define __GEN_MCOUTV__(X) \
264 std::stringstream ss; \
265 ss << ":" << mfSubject_ << ":" << __COUT_HDR__
266 #define __GEN_SS_THROW__ \
267 __GEN_COUT_ERR__ << "\n" << ss.str(); \
268 throw std::runtime_error(ss.str())
274 #define __SUP_COUT_TYPE__(X) \
275 std::cout << QUOTE(X) << ":" << supervisorClassNoNamespace_ << ":" \
276 << CorePropertySupervisorBase::getSupervisorUID() << ":"
277 #define __SUP_MF_TYPE__(X) \
278 mf::X(supervisorClassNoNamespace_ + "-" + \
279 CorePropertySupervisorBase::getSupervisorUID())
281 #define __SUP_MOUT_ERR__ __SUP_MF_TYPE__(LogError) << __COUT_HDR__
282 #define __SUP_MOUT_WARN__ __SUP_MF_TYPE__(LogWarning) << __COUT_HDR__
283 #define __SUP_MOUT_INFO__ __SUP_MF_TYPE__(LogInfo) << __COUT_HDR__
284 #define __SUP_MOUT__ __SUP_MF_TYPE__(LogDebug) << __COUT_HDR__
285 #define __SUP_MOUTV__(X) __SUP_MOUT__ << QUOTE(X) << " = " << X
286 #define __SUP_COUT_ERR__ __SUP_COUT_TYPE__(LogError) << __COUT_HDR__
287 #define __SUP_COUT_WARN__ __SUP_COUT_TYPE__(LogWarning) << __COUT_HDR__
288 #define __SUP_COUT_INFO__ __SUP_COUT_TYPE__(LogInfo) << __COUT_HDR__
289 #define __SUP_COUT__ __SUP_COUT_TYPE__(LogDebug) << __COUT_HDR__
290 #define __SUP_COUTV__(X) __SUP_COUT__ << QUOTE(X) << " = " << X << __E__
292 #define __SUP_MCOUT_ERR__(X) \
294 __SUP_MOUT_ERR__ << X; \
295 __SUP_COUT_ERR__ << X; \
297 #define __SUP_MCOUT_WARN__(X) \
299 __SUP_MOUT_WARN__ << X; \
300 __SUP_COUT_WARN__ << X; \
302 #define __SUP_MCOUT_INFO__(X) \
304 __SUP_MOUT_INFO__ << X; \
305 __SUP_COUT_INFO__ << X; \
307 #define __SUP_MCOUT__(X) \
312 #define __SUP_MCOUTV__(X) \
319 std::stringstream ss; \
320 ss << ":" << supervisorClassNoNamespace_ << ":" \
321 << CorePropertySupervisorBase::getSupervisorUID() << ":" << __COUT_HDR__
322 #define __SUP_SS_THROW__ \
323 __SUP_COUT_ERR__ << "\n" << ss.str(); \
324 throw std::runtime_error(ss.str())
331 #define XDAQ_CONST_CALL
333 #define XDAQ_CONST_CALL const
346 virtual char const* what()
const throw() {
return what_.c_str(); }