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 77 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 178 of file config_api_get.cpp.

180{
181 std::vector<std::string> attrvalues;
182
183 switch ( Attribute.p_type )
184 {
185
187 attrvalues = get::attribute::read<bool> ( obj, Attribute );
188 break;
189
191
193
195
197
199 attrvalues = get::attribute::read<std::string> ( obj, Attribute );
200 break;
201
203 attrvalues = get::attribute::read<float> ( obj, Attribute );
204 break;
205
207 attrvalues = get::attribute::read<double> ( obj, Attribute );
208 break;
209
211 attrvalues = get::attribute::read<int8_t> ( obj, Attribute );
212 break;
213
215 attrvalues = get::attribute::read<u_int8_t> ( obj, Attribute );
216 break;
217
219 attrvalues = get::attribute::read<int16_t> ( obj, Attribute );
220 break;
221
223 attrvalues = get::attribute::read<u_int16_t> ( obj, Attribute );
224 break;
225
227 attrvalues = get::attribute::read<int32_t> ( obj, Attribute );
228 break;
229
231 attrvalues = get::attribute::read<u_int32_t> ( obj, Attribute );
232 break;
233
235 attrvalues = get::attribute::read<int64_t> ( obj, Attribute );
236 break;
237
239 attrvalues = get::attribute::read<u_int64_t> ( obj, Attribute );
240 break;
241 }
242
243 return dbe::convert::to<T> ( attrvalues );
244}
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 40 of file config_api_get.cpp.

42{
43 std::vector<T> attrvalues;
44
45 if ( attr.p_is_multi_value )
46 {
47 attrvalues = direct::attribute<std::vector<T>> ( input, attr );
48 }
49 else
50 {
51 attrvalues =
52 { direct::attribute<T> ( input, attr ) };
53 }
54
55 std::vector<std::string> strings ( attrvalues.size() );
56 std::transform ( attrvalues.begin(), attrvalues.end(),
57 strings.begin(), [&attr] ( T const & x )
58 {
59 return convert::valtostr ( x, attr.p_int_format );
60 }
61
62 );
63
64 return strings;
65}
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 64 of file config_api.hpp.

66{
67
68 if ( attr.p_is_multi_value )
69 {
70 std::vector<T> values;
71 obj.get ( attr.p_name, values );
72
73 std::vector<std::string> result;
74
75 if ( attr.p_int_format == dunedaq::conffwk::int_format_t::na_int_format )
76 {
77 result.assign(values.size(), "");
78 std::transform ( values.begin(), values.end(), result.begin(),
79 ( std::string ( * ) ( T const & ) ) convert::valtostr<T> );
80 }
81 else
82 {
83 for ( T i : values )
84 {
85 result.push_back ( convert::valtostr ( i, attr.p_int_format ) );
86 }
87 }
88
89 return result;
90 }
91 else
92 {
93 T value;
94 obj.get ( attr.p_name, value );
95
96 if ( attr.p_int_format == dunedaq::conffwk::int_format_t::na_int_format )
97 {
98 return
99 { convert::valtostr ( value ) };
100 }
101 else
102 {
103 return
104 { convert::valtostr ( value, attr.p_int_format ) };
105 }
106 }
107}
std::string valtostr(T const &value)

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

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

Definition at line 79 of file config_api_get.hpp.


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