DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
ers
include
ers
LocalStream.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/LocalStream.h to include/ers/LocalStream.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_LOCAL_STREAM_H
13
#define ERS_LOCAL_STREAM_H
14
15
/*
16
* LocalStream.h
17
* ers
18
*
19
* Created by Serguei Kolos on 21.11.05.
20
* Copyright 2005 CERN. All rights reserved.
21
*
22
*/
23
28
29
#include <condition_variable>
30
#include <functional>
31
#include <iostream>
32
#include <mutex>
33
#include <queue>
34
#include <thread>
35
36
#include <
ers/Issue.hpp
>
37
#include <
ers/IssueCatcherHandler.hpp
>
38
39
ERS_DECLARE_ISSUE
(
ers
,
// namespace
40
IssueCatcherAlreadySet,
// issue class name
41
"Local error catcher has been already set"
,
//
42
ERS_EMPTY
// no attributes
43
)
44
45
namespace
ers
{
46
class
Issue;
47
template
<
class
>
48
class
SingletonCreator;
49
50
class
IssueCatcherHandler;
51
57
58
class
LocalStream
59
{
60
friend
class
IssueCatcherHandler;
61
template
<
class
>
62
friend
class
SingletonCreator;
63
64
public
:
66
static
LocalStream& instance();
67
69
IssueCatcherHandler* set_issue_catcher(
const
std::function<
void
(
const
ers::Issue
&)>& catcher);
70
71
void
error
(
const
ers::Issue
& issue);
72
73
void
fatal(
const
ers::Issue
& issue);
74
75
void
warning(
const
ers::Issue
& issue);
76
77
private
:
78
LocalStream();
79
~LocalStream();
80
81
void
remove_issue_catcher();
82
83
void
report_issue(
ers::severity
type
,
const
ers::Issue
& issue);
84
85
void
thread_wrapper();
86
87
private
:
88
std::function<void(
const
ers::Issue
&)> m_issue_catcher;
89
std::unique_ptr<std::thread> m_issue_catcher_thread;
90
std::mutex m_mutex;
91
std::condition_variable m_condition;
92
bool
m_terminated;
93
std::queue<ers::Issue*> m_issues;
94
std::thread::id m_catcher_thread_id;
95
};
96
}
97
98
#endif
IssueCatcherHandler.hpp
ERS_EMPTY
#define ERS_EMPTY
Definition
IssueDeclarationMacro.hpp:23
Issue.hpp
type
type
Definition
TriggerActivity_serialization.hpp:48
ers::Issue
Base class for any user define issue.
Definition
Issue.hpp:76
ERS_DECLARE_ISSUE
#define ERS_DECLARE_ISSUE(namespace_name, class_name, message_, attributes)
Definition
macro.hpp:71
ers
Definition
Logger.hxx:231
ers::severity
severity
Definition
Severity.hpp:37
error
Factory couldn t std::string alg_name Invalid configuration error
Definition
Issues.hpp:34
Generated on
for DUNE-DAQ by
1.18.0