DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
StreamManager.hpp
Go to the documentation of this file.
1/*
2 * StreamManager.h
3 * ers
4 *
5 * Created by Serguei Kolos on 21.11.05.
6 * Copyright 2005 CERN. All rights reserved.
7 *
8 */
9
10#ifndef ERS_STREAM_MANAGER_H
11#define ERS_STREAM_MANAGER_H
12
13#include <initializer_list>
14
15#include <memory>
16#include <mutex>
17
18#include <ers/Severity.hpp>
19#include <ers/Context.hpp>
20#include <ers/IssueReceiver.hpp>
21#include <ers/StreamFactory.hpp>
23
24#include <list>
25
31namespace ers
32{
33 class InputStream;
34 class LocalStream;
35 class OutputStream;
36 class ErrorHandler;
37 class Issue;
38 class StreamInitializer;
39 template <class > class SingletonCreator;
40
59 {
60 friend class StreamInitializer;
61 friend class ers::LocalStream;
62 friend class ers::ErrorHandler;
63 template <class > friend class SingletonCreator;
64
65 public:
66
68
69 static StreamManager & instance();
71 void debug( const Issue & issue, int level );
73 void error( const Issue & issue );
75 void fatal( const Issue & issue );
77 void information( const Issue & issue );
79 void log( const Issue & issue );
81 void warning( const Issue & issue );
83 void add_receiver( const std::string & stream,
84 const std::string & filter,
85 ers::IssueReceiver * receiver );
86
87 void add_receiver( const std::string & stream,
88 const std::initializer_list<std::string> & params,
89 ers::IssueReceiver * receiver );
90
91 void remove_receiver( ers::IssueReceiver * receiver );
92
94
95 void report_issue( ers::severity type, const Issue & issue );
96
97 private:
99
101 OutputStream * setup_stream( const std::vector<std::string> & streams );
102
104 std::mutex m_mutex;
105 std::list<std::shared_ptr<InputStream> > m_in_streams;
106 std::shared_ptr<OutputStream> m_init_streams[ers::Fatal + 1];
107 std::shared_ptr<OutputStream> m_out_streams[ers::Fatal + 1];
108 };
109
110 std::ostream & operator<<( std::ostream &, const ers::StreamManager & );
111}
112
113#endif
114
ERS Issue receiver interface.
Base class for any user define issue.
Definition Issue.hpp:69
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
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
std::shared_ptr< OutputStream > m_out_streams[ers::Fatal+1]
array of pointers to streams per severity
void remove_receiver(ers::IssueReceiver *receiver)
CTB Buffer Issue
std::ostream & operator<<(std::ostream &, const ers::Configuration &)
severity
Definition Severity.hpp:26
@ Fatal
Definition Severity.hpp:26
Factory couldn t std::string alg_name Invalid configuration error
Definition Issues.hpp:34