DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dbe::config::api::get::attribute Class Reference

#include <config_api_get.hpp>

Static Public Member Functions

template<typename T>
static T list (dbe::inner::configobject::tref obj, dunedaq::conffwk::attribute_t const &attr)

Static Private Member Functions

template<typename T>
static std::vector< std::string > read (dunedaq::conffwk::ConfigObject &, dunedaq::conffwk::attribute_t const &)
template<typename T>
static std::vector< std::string > read (inner::configobject::tref, dunedaq::conffwk::attribute_t const &)

Friends

class dbe::config::api::get::direct

Detailed Description

Permit retrieving information about attributes

Definition at line 69 of file config_api_get.hpp.

Member Function Documentation

◆ list()

template<typename T>
template QStringList dbe::config::api::get::attribute::list< QStringList > ( dbe::inner::configobject::tref obj,
dunedaq::conffwk::attribute_t const & attr )
inlinestatic

Retrieve a list from of an unspecified type of the values of the attribute of an object

Parameters
objis the reference of the object to operate upon
attris the Attribute type information structure
Returns
a list of type T with the attribute values

Definition at line 160 of file config_api_get.cpp.

161{
162 std::vector<std::string> attrvalues;
163
164 switch (Attribute.p_type) {
165
167 attrvalues = get::attribute::read<bool>(obj, Attribute);
168 break;
169
171
173
175
177
179 attrvalues = get::attribute::read<std::string>(obj, Attribute);
180 break;
181
183 attrvalues = get::attribute::read<float>(obj, Attribute);
184 break;
185
187 attrvalues = get::attribute::read<double>(obj, Attribute);
188 break;
189
191 attrvalues = get::attribute::read<int8_t>(obj, Attribute);
192 break;
193
195 attrvalues = get::attribute::read<u_int8_t>(obj, Attribute);
196 break;
197
199 attrvalues = get::attribute::read<int16_t>(obj, Attribute);
200 break;
201
203 attrvalues = get::attribute::read<u_int16_t>(obj, Attribute);
204 break;
205
207 attrvalues = get::attribute::read<int32_t>(obj, Attribute);
208 break;
209
211 attrvalues = get::attribute::read<u_int32_t>(obj, Attribute);
212 break;
213
215 attrvalues = get::attribute::read<int64_t>(obj, Attribute);
216 break;
217
219 attrvalues = get::attribute::read<u_int64_t>(obj, Attribute);
220 break;
221 }
222
223 return dbe::convert::to<T>(attrvalues);
224}
static std::vector< std::string > read(dunedaq::conffwk::ConfigObject &, dunedaq::conffwk::attribute_t const &)
T to(QStringList const &DataList)

◆ read() [1/2]

template<typename T>
std::vector< std::string > dbe::config::api::get::attribute::read ( dunedaq::conffwk::ConfigObject & input,
dunedaq::conffwk::attribute_t const & attr )
inlinestaticprivate

Directly retrieve information about an attribute by directly operating on a config-object

Parameters
theobject to read the attribute information from
theattribute to read from the given objects
Returns
a string representation of values

Definition at line 36 of file config_api_get.cpp.

37{
38 std::vector<T> attrvalues;
39
40 if (attr.p_is_multi_value) {
41 attrvalues = direct::attribute<std::vector<T>>(input, attr);
42 } else {
43 attrvalues = { direct::attribute<T>(input, attr) };
44 }
45
46 std::vector<std::string> strings(attrvalues.size());
47 std::transform(attrvalues.begin(),
48 attrvalues.end(),
49 strings.begin(),
50 [&attr](T const& x) { return convert::valtostr(x, attr.p_int_format); }
51
52 );
53
54 return strings;
55}
friend class dbe::config::api::get::attribute

◆ read() [2/2]

template<typename T>
std::vector< std::string > dbe::config::api::get::attribute::read ( inner::configobject::tref obj,
dunedaq::conffwk::attribute_t const & attr )
inlinestaticprivate

Read values associated with an attribute of a given object

Parameters
theobject to read the attribute information from
theattribute to read from the given objects
Returns
a string representation of values

Definition at line 60 of file config_api.hpp.

61{
62
63 if (attr.p_is_multi_value) {
64 std::vector<T> values;
65 obj.get(attr.p_name, values);
66
67 std::vector<std::string> result;
68
69 if (attr.p_int_format == dunedaq::conffwk::int_format_t::na_int_format) {
70 result.assign(values.size(), "");
71 std::transform(values.begin(), values.end(), result.begin(), (std::string(*)(T const&))convert::valtostr<T>);
72 } else {
73 for (T i : values) {
74 result.push_back(convert::valtostr(i, attr.p_int_format));
75 }
76 }
77
78 return result;
79 } else {
80 T value;
81 obj.get(attr.p_name, value);
82
83 if (attr.p_int_format == dunedaq::conffwk::int_format_t::na_int_format) {
84 return { convert::valtostr(value) };
85 } else {
86 return { convert::valtostr(value, attr.p_int_format) };
87 }
88 }
89}
std::string valtostr(T const &value)

◆ dbe::config::api::get::direct

friend class dbe::config::api::get::direct
friend

Definition at line 71 of file config_api_get.hpp.


The documentation for this class was generated from the following files: