DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
OksConfigObject.hpp
Go to the documentation of this file.
1//
2// DUNE DAQ modification notice:
3// This file has been modified from the original ATLAS oksconfig source for the DUNE DAQ project.
4// Fork baseline commit: oksconfig-03-02-00 (2021-04-20).
5// Renamed since fork: yes (from oksconfig/OksConfigObject.h to include/oksconflibs/OksConfigObject.hpp).
6//
7
8// this is -*- c++ -*-
9#ifndef OKSCONFLIBS_OKSCONFLIBSOBJECT_H_
10#define OKSCONFLIBS_OKSCONFLIBSOBJECT_H_
11
12#include <string>
13#include <vector>
14
15#include "oks/kernel.hpp"
16#include "oks/object.hpp"
17
19
20namespace dunedaq {
21namespace oksconflibs {
22
23class ConfigurationImpl;
25
27{
28
29 friend class ConfigurationImpl;
30 friend class OksConfiguration;
31
32public:
34 virtual ~OksConfigObject() noexcept;
35
36public:
37 virtual const std::string contained_in() const;
38
39 virtual void get(const std::string& name, bool& value);
40 virtual void get(const std::string& name, uint8_t& value);
41 virtual void get(const std::string& name, int8_t& value);
42 virtual void get(const std::string& name, uint16_t& value);
43 virtual void get(const std::string& name, int16_t& value);
44 virtual void get(const std::string& name, uint32_t& value);
45 virtual void get(const std::string& name, int32_t& value);
46 virtual void get(const std::string& name, uint64_t& value);
47 virtual void get(const std::string& name, int64_t& value);
48 virtual void get(const std::string& name, float& value);
49 virtual void get(const std::string& name, double& value);
50 virtual void get(const std::string& name, std::string& value);
51 virtual void get(const std::string& name, conffwk::ConfigObject& value);
52
53 virtual void get(const std::string& name, std::vector<bool>& value);
54 virtual void get(const std::string& name, std::vector<uint8_t>& value);
55 virtual void get(const std::string& name, std::vector<int8_t>& value);
56 virtual void get(const std::string& name, std::vector<uint16_t>& value);
57 virtual void get(const std::string& name, std::vector<int16_t>& value);
58 virtual void get(const std::string& name, std::vector<uint32_t>& value);
59 virtual void get(const std::string& name, std::vector<int32_t>& value);
60 virtual void get(const std::string& name, std::vector<uint64_t>& value);
61 virtual void get(const std::string& name, std::vector<int64_t>& value);
62 virtual void get(const std::string& name, std::vector<float>& value);
63 virtual void get(const std::string& name, std::vector<double>& value);
64 virtual void get(const std::string& name, std::vector<std::string>& value);
65 virtual void get(const std::string& name, std::vector<conffwk::ConfigObject>& value);
66
67 virtual bool rel(const std::string& name, std::vector<conffwk::ConfigObject>& value);
68 virtual void referenced_by(std::vector<conffwk::ConfigObject>& value,
69 const std::string& association,
70 bool check_composite_only,
71 unsigned long rlevel,
72 const std::vector<std::string>* rclasses) const;
73
74 virtual void set(const std::string& name, bool value);
75 virtual void set(const std::string& name, uint8_t value);
76 virtual void set(const std::string& name, int8_t value);
77 virtual void set(const std::string& name, uint16_t value);
78 virtual void set(const std::string& name, int16_t value);
79 virtual void set(const std::string& name, uint32_t value);
80 virtual void set(const std::string& name, int32_t value);
81 virtual void set(const std::string& name, uint64_t value);
82 virtual void set(const std::string& name, int64_t value);
83 virtual void set(const std::string& name, float value);
84 virtual void set(const std::string& name, double value);
85 virtual void set(const std::string& name, const std::string& value);
86
87 virtual void set_enum(const std::string& attribute, const std::string& value);
88 virtual void set_date(const std::string& attribute, const std::string& value);
89 virtual void set_time(const std::string& attribute, const std::string& value);
90
91 virtual void set_class(const std::string& attribute, const std::string& value);
92
93 virtual void set(const std::string& name, const std::vector<bool>& value);
94 virtual void set(const std::string& name, const std::vector<uint8_t>& value);
95 virtual void set(const std::string& name, const std::vector<int8_t>& value);
96 virtual void set(const std::string& name, const std::vector<uint16_t>& value);
97 virtual void set(const std::string& name, const std::vector<int16_t>& value);
98 virtual void set(const std::string& name, const std::vector<uint32_t>& value);
99 virtual void set(const std::string& name, const std::vector<int32_t>& value);
100 virtual void set(const std::string& name, const std::vector<uint64_t>& value);
101 virtual void set(const std::string& name, const std::vector<int64_t>& value);
102 virtual void set(const std::string& name, const std::vector<float>& value);
103 virtual void set(const std::string& name, const std::vector<double>& value);
104 virtual void set(const std::string& name, const std::vector<std::string>& value);
105
106 virtual void set_enum(const std::string& attribute, const std::vector<std::string>& value);
107 virtual void set_date(const std::string& attribute, const std::vector<std::string>& value);
108 virtual void set_time(const std::string& attribute, const std::vector<std::string>& value);
109
110 virtual void set_class(const std::string& attribute, const std::vector<std::string>& value);
111
112 virtual void set(const std::string& name, const conffwk::ConfigObject* value, bool skip_non_null_check);
113 virtual void set(const std::string& name,
114 const std::vector<const conffwk::ConfigObject*>& value,
115 bool skip_non_null_check);
116
117 virtual void move(const std::string& at);
118 virtual void rename(const std::string& new_id);
119
120 virtual void reset();
121
122public:
123 // required by JNI
124
125 oks::OksData::Type get_type(const std::string& attribute) const;
126
127 // helper functions
128
129private:
130 // extract values out of OKS database
131
132 template<class T>
133 void get_value(const std::string& name, T& value);
134 template<class T>
135 void get_vector(const std::string& name, std::vector<T>& value);
136
137 // set values in OKS database
138
139 void set_attr_value(const std::string& name, oks::OksData& value);
140 void set_rel_value(const std::string& name, oks::OksData& value, bool skip_non_null_check);
141
142 template<class T>
143 void set_value(const std::string& name, const T& value);
144 template<class T>
145 void set_vector(const std::string& name, const std::vector<T>& value);
146
147 // checkout file, if is needed for update
148
149 // void test_checkout_needs();
150
151public:
152 // required by template method insert_object
153 void set(oks::OksObject* obj) { m_obj = obj; }
154
155 // representation
156
157private:
159};
160
161} // namespace oksconflibs
162} // namespace dunedaq
163
164#endif // OKSCONFLIBS_OKSCONFLIBSOBJECT_H_
Implements database objects.
Provides pure virtual interface used by the Configuration class.
OksObject describes instance of OksClass.
Definition object.hpp:1144
void set_vector(const std::string &name, const std::vector< T > &value)
virtual const std::string contained_in() const
Virtual method to get object's database file name.
virtual void set_date(const std::string &attribute, const std::string &value)
Virtual method to set date attribute value.
void set_value(const std::string &name, const T &value)
virtual void set_enum(const std::string &attribute, const std::string &value)
Virtual method to set enumeration attribute value.
virtual void set(const std::string &name, bool value)
Virtual method to set boolean attribute value.
virtual void move(const std::string &at)
Virtual method to move object to a file.
void set_attr_value(const std::string &name, oks::OksData &value)
virtual void set_class(const std::string &attribute, const std::string &value)
Virtual method to set enumeration attribute value.
void set_rel_value(const std::string &name, oks::OksData &value, bool skip_non_null_check)
void get_value(const std::string &name, T &value)
void get_vector(const std::string &name, std::vector< T > &value)
virtual void set_time(const std::string &attribute, const std::string &value)
Virtual method to set time attribute value.
virtual void referenced_by(std::vector< conffwk::ConfigObject > &value, const std::string &association, bool check_composite_only, unsigned long rlevel, const std::vector< std::string > *rclasses) const
oks::OksData::Type get_type(const std::string &attribute) const
virtual void get(const std::string &name, bool &value)
Virtual method to read boolean attribute value.
virtual void rename(const std::string &new_id)
Virtual method to change object ID.
virtual bool rel(const std::string &name, std::vector< conffwk::ConfigObject > &value)
OksConfigObject(oks::OksObject *obj, conffwk::ConfigurationImpl *impl) noexcept
virtual void reset()
Virtual method to reset the implementation object from unknown state.
The DUNE-DAQ namespace.
msgpack::object obj
Definition ral.hpp:59