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 72 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 173 of file config_api_get.cpp.

175{
176 std::vector<std::string> attrvalues;
177
178 switch ( Attribute.p_type )
179 {
180
182 attrvalues = get::attribute::read<bool> ( obj, Attribute );
183 break;
184
186
188
190
192
194 attrvalues = get::attribute::read<std::string> ( obj, Attribute );
195 break;
196
198 attrvalues = get::attribute::read<float> ( obj, Attribute );
199 break;
200
202 attrvalues = get::attribute::read<double> ( obj, Attribute );
203 break;
204
206 attrvalues = get::attribute::read<int8_t> ( obj, Attribute );
207 break;
208
210 attrvalues = get::attribute::read<u_int8_t> ( obj, Attribute );
211 break;
212
214 attrvalues = get::attribute::read<int16_t> ( obj, Attribute );
215 break;
216
218 attrvalues = get::attribute::read<u_int16_t> ( obj, Attribute );
219 break;
220
222 attrvalues = get::attribute::read<int32_t> ( obj, Attribute );
223 break;
224
226 attrvalues = get::attribute::read<u_int32_t> ( obj, Attribute );
227 break;
228
230 attrvalues = get::attribute::read<int64_t> ( obj, Attribute );
231 break;
232
234 attrvalues = get::attribute::read<u_int64_t> ( obj, Attribute );
235 break;
236 }
237
238 return dbe::convert::to<T> ( attrvalues );
239}
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 35 of file config_api_get.cpp.

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

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

Friends And Related Symbol Documentation

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

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

Definition at line 74 of file config_api_get.hpp.


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