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 <string>
27#include <vector>
28#include <map>
29
30#include <ers/Severity.hpp>
31
37
38using std::chrono::system_clock;
39
40namespace ers
41{
42 class Issue;
43 class Context;
44 template <class > class SingletonCreator;
45
54
56 {
57 template <class > friend class SingletonCreator;
58
59 typedef Issue * (*IssueCreator)( const ers::Context & );
60 typedef std::map<std::string,IssueCreator> FunctionMap;
61
62 public:
63 static IssueFactory & instance();
64
65 Issue * create( const std::string & name,
66 const Context & context ) const ;
67
68 Issue * create( const std::string & name,
69 const std::list<std::string> & inheritance,
70 const Context & context,
72 const system_clock::time_point & time,
73 const std::string & message,
74 const std::vector<std::string> & qualifiers,
75 const std::map<std::string, std::string> & parameters,
76 const Issue * cause = 0 ) const ;
77
78 void register_issue( const std::string & name, IssueCreator creator );
79
80 private:
82 { ; }
83
85 };
86
87 std::ostream& operator<<(std::ostream&, const IssueFactory& factory);
88}
89
90#endif
91
An abstract interface to access an Issue context.
Definition Context.hpp:41
Implements factory pattern for user defined Issues.
friend class SingletonCreator
static IssueFactory & instance()
method to access singleton
Issue *(* IssueCreator)(const ers::Context &)
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:80
message(message)
Definition __init__.py:84
std::ostream & operator<<(std::ostream &, const ers::Configuration &)
severity
Definition Severity.hpp:37