DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
Variable.hpp
Go to the documentation of this file.
1// *** this file is generated by oksdalgen, do not modify it ***
2
3#ifndef _Variable_0_dunedaq__confmodel_0_confmodel_H_
4#define _Variable_0_dunedaq__confmodel_0_confmodel_H_
5
6#include <stdint.h> // to define 64 bits types
7#include <iostream>
8#include <sstream>
9#include <string>
10#include <map>
11#include <vector>
12
14#include "conffwk/DalObject.hpp"
15
16 // include files for classes used in inheritance hierarchy
17
19
20namespace dunedaq {
21 namespace confmodel {
22
28
29 friend class conffwk::Configuration;
30 friend class conffwk::DalObject;
31 friend class conffwk::DalFactory;
32 friend class conffwk::DalRegistry;
33
34 protected:
35
37 virtual ~Variable() noexcept;
38 virtual void init(bool init_children);
39
40 public:
41
44 static const std::string& s_class_name;
45
46
56 virtual void print(unsigned int offset, bool print_header, std::ostream& s) const;
57
58
68 virtual std::vector<const dunedaq::conffwk::DalObject *> get(const std::string& name, bool upcast_unregistered = true) const;
69
70
71 protected:
72
73 bool get(const std::string& name, std::vector<const dunedaq::conffwk::DalObject *>& vec, bool upcast_unregistered, bool first_call) const;
74
75
76 private:
77
78 std::string m_name;
79 std::string m_value;
80
81
82 public:
83
84 // attribute names
85
86 inline static const std::string s_name = "name";
87 inline static const std::string s_value = "value";
88
89 static const std::string& __get_name_str() noexcept { return s_name; }
90 static const std::string& __get_value_str() noexcept { return s_value; }
91
92
100 const std::string&
101 get_name() const
102 {
103 std::lock_guard scoped_lock(m_mutex);
104 check();
105 check_init();
106 return m_name;
107 }
108
116 void
117 set_name(const std::string& value)
118 {
119 std::lock_guard scoped_lock(m_mutex);
120 check();
121 clear();
122 p_obj.set_by_ref(s_name, value);
123 }
124
125
133 const std::string&
134 get_value() const
135 {
136 std::lock_guard scoped_lock(m_mutex);
137 check();
138 check_init();
139 return m_value;
140 }
141
149 void
150 set_value(const std::string& value)
151 {
152 std::lock_guard scoped_lock(m_mutex);
153 check();
154 clear();
155 p_obj.set_by_ref(s_value, value);
156 }
157
158
159 };
160
161 // out stream operator
162
163 inline std::ostream& operator<<(std::ostream& s, const Variable& obj)
164 {
165 return obj.print_object(s);
166 }
167
168 typedef std::vector<const Variable*>::const_iterator VariableIterator;
169
170 }
171}
172
173#endif
void set_by_ref(const std::string &name, T &value)
Set attribute value.
The base class for any generated DAL object.
Definition DalObject.hpp:45
std::mutex m_mutex
Used to protect changes of DAL object.
ConfigObject p_obj
Config object used by given template object.
void check_init() const
Check and initialize object if necessary.
DalRegistry: A registry of DalObjects It provides a single interface to create, cache and manage DalO...
const std::string & get_name() const
Get "name" attribute value. Name of the variable.
Definition Variable.hpp:101
static const std::string & __get_name_str() noexcept
Definition Variable.hpp:89
void set_name(const std::string &value)
Set "name" attribute value. Name of the variable.
Definition Variable.hpp:117
virtual void init(bool init_children)
Definition Variable.cpp:62
friend class conffwk::DalFactory
Definition Variable.hpp:31
const std::string & get_value() const
Get "value" attribute value. Value of the variable.
Definition Variable.hpp:134
friend class conffwk::DalObject
Definition Variable.hpp:30
static const std::string s_value
Definition Variable.hpp:87
virtual std::vector< const dunedaq::conffwk::DalObject * > get(const std::string &name, bool upcast_unregistered=true) const
Get values of relationships and results of some algorithms as a vector of dunedaq::conffwk::DalObject...
Definition Variable.cpp:81
void set_value(const std::string &value)
Set "value" attribute value. Value of the variable.
Definition Variable.hpp:150
static const std::string & s_class_name
Definition Variable.hpp:44
virtual ~Variable() noexcept
Variable(conffwk::DalRegistry &db, const conffwk::ConfigObject &obj) noexcept
static const std::string s_name
Definition Variable.hpp:86
static const std::string & __get_value_str() noexcept
Definition Variable.hpp:90
conffwk entry point
double offset
std::vector< constVariable * >::const_iterator VariableIterator
Definition Variable.hpp:168
std::ostream & operator<<(std::ostream &s, const ActionPlan &obj)
Including Qt Headers.