DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
IssueFactory.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/IssueFactory.h to include/ers/IssueFactory.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 * IssueFactory.h
14 * ers
15 *
16 * Created by Matthias Wiesmann on 30.11.04.
17 * Modified by Serguei Kolos on 10.08.05.
18 * Copyright 2005 CERN. All rights reserved.
19 *
20 */
21
22#ifndef ERS_ISSUE_FACTORY
23#define ERS_ISSUE_FACTORY
24
25#include <chrono>
26#include <map>
27#include <string>
28#include <vector>
29
30#include <ers/Severity.hpp>
31
37
38using std::chrono::system_clock;
39
40namespace ers {
41class Issue;
42class Context;
43template<class>
45
54
56{
57 template<class>
58 friend class SingletonCreator;
59
60 typedef Issue* (*IssueCreator)(const ers::Context&);
61 typedef std::map<std::string, IssueCreator> FunctionMap;
62
63public:
64 static IssueFactory& instance();
65
66 Issue* create(const std::string& name,
67 const Context& context) const;
68
69 Issue* create(const std::string& name,
70 const std::list<std::string>& inheritance,
71 const Context& context,
73 const system_clock::time_point& time,
74 const std::string& message,
75 const std::vector<std::string>& qualifiers,
76 const std::map<std::string, std::string>& parameters,
77 const Issue* cause = 0) const;
78
79 void register_issue(const std::string& name, IssueCreator creator);
80
81private:
83
85};
86
87std::ostream&
88operator<<(std::ostream&, const IssueFactory& factory);
89}
90
91#endif
An abstract interface to access an Issue context.
Definition Context.hpp:40
Implements factory pattern for user defined Issues.
Issue *(*) IssueCreator(const ers::Context &)
friend class SingletonCreator
static IssueFactory & instance()
method to access singleton
Issue * create(const std::string &name, const std::list< std::string > &inheritance, const Context &context, Severity severity, const system_clock::time_point &time, const std::string &message, const std::vector< std::string > &qualifiers, const std::map< std::string, std::string > &parameters, const Issue *cause=0) const
build issue out of all the given parameters
void register_issue(const std::string &name, IssueCreator creator)
register an issue factory
std::map< std::string, IssueCreator > FunctionMap
FunctionMap m_creators
Issue * create(const std::string &name, const Context &context) const
build an empty issue for a given name
Base class for any user define issue.
Definition Issue.hpp:76
message(message)
Definition __init__.py:84
std::ostream & operator<<(std::ostream &, const ers::Configuration &)
severity
Definition Severity.hpp:37