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 <queue>
33
#include <mutex>
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
{
47
class
Issue;
48
template
<
class
>
class
SingletonCreator;
49
50
class
IssueCatcherHandler;
51
57
58
class
LocalStream
59
{
60
friend
class
IssueCatcherHandler;
61
template
<
class
>
friend
class
SingletonCreator;
62
63
public
:
64
66
static
LocalStream & instance();
67
69
IssueCatcherHandler * set_issue_catcher(
70
const
std::function<
void
(
const
ers::Issue
& )> & catcher );
71
72
void
error
(
const
ers::Issue
& issue );
73
74
void
fatal(
const
ers::Issue
& issue );
75
76
void
warning(
const
ers::Issue
& issue );
77
78
private
:
79
LocalStream( );
80
~LocalStream( );
81
82
void
remove_issue_catcher();
83
84
void
report_issue(
ers::severity
type
,
const
ers::Issue
& issue );
85
86
void
thread_wrapper();
87
88
private
:
89
std::function<void (
const
ers::Issue
& )> m_issue_catcher;
90
std::unique_ptr<std::thread> m_issue_catcher_thread;
91
std::mutex m_mutex;
92
std::condition_variable m_condition;
93
bool
m_terminated;
94
std::queue<ers::Issue *> m_issues;
95
std::thread::id m_catcher_thread_id;
96
};
97
}
98
99
#endif
100
IssueCatcherHandler.hpp
ERS_EMPTY
#define ERS_EMPTY
Definition
IssueDeclarationMacro.hpp:22
Issue.hpp
type
type
Definition
TriggerActivity_serialization.hpp:48
ers::Issue
Base class for any user define issue.
Definition
Issue.hpp:80
ERS_DECLARE_ISSUE
#define ERS_DECLARE_ISSUE( namespace_name, class_name, message_, attributes)
Definition
macro.hpp:65
ers
Definition
Logger.hxx:202
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.17.0