DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
conffwk
include
conffwk
DalFactory.hpp
Go to the documentation of this file.
1
#ifndef DAL_FACTORY_H
2
#define DAL_FACTORY_H
3
4
#include <map>
5
#include <mutex>
6
#include <string>
7
8
#include "
ers/ers.hpp
"
9
10
#include "
conffwk/DalFactoryFunctions.hpp
"
11
#include "
conffwk/set.hpp
"
12
13
#include "
logging/Logging.hpp
"
14
15
namespace
dunedaq
{
16
17
ERS_DECLARE_ISSUE
(
conffwk
,
18
DalPackageNameNotFound,
19
"Failed to find the dal package name for class "
<< class_name <<
" in its schema path '"
20
<< schema_path <<
"'"
,
21
((std::string)class_name)((std::string)schema_path))
22
23
ERS_DECLARE_ISSUE
(
conffwk
,
LoadDalFailed
,
"Could not load dal shared library "
<< library, ((std::string)library))
24
25
namespace
conffwk
{
26
27
class
DalObject;
28
class
DalRegistry;
29
30
class
DalFactory
31
{
32
33
typedef
std::function<DalObject*(DalRegistry& db, ConfigObject&
obj
)> dal_object_instatiator_2g;
34
35
public
:
37
static
DalFactory& instance();
38
39
// /** register DAL object creator by class name*/
40
// template<class T>
41
// void
42
// register_dal_class(const std::string & name, const std::set<std::string>& algorithms);
43
45
template
<
class
T>
46
void
register_dal_class(
const
std::string& name);
47
48
const
std::string& get_known_class_name_ref(
const
std::string& name);
49
62
63
DalObject* get(Configuration& db, ConfigObject&
obj
,
const
std::string& uid,
bool
upcast_unregistered)
const
;
64
65
DalObject* get(Configuration& db, ConfigObject&
obj
,
const
std::string& uid,
const
std::string& class_name)
const
;
66
76
77
const
DalFactoryFunctions& functions(Configuration& db,
const
std::string& name,
bool
upcast_unregistered);
78
79
const
std::string& class4algo(Configuration& db,
const
std::string& name,
const
std::string&
algorithm
)
const
;
80
87
88
const
DalFactoryFunctions& functions(
const
std::string& name)
const
;
89
93
conffwk::DalObject
* make(
conffwk::DalRegistry
& db,
conffwk::ConfigObject
& o,
bool
upcast_unregistered);
94
95
conffwk::DalObject
* make(
conffwk::DalRegistry
& db,
conffwk::ConfigObject
& o,
const
std::string& fallback_class =
""
);
96
97
private
:
98
std::mutex m_class_mutex;
99
std::map<std::string, DalFactoryFunctions> m_classes;
100
101
// std::map<std::string, dal_object_instatiator> m_instantiators;
102
std::map<std::string, dal_object_instatiator_2g> m_creators;
103
104
std::mutex m_known_class_mutex;
105
conffwk::set
m_known_classes;
106
107
// Move into a dedicated class/function
108
bool
try_load_class_library(Configuration& db,
const
std::string& class_name);
109
};
110
111
}
// namespace conffwk
112
}
// namespace dunedaq
113
114
#include "
details/DalFactory.hxx
"
115
116
#endif
DalFactoryFunctions.hpp
DalFactory.hxx
algorithm
algorithm
Definition
TriggerActivity_serialization.hpp:49
dunedaq::conffwk::DalObject
The base class for any generated DAL object.
Definition
DalObject.hpp:51
dunedaq::conffwk::DalRegistry
DalRegistry: A registry of DalObjects It provides a single interface to create, cache and manage DalO...
Definition
DalRegistry.hpp:19
ers.hpp
Logging.hpp
conffwk.ConfigObject
Definition
ConfigObject.py:1
conffwk
Definition
__init__.py:1
dunedaq::conffwk::set
std::unordered_set< std::string > set
Definition
set.hpp:16
dunedaq
The DUNE-DAQ namespace.
Definition
cib_utilities.cpp:5
dunedaq::LoadDalFailed
LoadDalFailed
Definition
confmodelIssues.hpp:12
dunedaq::obj
msgpack::object obj
Definition
Serialization.hpp:252
dunedaq::ERS_DECLARE_ISSUE
ERS_DECLARE_ISSUE(cibmodules, CIBCommunicationError, " CIB Hardware Communication Error: "<< descriptor,((std::string) descriptor)) ERS_DECLARE_ISSUE(cibmodules
set.hpp
Generated on
for DUNE-DAQ by
1.18.0