DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
macro.hpp
Go to the documentation of this file.
1#ifndef ERS_MACRO_H
2#define ERS_MACRO_H
3
9#include <ers/ers.hpp>
10#include <ers/StreamFactory.hpp>
12#include <boost/preprocessor/cat.hpp>
13
14ERS_DECLARE_ISSUE( ers, InternalMessage, ERS_EMPTY, ERS_EMPTY )
15
16#define ERS_REGISTER_OUTPUT_STREAM( class, name, param ) \
17namespace { \
18 struct BOOST_PP_CAT( OutputStreamRegistrator, __LINE__ ) { \
19 static ers::OutputStream * create( const std::string & param ) \
20 { return new class( param ); } \
21 BOOST_PP_CAT( OutputStreamRegistrator, __LINE__ ) ()\
22 { ers::StreamFactory::instance().register_out_stream( name, create ); } \
23 } BOOST_PP_CAT( registrator, __LINE__ ); \
24}
25
26#define ERS_INTERNAL_DEBUG( level, message ) { \
27if ( ers::debug_level() >= level ) \
28{ \
29 std::ostringstream out; \
30 out << message; \
31 ers::InternalMessage info( ERS_HERE, out.str() ); \
32 info.set_severity( ers::Severity( ers::Debug, level ) ); \
33 ers::StandardStreamOutput::println( std::cout, info, 0 ); \
34} }
35
36#define ERS_INTERNAL_INFO( message ) { \
37 std::ostringstream out; \
38 out << message; \
39 ers::InternalMessage info( ERS_HERE, out.str() ); \
40 info.set_severity( ers::Information ); \
41 ers::StandardStreamOutput::println( std::cout, info, 0 ); \
42}
43
44#define ERS_INTERNAL_WARNING( message ) { \
45 std::ostringstream out; \
46 out << message; \
47 ers::InternalMessage info( ERS_HERE, out.str() ); \
48 info.set_severity( ers::Warning ); \
49 ers::StandardStreamOutput::println( std::cerr, info, 0 ); \
50}
51
52#define ERS_INTERNAL_ERROR( message ) { \
53 std::ostringstream out; \
54 out << message; \
55 ers::InternalMessage info( ERS_HERE, out.str() ); \
56 info.set_severity( ers::Error ); \
57 ers::StandardStreamOutput::println( std::cerr, info, 0 ); \
58}
59
60#define ERS_INTERNAL_FATAL( message ) { \
61 std::ostringstream out; \
62 out << message; \
63 ers::InternalMessage info( ERS_HERE, out.str() ); \
64 info.set_severity( ers::Fatal ); \
65 ers::StandardStreamOutput::println( std::cerr, info, 0 ); \
66 ::exit( 13 ); \
67}
68
69#endif
#define ERS_DECLARE_ISSUE(namespace_name, class_name, message, attributes)
#define ERS_EMPTY