DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
macro.hpp
Go to the documentation of this file.
1/*
2 * DUNE DAQ modification notice:
3 * This file has been modified from the original ATLAS ers source for the DUNE DAQ project.
4 * Fork baseline commit: 8267df82a4f6fe6bf02c4014923eba19eddc4614 (2020-04-14).
5 * Renamed since fork: yes (from ers/internal/macro.h to include/ers/internal/macro.hpp).
6 *
7 * Original copyright:
8 * Copyright (C) 2001-2020 CERN for the benefit of the ATLAS collaboration.
9 * Licensed under the Apache License, Version 2.0.
10 */
11
12#ifndef ERS_MACRO_H
13#define ERS_MACRO_H
14
19
20#include <ers/ers.hpp>
21#include <ers/StreamFactory.hpp>
23#include <boost/preprocessor/cat.hpp>
24
25ERS_DECLARE_ISSUE( ers, InternalMessage, ERS_EMPTY, ERS_EMPTY )
26
27#define ERS_REGISTER_OUTPUT_STREAM( class, name, param ) \
28namespace { \
29 struct BOOST_PP_CAT( OutputStreamRegistrator, __LINE__ ) { \
30 static ers::OutputStream * create( const std::string & param ) \
31 { return new class( param ); } \
32 BOOST_PP_CAT( OutputStreamRegistrator, __LINE__ ) ()\
33 { ers::StreamFactory::instance().register_out_stream( name, create ); } \
34 } BOOST_PP_CAT( registrator, __LINE__ ); \
35}
36
37#define ERS_INTERNAL_DEBUG( level, message ) { \
38if ( ers::debug_level() >= level ) \
39{ \
40 std::ostringstream out; \
41 out << message; \
42 ers::InternalMessage info( ERS_HERE, out.str() ); \
43 info.set_severity( ers::Severity( ers::Debug, level ) ); \
44 ers::StandardStreamOutput::println( std::cout, info, 0 ); \
45} }
46
47#define ERS_INTERNAL_INFO( message ) { \
48 std::ostringstream out; \
49 out << message; \
50 ers::InternalMessage info( ERS_HERE, out.str() ); \
51 info.set_severity( ers::Information ); \
52 ers::StandardStreamOutput::println( std::cout, info, 0 ); \
53}
54
55#define ERS_INTERNAL_WARNING( message ) { \
56 std::ostringstream out; \
57 out << message; \
58 ers::InternalMessage info( ERS_HERE, out.str() ); \
59 info.set_severity( ers::Warning ); \
60 ers::StandardStreamOutput::println( std::cerr, info, 0 ); \
61}
62
63#define ERS_INTERNAL_ERROR( message ) { \
64 std::ostringstream out; \
65 out << message; \
66 ers::InternalMessage info( ERS_HERE, out.str() ); \
67 info.set_severity( ers::Error ); \
68 ers::StandardStreamOutput::println( std::cerr, info, 0 ); \
69}
70
71#define ERS_INTERNAL_FATAL( message ) { \
72 std::ostringstream out; \
73 out << message; \
74 ers::InternalMessage info( ERS_HERE, out.str() ); \
75 info.set_severity( ers::Fatal ); \
76 ers::StandardStreamOutput::println( std::cerr, info, 0 ); \
77 ::exit( 13 ); \
78}
79
80#endif
#define ERS_EMPTY
#define ERS_DECLARE_ISSUE( namespace_name, class_name, message_, attributes)
Definition macro.hpp:65