DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::oksconflibs::OksConfigObject Class Reference

#include <OksConfigObject.hpp>

Inheritance diagram for dunedaq::oksconflibs::OksConfigObject:
[legend]
Collaboration diagram for dunedaq::oksconflibs::OksConfigObject:
[legend]

Public Member Functions

 OksConfigObject (oks::OksObject *obj, conffwk::ConfigurationImpl *impl) noexcept
virtual ~OksConfigObject () noexcept
virtual const std::string contained_in () const
 Virtual method to get object's database file name.
virtual void get (const std::string &name, bool &value)
 Virtual method to read boolean attribute value.
virtual void get (const std::string &name, uint8_t &value)
 Virtual method to read unsigned char attribute value.
virtual void get (const std::string &name, int8_t &value)
 Virtual method to read signed char attribute value.
virtual void get (const std::string &name, uint16_t &value)
 Virtual method to read unsigned short attribute value.
virtual void get (const std::string &name, int16_t &value)
 Virtual method to read signed short attribute value.
virtual void get (const std::string &name, uint32_t &value)
 Virtual method to read unsigned long attribute value.
virtual void get (const std::string &name, int32_t &value)
 Virtual method to read signed long attribute value.
virtual void get (const std::string &name, uint64_t &value)
 Virtual method to read unsigned 64 bits integer attribute value.
virtual void get (const std::string &name, int64_t &value)
 Virtual method to read signed 64 bits integer attribute value.
virtual void get (const std::string &name, float &value)
 Virtual method to read float attribute value.
virtual void get (const std::string &name, double &value)
 Virtual method to read double attribute value.
virtual void get (const std::string &name, std::string &value)
 Virtual method to read string attribute value.
virtual void get (const std::string &name, conffwk::ConfigObject &value)
 Virtual method to read relationship single-value.
virtual void get (const std::string &name, std::vector< bool > &value)
 Virtual method to read vector-of-booleans attribute value.
virtual void get (const std::string &name, std::vector< uint8_t > &value)
 Virtual method to read vector-of-unsigned-chars attribute value.
virtual void get (const std::string &name, std::vector< int8_t > &value)
 Virtual method to read vector-of-signed-chars attribute value.
virtual void get (const std::string &name, std::vector< uint16_t > &value)
 Virtual method to read vector-of-unsigned-shorts attribute value.
virtual void get (const std::string &name, std::vector< int16_t > &value)
 Virtual method to read vector-of-signed-shorts attribute value.
virtual void get (const std::string &name, std::vector< uint32_t > &value)
 Virtual method to read vector-of-unsigned-longs attribute value.
virtual void get (const std::string &name, std::vector< int32_t > &value)
 Virtual method to read vector-of-signed-longs attribute value.
virtual void get (const std::string &name, std::vector< uint64_t > &value)
 Virtual method to read vector-of-unsigned-64-bits-integers attribute value.
virtual void get (const std::string &name, std::vector< int64_t > &value)
 Virtual method to read vector-of-signed-64-bits-integers attribute value.
virtual void get (const std::string &name, std::vector< float > &value)
 Virtual method to read vector-of-floats attribute value.
virtual void get (const std::string &name, std::vector< double > &value)
 Virtual method to read vector-of-doubles attribute value.
virtual void get (const std::string &name, std::vector< std::string > &value)
 Virtual method to read vector-of-strings attribute value.
