DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
triggeralgs
include
triggeralgs
AbstractFactory.hpp
Go to the documentation of this file.
1
/* @file: AbstractFactory.hpp
2
*
3
* This is part of the DUNE DAQ Application Framework, copyright 2023.
4
* Licensing/copyright details are in the COPYING file that you should have
5
* received with this code.
6
*/
7
8
#ifndef TRIGGERALGS_ABSTRACT_FACTORY_HPP_
9
#define TRIGGERALGS_ABSTRACT_FACTORY_HPP_
10
11
#include "
logging/Logging.hpp
"
12
13
#include <functional>
14
#include <memory>
15
#include <string>
16
#include <unordered_map>
17
18
namespace
triggeralgs
{
19
20
template
<
typename
T>
21
class
AbstractFactory
22
{
23
using
maker_creator
= std::function<std::unique_ptr<T>()>;
24
using
creation_map
= std::unordered_map<std::string, maker_creator>;
25
26
public
:
27
AbstractFactory
() {}
28
AbstractFactory
(
const
AbstractFactory
&) =
delete
;
29
AbstractFactory
&
operator=
(
const
AbstractFactory
&) =
delete
;
30
virtual
~AbstractFactory
() {}
31
32
std::unique_ptr<T>
build_maker
(
const
std::string& alg_name);
33
34
static
void
register_creator
(
const
std::string alg_name,
maker_creator
creator);
35
36
static
std::shared_ptr<AbstractFactory<T>>
get_instance
();
37
38
protected
:
39
static
std::shared_ptr<AbstractFactory<T>>
s_single_factory
;
40
41
private
:
42
static
creation_map
&
get_makers
();
43
};
44
45
}
/* namespace triggeralgs */
46
47
#include "
triggeralgs/AbstractFactory.hxx
"
48
49
#endif
// TRIGGERALGS_ABSTRACT_FACTORY_HPP_
triggeralgs::AbstractFactory::AbstractFactory
AbstractFactory(const AbstractFactory &)=delete
triggeralgs::AbstractFactory::operator=
AbstractFactory & operator=(const AbstractFactory &)=delete
triggeralgs::AbstractFactory::get_makers
static creation_map & get_makers()
Definition
AbstractFactory.hxx:19
triggeralgs::AbstractFactory::get_instance
static std::shared_ptr< AbstractFactory< T > > get_instance()
Definition
AbstractFactory.hxx:54
triggeralgs::AbstractFactory::s_single_factory
static std::shared_ptr< AbstractFactory< T > > s_single_factory
Definition
AbstractFactory.hpp:39
triggeralgs::AbstractFactory::creation_map
std::unordered_map< std::string, maker_creator > creation_map
Definition
AbstractFactory.hpp:24
triggeralgs::AbstractFactory::~AbstractFactory
virtual ~AbstractFactory()
Definition
AbstractFactory.hpp:30
triggeralgs::AbstractFactory::register_creator
static void register_creator(const std::string alg_name, maker_creator creator)
Definition
AbstractFactory.hxx:25
triggeralgs::AbstractFactory::build_maker
std::unique_ptr< T > build_maker(const std::string &alg_name)
Definition
AbstractFactory.hxx:39
triggeralgs::AbstractFactory::maker_creator
std::function< std::unique_ptr< T >()> maker_creator
Definition
AbstractFactory.hpp:23
triggeralgs::AbstractFactory::AbstractFactory
AbstractFactory()
Definition
AbstractFactory.hpp:27
Logging.hpp
triggeralgs
Definition
AbstractFactory.hpp:18
AbstractFactory.hxx
Generated on
for DUNE-DAQ by
1.17.0