DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
ers
src
IssueFactory.cpp
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 src/IssueFactory.cxx to src/IssueFactory.cpp).
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
* IssueFactory.cxx
14
* ers
15
*
16
* Created by Serguei Kolos on 30.11.04.
17
* Modified by Serguei Kolos on 10.08.05.
18
* Copyright 2005 CERN. All rights reserved.
19
*
20
*/
21
22
#include <
ers/ers.hpp
>
23
#include <
ers/IssueFactory.hpp
>
24
#include <
ers/StreamFactory.hpp
>
25
#include <
ers/AnyIssue.hpp
>
26
#include <
ers/internal/SingletonCreator.hpp
>
27
#include <
ers/internal/macro.hpp
>
28
32
ers::IssueFactory
&
33
ers::IssueFactory::instance
()
34
{
35
static
ers::IssueFactory
*
instance
=
ers::SingletonCreator<ers::IssueFactory>::create
();
36
37
return
*
instance
;
38
}
// instance
39
44
void
45
ers::IssueFactory::register_issue
(
const
std::string & name,
IssueCreator
creator )
46
{
47
FunctionMap::const_iterator it =
m_creators
.find(name);
48
if
( it ==
m_creators
.end() )
49
{
50
m_creators
[name] = creator;
51
}
52
}
53
59
ers::Issue
*
60
ers::IssueFactory::create
(
const
std::string & name,
61
const
ers::Context
& context )
const
62
{
63
FunctionMap::const_iterator it =
m_creators
.find(name);
64
if
( it ==
m_creators
.end() )
65
{
66
ERS_INTERNAL_DEBUG
( 1,
"Creator for the \""
<< name <<
"\" issue is not found"
);
67
return
new
ers::AnyIssue
( name, context );
68
}
69
70
ERS_INTERNAL_DEBUG
( 2,
"Creating the \""
<< name <<
"\" issue"
);
71
return
(it->second)( context );
72
}
73
74
75
ers::Issue
*
76
ers::IssueFactory::create
(
const
std::string & name,
77
const
std::list<std::string> & inheritance,
78
const
ers::Context
& context,
79
Severity
severity
,
80
const
system_clock::time_point & time,
81
const
std::string &
message
,
82
const
std::vector<std::string> & qualifiers,
83
const
ers::string_map
& parameters,
84
const
Issue
* cause )
const
85
{
86
ers::Issue
* issue =
create
( name, context );
87
issue->
m_message
=
message
;
88
issue->
m_severity
=
severity
;
89
issue->
m_qualifiers
= qualifiers;
90
issue->
m_values
= parameters;
91
issue->
m_time
= time;
92
issue->
m_cause
.reset( cause );
93
94
auto
* any =
dynamic_cast<
ers::AnyIssue
*
>
( issue );
95
if
( any ) {
96
any -> m_inheritance = inheritance;
97
}
98
return
issue;
99
}
100
AnyIssue.hpp
IssueFactory.hpp
SingletonCreator.hpp
StreamFactory.hpp
ers::AnyIssue
Definition
AnyIssue.hpp:33
ers::Context
An abstract interface to access an Issue context.
Definition
Context.hpp:41
ers::IssueFactory
Implements factory pattern for user defined Issues.
Definition
IssueFactory.hpp:56
ers::IssueFactory::instance
static IssueFactory & instance()
method to access singleton
Definition
IssueFactory.cpp:33
ers::IssueFactory::IssueCreator
Issue *(* IssueCreator)(const ers::Context &)
Definition
IssueFactory.hpp:59
ers::IssueFactory::register_issue
void register_issue(const std::string &name, IssueCreator creator)
register an issue factory
Definition
IssueFactory.cpp:45
ers::IssueFactory::m_creators
FunctionMap m_creators
Definition
IssueFactory.hpp:84
ers::IssueFactory::create
Issue * create(const std::string &name, const Context &context) const
build an empty issue for a given name
Definition
IssueFactory.cpp:60
ers::Issue
Base class for any user define issue.
Definition
Issue.hpp:80
ers::Issue::m_severity
Severity m_severity
Issue's severity.
Definition
Issue.hpp:188
ers::Issue::m_time
system_clock::time_point m_time
Time when issue was thrown.
Definition
Issue.hpp:189
ers::Issue::m_cause
std::unique_ptr< const Issue > m_cause
Issue that caused the current issue.
Definition
Issue.hpp:184
ers::Issue::m_values
string_map m_values
List of user defined attributes.
Definition
Issue.hpp:190
ers::Issue::m_message
std::string m_message
Issue's explanation text.
Definition
Issue.hpp:186
ers::Issue::m_qualifiers
std::vector< std::string > m_qualifiers
List of associated qualifiers.
Definition
Issue.hpp:187
ers::SingletonCreator::create
static T * create()
Definition
SingletonCreator.hpp:40
macro.hpp
ERS_INTERNAL_DEBUG
#define ERS_INTERNAL_DEBUG(level, message)
Definition
macro.hpp:37
ers.hpp
ers.message
message(message)
Definition
__init__.py:84
ers::string_map
std::map< std::string, std::string > string_map
Definition
Issue.hpp:53
ers::severity
severity
Definition
Severity.hpp:37
ers::Severity
Definition
Severity.hpp:40
Generated on
for DUNE-DAQ by
1.17.0