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/Context.hpp>
30#include <ers/IssueReceiver.hpp>
31#include <ers/Severity.hpp>
32#include <ers/StreamFactory.hpp>
34
35#include <list>
36
42namespace ers {
43class InputStream;
44class LocalStream;
45class OutputStream;
46class ErrorHandler;
47class Issue;
49template<class>
51
68
70{
71 friend class StreamInitializer;
72 friend class ers::LocalStream;
73 friend class ers::ErrorHandler;
74 template<class>
75 friend class SingletonCreator;
76
77public:
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, const std::string& filter, ers::IssueReceiver* receiver);
95
96 void add_receiver(const std::string& stream,
97 const std::initializer_list<std::string>& params,
98 ers::IssueReceiver* receiver);
99
100 void remove_receiver(ers::IssueReceiver* receiver);
101
103
104 void report_issue(ers::severity type, const Issue& issue);
105
106private:
108
110 OutputStream* setup_stream(const std::vector<std::string>& streams);
111
113 std::mutex m_mutex;
114 std::list<std::shared_ptr<InputStream>> m_in_streams;
115 std::shared_ptr<OutputStream> m_init_streams[ers::Fatal + 1];
116 std::shared_ptr<OutputStream> m_out_streams[ers::Fatal + 1];
117};
118
119std::ostream&
120operator<<(std::ostream&, const ers::StreamManager&);
121}
122
123#endif
ERS Issue input stream interface.
ERS Issue receiver interface.
Base class for any user define issue.
Definition Issue.hpp:76
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)
void error(const Issue &issue)
sends an issue to the error 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:43