DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
StreamManager.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/StreamManager.h to include/ers/StreamManager.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/*
13 * StreamManager.h
14 * ers
15 *
16 * Created by Serguei Kolos on 21.11.05.
17 * Copyright 2005 CERN. All rights reserved.
18 *
19 */
20
21#ifndef ERS_STREAM_MANAGER_H
22#define ERS_STREAM_MANAGER_H
23
24#include <initializer_list>
25
26#include <memory>
27#include <mutex>
28
29#include <ers/Severity.hpp>
30#include <ers/Context.hpp>
31#include <ers/IssueReceiver.hpp>
32#include <ers/StreamFactory.hpp>
34
35#include <list>
36
42namespace ers
43{
44 class InputStream;
45 class LocalStream;
46 class OutputStream;
47 class ErrorHandler;
48 class Issue;
50 template <class > class SingletonCreator;
51
68
70 {
71 friend class StreamInitializer;
72 friend class ers::LocalStream;
73 friend class ers::ErrorHandler;
74 template <class > friend class SingletonCreator;
75
76 public:
77
79
80 static StreamManager & instance();
81
82 void debug( const Issue & issue, int level );
83
84 void error( const Issue & issue );
85
86 void fatal( const Issue & issue );
87
88 void information( const Issue & issue );
89
90 void log( const Issue & issue );
91
92 void warning( const Issue & issue );
93
94 void add_receiver( const std::string & stream,
95 const std::string & filter,
96 ers::IssueReceiver * receiver );
97
98 void add_receiver( const std::string & stream,
99 const std::initializer_list<std::string> & params,
100 ers::IssueReceiver * receiver );
101
102 void remove_receiver( ers::IssueReceiver * receiver );
103
105
106 void report_issue( ers::severity type, const Issue & issue );
107
108 private:
109 StreamManager( );
110
112 OutputStream * setup_stream( const std::vector<std::string> & streams );
113
115 std::mutex m_mutex;
116 std::list<std::shared_ptr<InputStream> > m_in_streams;
117 std::shared_ptr<OutputStream> m_init_streams[ers::Fatal + 1];
118 std::shared_ptr<OutputStream> m_out_streams[ers::Fatal + 1];
119 };
120
121 std::ostream & operator<<( std::ostream &, const ers::StreamManager & );
122}
123
124#endif
125
ERS Issue input stream interface.
ERS Issue receiver interface.
Base class for any user define issue.
Definition Issue.hpp:80
ERS abstract output stream interface.
This class manages and provides access to ERS streams.
PluginManager m_plugin_manager
void add_output_stream(ers::severity severity, ers::OutputStream *new_stream)
std::shared_ptr< OutputStream > m_init_streams[ers::Fatal+1]
array of pointers to streams per severity
friend class SingletonCreator
OutputStream * setup_stream(ers::severity severity)
void warning(const Issue &issue)
sends an issue to the warning stream
static StreamManager & instance()
return the singleton
friend class ers::ErrorHandler
std::list< std::shared_ptr< InputStream > > m_in_streams
void report_issue(ers::severity type, const Issue &issue)
void log(const Issue &issue)
sends an issue to the log stream
void fatal(const Issue &issue)
sends an issue to the fatal stream
void add_receiver(const std::string &stream, const std::string &filter, ers::IssueReceiver *receiver)
friend class ers::LocalStream
void debug(const Issue &issue, int level)
sends an Issue to the debug stream
void information(const Issue &issue)
sends an issue to the information stream
friend class StreamInitializer
std::shared_ptr< OutputStream > m_out_streams[ers::Fatal+1]
array of pointers to streams per severity
void remove_receiver(ers::IssueReceiver *receiver)
std::ostream & operator<<(std::ostream &, const ers::Configuration &)
severity
Definition Severity.hpp:37
@ Fatal
Definition Severity.hpp:37
Factory couldn t std::string alg_name Invalid configuration error
Definition Issues.hpp:34