virtual void get (const std::string &name, std::vector< conffwk::ConfigObject > &value)
virtual bool rel (const std::string &name, std::vector< conffwk::ConfigObject > &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
virtual void set (const std::string &name, bool value)
 Virtual method to set boolean attribute value.
virtual void set (const std::string &name, uint8_t value)
 Virtual method to set unsigned char attribute value.
virtual void set (const std::string &name, int8_t value)
 Virtual method to set signed char attribute value.
virtual void set (const std::string &name, uint16_t value)
 Virtual method to set unsigned short attribute value.
virtual void set (const std::string &name, int16_t value)
 Virtual method to set signed short attribute value.
virtual void set (const std::string &name, uint32_t value)
 Virtual method to set unsigned long attribute value.
virtual void set (const std::string &name, int32_t value)
 Virtual method to set signed long attribute value.
virtual void set (const std::string &name, uint64_t value)
 Virtual method to set unsigned 64 bits integer attribute value.
virtual void set (const std::string &name, int64_t value)
 Virtual method to set signed 64 bits integer attribute value.
virtual void set (const std::string &name, float value)
 Virtual method to set float attribute value.
virtual void set (const std::string &name, double value)
 Virtual method to set double attribute value.
virtual void set (const std::string &name, const std::string &value)
 Virtual method to set string attribute value.
virtual void set_enum (const std::string &attribute, const std::string &value)
 Virtual method to set enumeration attribute value.
virtual void set_date (const std::string &attribute, const std::string &value)
 Virtual method to set date attribute value.
virtual void set_time (const std::string &attribute, const std::string &value)
 Virtual method to set time attribute value.
virtual void set_class (const std::string &attribute, const std::string &value)
 Virtual method to set enumeration attribute value.
virtual void set (const std::string &name, const std::vector< bool > &value)
 Virtual method to read vector-of-booleans attribute value.
virtual void set (const std::string &name, const std::vector< uint8_t > &value)
 Virtual method to read vector-of-unsigned-chars attribute value.
virtual void set (const std::string &name, const std::vector< int8_t > &value)
 Virtual method to read vector-of-signed-chars attribute value.
virtual void set (const std::string &name, const std::vector< uint16_t > &value)
 Virtual method to read vector-of-unsigned-shorts attribute value.
virtual void set (const std::string &name, const std::vector< int16_t > &value)
 Virtual method to read vector-of-signed-shorts attribute value.
virtual void set (const std::string &name, const std::vector< uint32_t > &value)
 Virtual method to read vector-of-unsigned-longs attribute value.
virtual void set (const std::string &name, const std::vector< int32_t > &value)
 Virtual method to read vector-of-signed-longs attribute value.
virtual void set (const std::string &name, const std::vector< uint64_t > &value)
 Virtual method to read vector-of-unsigned-64-bits-integers attribute value.
virtual void set (const std::string &name, const std::vector< int64_t > &value)
 Virtual method to read vector-of-signed-64-bits-integers attribute value.
virtual void set (const std::string &name, const std::vector< float > &value)
 Virtual method to read vector-of-floats attribute value.
virtual void set (const std::string &name, const std::vector< double > &value)
 Virtual method to read vector-of-doubles attribute value.
virtual void set (const std::string &name, const std::vector< std::string > &value)
 Virtual method to read vector-of-strings attribute value.
virtual void set_enum (const std::string &attribute, const std::vector< std::string > &value)
 Virtual method to read vector-of-enumerations attribute value.
virtual void set_date (const std::string &attribute, const std::vector< std::string > &value)
 Virtual method to read vector-of-dates attribute value.
virtual void set_time (const std::string &attribute, const std::vector< std::string > &value)
 Virtual method to read vector-of-times attribute value.
virtual void set_class (const std::string &attribute, const std::vector< std::string > &value)
 Virtual method to read vector-of-enumerations attribute value.
virtual void set (const std::string &name, const conffwk::ConfigObject *value, bool skip_non_null_check)
 Virtual method to read conffwk-object relationship value.
virtual void set (const std::string &name, const std::vector< const conffwk::ConfigObject * > &value, bool skip_non_null_check)
virtual void move (const std::string &at)
 Virtual method to move object to a file.
virtual void rename (const std::string &new_id)
 Virtual method to change object ID.
virtual void reset ()
 Virtual method to reset the implementation object from unknown state.
oks::OksData::Type get_type (const std::string &attribute) const
void set (oks::OksObject *obj)
Public Member Functions inherited from dunedaq::conffwk::ConfigObjectImpl
 ConfigObjectImpl (ConfigurationImpl *impl, const std::string &id, dunedaq::conffwk::ObjectState state=dunedaq::conffwk::Valid) noexcept
 The constructor stores configuration implementation pointer.
virtual ~ConfigObjectImpl () noexcept
 The virtual destructor.
const std::string & UID () const noexcept
 Method to get database object's unique ID.
const std::string & class_name () const noexcept
 Virtual method to get object's class name.
virtual void get (const std::string &association, std::vector< ConfigObject > &value)=0
 Virtual method to read vector-of-conffwk-objects relationship value.
virtual bool rel (const std::string &name, std::vector< ConfigObject > &value)=0
 Virtual method to read any relationship value without throwing an exception if there is no such relationship (return false).
virtual void referenced_by (std::vector< ConfigObject > &value, const std::string &association, bool check_composite_only, unsigned long rlevel, const std::vector< std::string > *rclasses) const =0
 Virtual method to read vector-of-conffwk-object referencing this object.
virtual void set (const std::string &association, const std::vector< const ConfigObject * > &value, bool skip_non_null_check)=0
 Virtual method to read vector-of-conffwk-objects relationship value.
virtual void clear () noexcept
 Virtual method to clean resources used by the implementation object.
bool is_deleted () const
 Check object and return true if the object has been deleted.

Private Member Functions

template<class T>
void get_value (const std::string &name, T &value)
template<class T>
void get_vector (const std::string &name, std::vector< T > &value)
void set_attr_value (const std::string &name, oks::OksData &value)
void set_rel_value (const std::string &name, oks::OksData &value, bool skip_non_null_check)
template<class T>
void set_value (const std::string &name, const T &value)
template<class T>
void set_vector (const std::string &name, const std::vector< T > &value)

Private Attributes

oks::OksObjectm_obj

Friends

class ConfigurationImpl
class OksConfiguration

Additional Inherited Members

Static Public Member Functions inherited from dunedaq::conffwk::ConfigObjectImpl
static ConfigObjectImpldefault_impl () noexcept
 Returns default implementation.
Protected Member Functions inherited from dunedaq::conffwk::ConfigObjectImpl
void throw_if_deleted () const
Protected Attributes inherited from dunedaq::conffwk::ConfigObjectImpl
ConfigurationImplm_impl
dunedaq::conffwk::ObjectState m_state
std::string m_id
const std::string * m_class_name
std::mutex m_mutex

Detailed Description

Definition at line 26 of file OksConfigObject.hpp.

Constructor & Destructor Documentation

◆ OksConfigObject()

OksConfigObject::OksConfigObject ( oks::OksObject * obj,
conffwk::ConfigurationImpl * impl )
noexcept

Definition at line 114 of file OksConfigObject.cpp.

114 :
115 ConfigObjectImpl (impl, obj->GetId()),
116 m_obj (obj)
117{
118}
msgpack::object obj

◆ ~OksConfigObject()

OksConfigObject::~OksConfigObject ( )
virtualnoexcept

Definition at line 120 of file OksConfigObject.cpp.

121{
122}

Member Function Documentation

◆ contained_in()

const std::string OksConfigObject::contained_in ( ) const
virtual

Virtual method to get object's database file name.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 125 of file OksConfigObject.cpp.

126{
127 std::lock_guard<std::mutex> scoped_lock(m_mutex);
129 return m_obj->get_file()->get_full_file_name();
130}

◆ get() [1/26]

void OksConfigObject::get ( const std::string & attribute,
bool & value )
virtual

Virtual method to read boolean attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 133 of file OksConfigObject.cpp.

134{
135 get_value(name, value);
136}
void get_value(const std::string &name, T &value)

◆ get() [2/26]

void OksConfigObject::get ( const std::string & association,
conffwk::ConfigObject & value )
virtual

Virtual method to read relationship single-value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 239 of file OksConfigObject.cpp.

240{
241 OksData * data = 0;
242
243 std::lock_guard<std::mutex> scoped_lock(m_mutex);
244
245 try
246 {
248 data = m_obj->GetRelationshipValue(name);
249 }
250 catch (oks::exception& ex)
251 {
252 throw dunedaq::conffwk::Generic(ERS_HERE, mk_get_error_text("relationship", name, m_obj).c_str(), ex);
253 }
254
255 if (data->type != OksData::object_type)
256 {
257 if (data->type == OksData::uid_type || data->type == OksData::uid2_type)
258 {
259 std::ostringstream text;
260 text << "referenced object " << *data << " is not loaded";
261 throw dunedaq::conffwk::Generic(ERS_HERE, mk_get_error_text("relationship", name, m_obj, text.str().c_str()).c_str());
262 }
263
264 std::ostringstream text;
265 text << "bad value of relationship \"" << name << "\" of object " << m_obj << ": ";
266
267 if(data->type == OksData::list_type)
268 {
269 text << "the relationship is multi-value";
270 }
271 else
272 {
273 text << "non-object type was read";
274 }
275 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
276 }
277
278 if (data->data.OBJECT != nullptr)
279 {
280 value = static_cast<OksConfiguration *>(m_impl)->new_object(data->data.OBJECT);
281 }
282 else
283 {
284 value = nullptr;
285 }
286}
#define ERS_HERE
static std::string mk_get_error_text(const char *what, const std::string &name, const OksObject *o, const char *error=nullptr)

◆ get() [3/26]

void OksConfigObject::get ( const std::string & attribute,
double & value )
virtual

Virtual method to read double attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 193 of file OksConfigObject.cpp.

194{
195 get_value(name, value);
196}

◆ get() [4/26]

void OksConfigObject::get ( const std::string & attribute,
float & value )
virtual

Virtual method to read float attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 187 of file OksConfigObject.cpp.

188{
189 get_value(name, value);
190}

◆ get() [5/26]

void OksConfigObject::get ( const std::string & attribute,
int16_t & value )
virtual

Virtual method to read signed short attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 157 of file OksConfigObject.cpp.

158{
159 get_value(name, value);
160}

◆ get() [6/26]

void OksConfigObject::get ( const std::string & attribute,
int32_t & value )
virtual

Virtual method to read signed long attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 169 of file OksConfigObject.cpp.

170{
171 get_value(name, value);
172}

◆ get() [7/26]

void OksConfigObject::get ( const std::string & attribute,
int64_t & value )
virtual

Virtual method to read signed 64 bits integer attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 181 of file OksConfigObject.cpp.

182{
183 get_value(name, value);
184}

◆ get() [8/26]

void OksConfigObject::get ( const std::string & attribute,
int8_t & value )
virtual

Virtual method to read signed char attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 145 of file OksConfigObject.cpp.

146{
147 get_value(name, value);
148}

◆ get() [9/26]

void OksConfigObject::get ( const std::string & attribute,
std::string & value )
virtual

Virtual method to read string attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 199 of file OksConfigObject.cpp.

200{
201 OksData * data = 0;
202
203 std::lock_guard<std::mutex> scoped_lock(m_mutex);
204
205 try
206 {
208 data = m_obj->GetAttributeValue(name);
209 }
210 catch (oks::exception& ex)
211 {
212 throw dunedaq::conffwk::Generic( ERS_HERE, mk_get_error_text("attribute", name, m_obj).c_str(), ex);
213 }
214
215 if ((data->type == OksData::string_type) || (data->type == OksData::enum_type))
216 {
217 value = *data->data.STRING;
218 return;
219 }
220 else if (data->type == OksData::date_type || data->type == OksData::time_type)
221 {
222 value = data->str();
223 return;
224 }
225 else if (data->type == OksData::class_type)
226 {
227 value = data->data.CLASS->get_name();
228 return;
229 }
230 else
231 {
232 std::ostringstream text;
233 text << "read wrong attribute type instead of expected \'string\' for attribute \"" << name << "\" of object " << m_obj;
234 throw dunedaq::conffwk::Generic( ERS_HERE, text.str().c_str() );
235 }
236}

◆ get() [10/26]

void OksConfigObject::get ( const std::string & attribute,
std::vector< bool > & value )
virtual

Virtual method to read vector-of-booleans attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 289 of file OksConfigObject.cpp.

290{
291 get_vector(name, value);
292}
void get_vector(const std::string &name, std::vector< T > &value)

◆ get() [11/26]

virtual void dunedaq::oksconflibs::OksConfigObject::get ( const std::string & name,
std::vector< conffwk::ConfigObject > & value )
virtual

◆ get() [12/26]

void OksConfigObject::get ( const std::string & attribute,
std::vector< double > & value )
virtual

Virtual method to read vector-of-doubles attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 349 of file OksConfigObject.cpp.

350{
351 get_vector(name, value);
352}

◆ get() [13/26]

void OksConfigObject::get ( const std::string & attribute,
std::vector< float > & value )
virtual

Virtual method to read vector-of-floats attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 343 of file OksConfigObject.cpp.

344{
345 get_vector(name, value);
346}

◆ get() [14/26]

void OksConfigObject::get ( const std::string & attribute,
std::vector< int16_t > & value )
virtual

Virtual method to read vector-of-signed-shorts attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 313 of file OksConfigObject.cpp.

314{
315 get_vector(name, value);
316}

◆ get() [15/26]

void OksConfigObject::get ( const std::string & attribute,
std::vector< int32_t > & value )
virtual

Virtual method to read vector-of-signed-longs attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 325 of file OksConfigObject.cpp.

326{
327 get_vector(name, value);
328}

◆ get() [16/26]

void OksConfigObject::get ( const std::string & attribute,
std::vector< int64_t > & value )
virtual

Virtual method to read vector-of-signed-64-bits-integers attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 337 of file OksConfigObject.cpp.

338{
339 get_vector(name, value);
340}

◆ get() [17/26]

void OksConfigObject::get ( const std::string & attribute,
std::vector< int8_t > & value )
virtual

Virtual method to read vector-of-signed-chars attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 301 of file OksConfigObject.cpp.

302{
303 get_vector(name, value);
304}

◆ get() [18/26]

void OksConfigObject::get ( const std::string & attribute,
std::vector< std::string > & value )
virtual

Virtual method to read vector-of-strings attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 355 of file OksConfigObject.cpp.

356{
357 OksData * data = 0;
358
359 std::lock_guard<std::mutex> scoped_lock(m_mutex);
360
361 try
362 {
364 data = m_obj->GetAttributeValue(name);
365 }
366 catch (oks::exception& ex)
367 {
368 throw dunedaq::conffwk::Generic(ERS_HERE, mk_get_error_text("attribute", name, m_obj).c_str(), ex);
369 }
370
371 if (data->type != OksData::list_type)
372 {
373 std::ostringstream text;
374 text << "attribute \"" << name << "\" of object " << m_obj << " is not of a multi-value";
375 throw dunedaq::conffwk::Generic( ERS_HERE, text.str().c_str());
376 }
377
378 value.clear();
379
380 for (const auto & it : *data->data.LIST)
381 {
382 if ((it->type == OksData::string_type) || (it->type == OksData::enum_type))
383 {
384 value.emplace_back(*it->data.STRING);
385 }
386 else if (it->type == OksData::class_type)
387 {
388 value.emplace_back(it->data.CLASS->get_name());
389 }
390 else if (it->type == OksData::date_type || it->type == OksData::time_type)
391 {
392 value.emplace_back(it->str());
393 }
394 else
395 {
396 std::ostringstream text;
397 text << "wrong type of attribute \"" << name << "\" of object " << m_obj << " (instead of expected string)";
398 throw dunedaq::conffwk::Generic( ERS_HERE, text.str().c_str() );
399 }
400 }
401}

◆ get() [19/26]

void OksConfigObject::get ( const std::string & attribute,
std::vector< uint16_t > & value )
virtual

Virtual method to read vector-of-unsigned-shorts attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 307 of file OksConfigObject.cpp.

308{
309 get_vector(name, value);
310}

◆ get() [20/26]

void OksConfigObject::get ( const std::string & attribute,
std::vector< uint32_t > & value )
virtual

Virtual method to read vector-of-unsigned-longs attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 319 of file OksConfigObject.cpp.

320{
321 get_vector(name, value);
322}

◆ get() [21/26]

void OksConfigObject::get ( const std::string & attribute,
std::vector< uint64_t > & value )
virtual

Virtual method to read vector-of-unsigned-64-bits-integers attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 331 of file OksConfigObject.cpp.

332{
333 get_vector(name, value);
334}

◆ get() [22/26]

void OksConfigObject::get ( const std::string & attribute,
std::vector< uint8_t > & value )
virtual

Virtual method to read vector-of-unsigned-chars attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 295 of file OksConfigObject.cpp.

296{
297 get_vector(name, value);
298}

◆ get() [23/26]

void OksConfigObject::get ( const std::string & attribute,
uint16_t & value )
virtual

Virtual method to read unsigned short attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 151 of file OksConfigObject.cpp.

152{
153 get_value(name, value);
154}

◆ get() [24/26]

void OksConfigObject::get ( const std::string & attribute,
uint32_t & value )
virtual

Virtual method to read unsigned long attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 163 of file OksConfigObject.cpp.

164{
165 get_value(name, value);
166}

◆ get() [25/26]

void OksConfigObject::get ( const std::string & attribute,
uint64_t & value )
virtual

Virtual method to read unsigned 64 bits integer attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 175 of file OksConfigObject.cpp.

176{
177 get_value(name, value);
178}

◆ get() [26/26]

void OksConfigObject::get ( const std::string & attribute,
uint8_t & value )
virtual

Virtual method to read unsigned char attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 139 of file OksConfigObject.cpp.

140{
141 get_value(name, value);
142}

◆ get_type()

OksData::Type OksConfigObject::get_type ( const std::string & attribute) const

Definition at line 48 of file OksConfigObject.cpp.

49{
50 try
51 {
52 return m_obj->GetAttributeValue(name)->type;
53 }
54 catch (oks::exception& ex)
55 {
56 throw dunedaq::conffwk::Generic(ERS_HERE, mk_get_error_text("attribute", name, m_obj).c_str(), ex);
57 }
58}

◆ get_value()

template<class T>
void OksConfigObject::get_value ( const std::string & name,
T & value )
private

Definition at line 63 of file OksConfigObject.cpp.

64 {
65 std::lock_guard<std::mutex> scoped_lock(m_mutex);
66
67 try
68 {
70 OksData * data(m_obj->GetAttributeValue(name));
71 value = *reinterpret_cast<T*>(&data->data); // really ugly stuff here, but should come out right
72 }
73 catch (oks::exception& ex)
74 {
75 throw dunedaq::conffwk::Generic(ERS_HERE, mk_get_error_text("attribute", name, m_obj).c_str(), ex);
76 }
77 }

◆ get_vector()

template<class T>
void OksConfigObject::get_vector ( const std::string & name,
std::vector< T > & value )
private

Definition at line 83 of file OksConfigObject.cpp.

84 {
85 OksData * data = 0;
86
87 std::lock_guard<std::mutex> scoped_lock(m_mutex);
88
89 try
90 {
92 data = m_obj->GetAttributeValue(name);
93 }
94 catch (oks::exception& ex)
95 {
96 throw dunedaq::conffwk::Generic( ERS_HERE, mk_get_error_text("attribute", name, m_obj).c_str(), ex);
97 }
98
99 if (data->type != OksData::list_type)
100 {
101 std::ostringstream text;
102 text << "attribute \"" << name << "\" of object " << m_obj << " is not of a multi-value";
103 throw dunedaq::conffwk::Generic( ERS_HERE, text.str().c_str() );
104 }
105
106 value.clear();
107 for (const auto& it : *data->data.LIST)
108 {
109 value.push_back(*reinterpret_cast<T*>(&it->data));
110 }
111 }

◆ move()

void OksConfigObject::move ( const std::string & at)
virtual

Virtual method to move object to a file.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 980 of file OksConfigObject.cpp.

981{
982 std::lock_guard<std::mutex> scoped_lock(m_mutex);
983
985
986 if (OksFile * new_file_h = m_obj->GetClass()->get_kernel()->find_data_file(at))
987 {
988 OksFile * old_file_h = m_obj->get_file();
989 if (old_file_h != new_file_h)
990 {
991 try
992 {
993// static_cast<OksConfiguration *>(m_impl)->test_and_checkout(old_file_h);
994// static_cast<OksConfiguration *>(m_impl)->test_and_checkout(new_file_h);
995 m_obj->set_file(new_file_h, false);
996 }
997 catch (oks::exception& ex)
998 {
999 throw dunedaq::conffwk::Generic(ERS_HERE, ex.what());
1000 }
1001 }
1002 }
1003 else
1004 {
1005 std::ostringstream text;
1006 text << "file \"" << at << "\" is not loaded";
1007 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
1008 }
1009}

◆ referenced_by()

void OksConfigObject::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
virtual

Definition at line 493 of file OksConfigObject.cpp.

494{
495 value.clear();
496
497 std::lock_guard<std::mutex> scoped_lock(m_mutex);
499
500 if (check_composite_only)
501 {
502 bool any_name = (rname == "*");
503
504 if (const std::list<OksRCR *> * rcr = m_obj->reverse_composite_rels())
505 {
506 for (const auto& i : *rcr)
507 {
508 if (any_name || rname == i->relationship->get_name())
509 {
510 value.push_back(conffwk::ConfigObject(static_cast<OksConfiguration *>(m_impl)->new_object(i->obj)));
511 }
512 }
513 }
514 }
515 else
516 {
517 if (OksObject::FList * objs = m_obj->get_all_rels(rname))
518 {
519 for (const auto& i : *objs)
520 {
521 value.push_back(conffwk::ConfigObject(static_cast<OksConfiguration *>(m_impl)->new_object(i)));
522 }
523
524 delete objs;
525 }
526 }
527}
std::list< OksObject *, boost::fast_pool_allocator< OksObject * > > FList
Definition object.hpp:882

◆ rel()

bool OksConfigObject::rel ( const std::string & name,
std::vector< conffwk::ConfigObject > & value )
virtual

Definition at line 448 of file OksConfigObject.cpp.

449{
450 std::lock_guard<std::mutex> scoped_lock(m_mutex);
451
452 try
453 {
455
456 if (OksDataInfo * di = m_obj->GetClass()->get_data_info(name))
457 {
458 if (di->relationship)
459 {
460 OksData * data = m_obj->GetRelationshipValue(di);
461
462 if (data->type == OksData::object_type)
463 {
464 if (data->data.OBJECT != nullptr)
465 {
466 value.push_back(conffwk::ConfigObject(static_cast<OksConfiguration *>(m_impl)->new_object(data->data.OBJECT)));
467 }
468 }
469 else if (data->type == OksData::list_type)
470 {
471 for (const auto& it : *data->data.LIST)
472 {
473 if (it->type == OksData::object_type)
474 {
475 value.push_back(conffwk::ConfigObject(static_cast<OksConfiguration *>(m_impl)->new_object(it->data.OBJECT)));
476 }
477 }
478 }
479
480 return true;
481 }
482 }
483
484 return false;
485 }
486 catch (oks::exception& ex)
487 {
488 throw dunedaq::conffwk::Generic(ERS_HERE, mk_get_error_text("relationship", name, m_obj).c_str(), ex);
489 }
490}

◆ rename()

void OksConfigObject::rename ( const std::string & new_id)
virtual

Virtual method to change object ID.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 1013 of file OksConfigObject.cpp.

1014{
1015 try
1016 {
1018
1019// std::set<OksFile *> files;
1020//
1021// files.insert(m_obj->get_file());
1022//
1023// if (OksObject::FList * objs = m_obj->get_all_rels())
1024// {
1025// for (auto & f : *objs)
1026// {
1027// files.insert(f->get_file());
1028// }
1029//
1030// delete objs;
1031// }
1032//
1033// for (auto & f : files)
1034// {
1035// static_cast<OksConfiguration *>(m_impl)->test_and_checkout(f);
1036// }
1037
1038 m_obj->set_id(new_id);
1039 }
1040 catch (oks::exception& ex)
1041 {
1042 std::ostringstream text;
1043 text << "cannot rename object " << m_obj << " to new name \'" << new_id << "\' because " << ex.what();
1044 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
1045 }
1046}

◆ reset()

void OksConfigObject::reset ( )
virtual

Virtual method to reset the implementation object from unknown state.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 1049 of file OksConfigObject.cpp.

1050{
1051 if (OksClass * c = static_cast<OksConfiguration *>(m_impl)->m_kernel->find_class(*m_class_name))
1052 {
1053 m_obj = c->get_object(m_id);
1054 }
1055 else
1056 {
1057 m_obj = nullptr;
1058 }
1059
1061}
dunedaq::conffwk::ObjectState m_state

◆ set() [1/27]

void OksConfigObject::set ( const std::string & attribute,
bool value )
virtual

Virtual method to set boolean attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 601 of file OksConfigObject.cpp.

602{
603 set_value(name, value);
604}
void set_value(const std::string &name, const T &value)

◆ set() [2/27]

void OksConfigObject::set ( const std::string & association,
const conffwk::ConfigObject * value,
bool skip_non_null_check )
virtual

Virtual method to read conffwk-object relationship value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 955 of file OksConfigObject.cpp.

956{
957 OksData d((value != nullptr) ? static_cast<const OksConfigObject*>(value->implementation())->m_obj : (OksObject *) nullptr);
958 set_rel_value(name, d, skip_non_null_check);
959}
void set_rel_value(const std::string &name, oks::OksData &value, bool skip_non_null_check)
OksConfigObject(oks::OksObject *obj, conffwk::ConfigurationImpl *impl) noexcept

◆ set() [3/27]

void OksConfigObject::set ( const std::string & attribute,
const std::string & value )
virtual

Virtual method to set string attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 656 of file OksConfigObject.cpp.

657{
658 set_value(name, value);
659}

◆ set() [4/27]

void OksConfigObject::set ( const std::string & attribute,
const std::vector< bool > & value )
virtual

Virtual method to read vector-of-booleans attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 761 of file OksConfigObject.cpp.

762{
763 set_vector(name, value);
764}
void set_vector(const std::string &name, const std::vector< T > &value)

◆ set() [5/27]

void OksConfigObject::set ( const std::string & name,
const std::vector< const conffwk::ConfigObject * > & value,
bool skip_non_null_check )
virtual

Definition at line 962 of file OksConfigObject.cpp.

963{
964 OksData d(new OksData::List());
965
966 for (const auto& i : value)
967 {
968 d.data.LIST->push_back(new OksData(static_cast<const OksConfigObject*>(i->implementation())->m_obj));
969 }
970
971 set_rel_value(name, d, skip_non_null_check);
972}
std::list< OksData *, boost::fast_pool_allocator< OksData * > > List
Definition object.hpp:460

◆ set() [6/27]

void OksConfigObject::set ( const std::string & attribute,
const std::vector< double > & value )
virtual

Virtual method to read vector-of-doubles attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 821 of file OksConfigObject.cpp.

822{
823 set_vector(name, value);
824}

◆ set() [7/27]

void OksConfigObject::set ( const std::string & attribute,
const std::vector< float > & value )
virtual

Virtual method to read vector-of-floats attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 815 of file OksConfigObject.cpp.

816{
817 set_vector(name, value);
818}

◆ set() [8/27]

void OksConfigObject::set ( const std::string & attribute,
const std::vector< int16_t > & value )
virtual

Virtual method to read vector-of-signed-shorts attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 785 of file OksConfigObject.cpp.

786{
787 set_vector(name, value);
788}

◆ set() [9/27]

void OksConfigObject::set ( const std::string & attribute,
const std::vector< int32_t > & value )
virtual

Virtual method to read vector-of-signed-longs attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 797 of file OksConfigObject.cpp.

798{
799 set_vector(name, value);
800}

◆ set() [10/27]

void OksConfigObject::set ( const std::string & attribute,
const std::vector< int64_t > & value )
virtual

Virtual method to read vector-of-signed-64-bits-integers attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 809 of file OksConfigObject.cpp.

810{
811 set_vector(name, value);
812}

◆ set() [11/27]

void OksConfigObject::set ( const std::string & attribute,
const std::vector< int8_t > & value )
virtual

Virtual method to read vector-of-signed-chars attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 773 of file OksConfigObject.cpp.

774{
775 set_vector(name, value);
776}

◆ set() [12/27]

void OksConfigObject::set ( const std::string & attribute,
const std::vector< std::string > & value )
virtual

Virtual method to read vector-of-strings attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 827 of file OksConfigObject.cpp.

828{
829 set_vector(name, value);
830}

◆ set() [13/27]

void OksConfigObject::set ( const std::string & attribute,
const std::vector< uint16_t > & value )
virtual

Virtual method to read vector-of-unsigned-shorts attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 779 of file OksConfigObject.cpp.

780{
781 set_vector(name, value);
782}

◆ set() [14/27]

void OksConfigObject::set ( const std::string & attribute,
const std::vector< uint32_t > & value )
virtual

Virtual method to read vector-of-unsigned-longs attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 791 of file OksConfigObject.cpp.

792{
793 set_vector(name, value);
794}

◆ set() [15/27]

void OksConfigObject::set ( const std::string & attribute,
const std::vector< uint64_t > & value )
virtual

Virtual method to read vector-of-unsigned-64-bits-integers attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 803 of file OksConfigObject.cpp.

804{
805 set_vector(name, value);
806}

◆ set() [16/27]

void OksConfigObject::set ( const std::string & attribute,
const std::vector< uint8_t > & value )
virtual

Virtual method to read vector-of-unsigned-chars attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 767 of file OksConfigObject.cpp.

768{
769 set_vector(name, value);
770}

◆ set() [17/27]

void OksConfigObject::set ( const std::string & attribute,
double value )
virtual

Virtual method to set double attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 651 of file OksConfigObject.cpp.

652{
653 set_value(name, value);
654}

◆ set() [18/27]

void OksConfigObject::set ( const std::string & attribute,
float value )
virtual

Virtual method to set float attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 646 of file OksConfigObject.cpp.

647{
648 set_value(name, value);
649}

◆ set() [19/27]

void OksConfigObject::set ( const std::string & attribute,
int16_t value )
virtual

Virtual method to set signed short attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 621 of file OksConfigObject.cpp.

622{
623 set_value(name, value);
624}

◆ set() [20/27]

void OksConfigObject::set ( const std::string & attribute,
int32_t value )
virtual

Virtual method to set signed long attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 631 of file OksConfigObject.cpp.

632{
633 set_value(name, value);
634}

◆ set() [21/27]

void OksConfigObject::set ( const std::string & attribute,
int64_t value )
virtual

Virtual method to set signed 64 bits integer attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 641 of file OksConfigObject.cpp.

642{
643 set_value(name, value);
644}

◆ set() [22/27]

void OksConfigObject::set ( const std::string & attribute,
int8_t value )
virtual

Virtual method to set signed char attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 611 of file OksConfigObject.cpp.

612{
613 set_value(name, value);
614}

◆ set() [23/27]

void OksConfigObject::set ( const std::string & attribute,
uint16_t value )
virtual

Virtual method to set unsigned short attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 616 of file OksConfigObject.cpp.

617{
618 set_value(name, value);
619}

◆ set() [24/27]

void OksConfigObject::set ( const std::string & attribute,
uint32_t value )
virtual

Virtual method to set unsigned long attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 626 of file OksConfigObject.cpp.

627{
628 set_value(name, value);
629}

◆ set() [25/27]

void OksConfigObject::set ( const std::string & attribute,
uint64_t value )
virtual

Virtual method to set unsigned 64 bits integer attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 636 of file OksConfigObject.cpp.

637{
638 set_value(name, value);
639}

◆ set() [26/27]

void OksConfigObject::set ( const std::string & attribute,
uint8_t value )
virtual

Virtual method to set unsigned char attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 606 of file OksConfigObject.cpp.

607{
608 set_value(name, value);
609}

◆ set() [27/27]

void dunedaq::oksconflibs::OksConfigObject::set ( oks::OksObject * obj)
inline

Definition at line 151 of file OksConfigObject.hpp.

152 {
153 m_obj = obj;
154 }

◆ set_attr_value()

void OksConfigObject::set_attr_value ( const std::string & name,
oks::OksData & value )
private

Definition at line 536 of file OksConfigObject.cpp.

537{
538 std::lock_guard<std::mutex> scoped_lock(m_mutex);
539
540 try
541 {
543 //test_checkout_needs();
544 m_obj->SetAttributeValue(name, &data);
545 }
546 catch (dunedaq::conffwk::Generic& ex)
547 {
548 throw dunedaq::conffwk::Generic( ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
549 }
550 catch(oks::exception& ex)
551 {
552 throw dunedaq::conffwk::Generic( ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
553 }
554}
static std::string mk_set_error_text(const char *what, const std::string &name, const OksObject *o, const char *error=nullptr)

◆ set_class() [1/2]

void OksConfigObject::set_class ( const std::string & attribute,
const std::string & value )
virtual

Virtual method to set enumeration attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 691 of file OksConfigObject.cpp.

692{
693 OksData d;
694
695 d.data.CLASS = nullptr;
696 d.type = OksData::class_type;
697
698 // try to find any attribute in this class; throw exception "no such attribute", if the class has no attributes at all
699 {
700 std::lock_guard<std::mutex> scoped_lock(m_mutex);
702
703 const std::list<OksAttribute *> * attrs = m_obj->GetClass()->all_attributes();
704
705 if (!attrs || attrs->empty())
706 {
707 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("attribute", name, m_obj, "no such attribute").c_str());
708 }
709
710 try
711 {
712 d.SetValue(value.c_str(), attrs->front());
713 }
714 catch (oks::exception & ex)
715 {
716 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
717 }
718 }
719
720 set_attr_value(name, d);
721}
void set_attr_value(const std::string &name, oks::OksData &value)

◆ set_class() [2/2]

void OksConfigObject::set_class ( const std::string & attribute,
const std::vector< std::string > & value )
virtual

Virtual method to read vector-of-enumerations attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 869 of file OksConfigObject.cpp.

870{
871 OksData d(new OksData::List());
872
873 // try to find any attribute in this class; throw exception "no such attribute", if the class has no attributes at all
874
875 {
876 std::lock_guard<std::mutex> scoped_lock(m_mutex);
878
879 const std::list<OksAttribute *> * attrs = m_obj->GetClass()->all_attributes();
880
881 if (!attrs || attrs->empty())
882 {
883 throw dunedaq::conffwk::Generic( ERS_HERE, mk_set_error_text("attribute", name, m_obj, "no such attribute").c_str());
884 }
885
886 for (const auto& i : value)
887 {
888 OksData * d2 = new OksData();
889 d2->data.CLASS = 0;
891
892 try
893 {
894 d2->SetValue(i.c_str(), attrs->front());
895 }
896 catch (oks::exception & ex)
897 {
898 throw dunedaq::conffwk::Generic( ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
899 }
900
901 d.data.LIST->push_back(d2);
902 }
903 }
904
905 set_attr_value(name, d);
906}
union dunedaq::oks::OksData::Data data
void SetValue(const char *s, const OksAttribute *a)
enum dunedaq::oks::OksData::Type type
const OksClass * CLASS
Definition object.hpp:498

◆ set_date() [1/2]

void OksConfigObject::set_date ( const std::string & attribute,
const std::string & value )
virtual

Virtual method to set date attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 724 of file OksConfigObject.cpp.

725{
726 OksData d;
727 d.type = OksData::date_type;
728
729 try
730 {
731 d.SetValue(value.c_str(), nullptr);
732 }
733 catch (oks::exception& ex)
734 {
735 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
736 }
737
738 set_attr_value(name, d);
739}

◆ set_date() [2/2]

void OksConfigObject::set_date ( const std::string & attribute,
const std::vector< std::string > & value )
virtual

Virtual method to read vector-of-dates attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 909 of file OksConfigObject.cpp.

910{
911 OksData d(new OksData::List());
912
913 for (const auto& i : value)
914 {
915 OksData * d2 = new OksData();
917 try
918 {
919 d2->SetValue(i.c_str(), nullptr);
920 }
921 catch (oks::exception& ex)
922 {
923 throw dunedaq::conffwk::Generic( ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
924 }
925 d.data.LIST->push_back(d2);
926 }
927
928 set_attr_value(name, d);
929}

◆ set_enum() [1/2]

void OksConfigObject::set_enum ( const std::string & attribute,
const std::string & value )
virtual

Virtual method to set enumeration attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 662 of file OksConfigObject.cpp.

663{
664 OksData d;
665
666 {
667 std::lock_guard<std::mutex> scoped_lock(m_mutex);
669
670 if (OksAttribute * a = m_obj->GetClass()->find_attribute(name))
671 {
672 try
673 {
674 d.data.ENUMERATION = a->get_enum_value(value);
675 d.type = OksData::enum_type;
676 }
677 catch (std::exception& ex)
678 {
679 throw(dunedaq::conffwk::Generic( ERS_HERE, mk_set_error_text("attribute", name, m_obj, ex.what()).c_str()) );
680 }
681 }
682 else
683 {
684 throw ( dunedaq::conffwk::Generic( ERS_HERE, mk_set_error_text("attribute", name, m_obj, "no such attribute").c_str()) );
685 }
686 }
687
688 set_attr_value(name, d);
689}

◆ set_enum() [2/2]

void OksConfigObject::set_enum ( const std::string & attribute,
const std::vector< std::string > & value )
virtual

Virtual method to read vector-of-enumerations attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 833 of file OksConfigObject.cpp.

834{
835 OksData d(new OksData::List());
836
837 {
838 std::lock_guard<std::mutex> scoped_lock(m_mutex);
840
841 if (OksAttribute * a = m_obj->GetClass()->find_attribute(name))
842 {
843 for (const auto& i : value)
844 {
845 OksData * d2 = new OksData();
846 try
847 {
848 d2->data.ENUMERATION = a->get_enum_value(i); // new OksString(i);
850 d.data.LIST->push_back(d2);
851 }
852 catch (std::exception& ex)
853 {
854 throw dunedaq::conffwk::Generic( ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
855 }
856
857 }
858 }
859 else
860 {
861 throw dunedaq::conffwk::Generic( ERS_HERE, mk_set_error_text("attribute", name, m_obj, "no such attribute").c_str());
862 }
863 }
864
865 set_attr_value(name, d);
866}
const std::string * ENUMERATION
Definition object.hpp:512

◆ set_rel_value()

void OksConfigObject::set_rel_value ( const std::string & name,
oks::OksData & value,
bool skip_non_null_check )
private

Definition at line 557 of file OksConfigObject.cpp.

558{
559 std::lock_guard<std::mutex> scoped_lock(m_mutex);
560
561 try
562 {
564 //test_checkout_needs();
565 m_obj->SetRelationshipValue(name, &data, skip_non_null_check);
566 }
567 catch (dunedaq::conffwk::Generic& ex)
568 {
569 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("relationship", name, m_obj).c_str(), ex );
570 }
571 catch(oks::exception& ex)
572 {
573 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("relationship", name, m_obj).c_str(), ex);
574 }
575}

◆ set_time() [1/2]

void OksConfigObject::set_time ( const std::string & attribute,
const std::string & value )
virtual

Virtual method to set time attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 742 of file OksConfigObject.cpp.

743{
744 OksData d;
745 d.type = OksData::time_type;
746
747 try
748 {
749 d.SetValue(value.c_str(), nullptr);
750 }
751 catch (oks::exception& ex)
752 {
753 throw dunedaq::conffwk::Generic( ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
754 }
755
756 set_attr_value(name, d);
757}

◆ set_time() [2/2]

void OksConfigObject::set_time ( const std::string & attribute,
const std::vector< std::string > & value )
virtual

Virtual method to read vector-of-times attribute value.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 932 of file OksConfigObject.cpp.

933{
934 OksData d(new OksData::List());
935
936 for (const auto& i : value)
937 {
938 OksData * d2 = new OksData();
940 try
941 {
942 d2->SetValue(i.c_str(), 0);
943 }
944 catch (oks::exception& ex)
945 {
946 throw dunedaq::conffwk::Generic( ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
947 }
948 d.data.LIST->push_back(d2);
949 }
950
951 set_attr_value(name, d);
952}

◆ set_value()

template<class T>
void OksConfigObject::set_value ( const std::string & name,
const T & value )
private

Definition at line 580 of file OksConfigObject.cpp.

581 {
582 OksData d(value);
583 set_attr_value(name, d);
584 }

◆ set_vector()

template<class T>
void OksConfigObject::set_vector ( const std::string & name,
const std::vector< T > & value )
private

Definition at line 588 of file OksConfigObject.cpp.

589 {
590 OksData d(new OksData::List());
591
592 for (const auto& i : value)
593 {
594 d.data.LIST->push_back(new OksData(i));
595 }
596
597 set_attr_value(name, d);
598 }

◆ ConfigurationImpl

friend class ConfigurationImpl
friend

Definition at line 28 of file OksConfigObject.hpp.

◆ OksConfiguration

friend class OksConfiguration
friend

Definition at line 29 of file OksConfigObject.hpp.

Member Data Documentation

◆ m_obj

oks::OksObject* dunedaq::oksconflibs::OksConfigObject::m_obj
private

Definition at line 160 of file OksConfigObject.hpp.


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