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 19 of file OksConfigObject.hpp.

Constructor & Destructor Documentation

◆ OksConfigObject()

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

Definition at line 107 of file OksConfigObject.cpp.

107 :
108 ConfigObjectImpl (impl, obj->GetId()),
109 m_obj (obj)
110{
111}

◆ ~OksConfigObject()

OksConfigObject::~OksConfigObject ( )
virtualnoexcept

Definition at line 113 of file OksConfigObject.cpp.

114{
115}

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 118 of file OksConfigObject.cpp.

119{
120 std::lock_guard<std::mutex> scoped_lock(m_mutex);
122 return m_obj->get_file()->get_full_file_name();
123}
const std::string & get_full_file_name() const
Definition file.hpp:523
OksFile * get_file() const
Definition object.hpp:1013

◆ 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 126 of file OksConfigObject.cpp.

127{
128 get_value(name, value);
129}
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 232 of file OksConfigObject.cpp.

233{
234 OksData * data = 0;
235
236 std::lock_guard<std::mutex> scoped_lock(m_mutex);
237
238 try
239 {
242 }
243 catch (oks::exception& ex)
244 {
245 throw dunedaq::conffwk::Generic(ERS_HERE, mk_get_error_text("relationship", name, m_obj).c_str(), ex);
246 }
247
248 if (data->type != OksData::object_type)
249 {
250 if (data->type == OksData::uid_type || data->type == OksData::uid2_type)
251 {
252 std::ostringstream text;
253 text << "referenced object " << *data << " is not loaded";
254 throw dunedaq::conffwk::Generic(ERS_HERE, mk_get_error_text("relationship", name, m_obj, text.str().c_str()).c_str());
255 }
256
257 std::ostringstream text;
258 text << "bad value of relationship \"" << name << "\" of object " << m_obj << ": ";
259
260 if(data->type == OksData::list_type)
261 {
262 text << "the relationship is multi-value";
263 }
264 else
265 {
266 text << "non-object type was read";
267 }
268 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
269 }
270
271 if (data->data.OBJECT != nullptr)
272 {
273 value = static_cast<OksConfiguration *>(m_impl)->new_object(data->data.OBJECT);
274 }
275 else
276 {
277 value = nullptr;
278 }
279}
#define ERS_HERE
static std::string mk_get_error_text(const char *what, const std::string &name, const OksObject *o, const char *error=nullptr)
Generic configuration exception.
OksData * GetRelationshipValue(const std::string &) const
Get value of relationship by name.
Definition object.cpp:2004
the structure to pass common parameters to various read() methods of OksData and OksObject class
Definition object.hpp:449

◆ 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 186 of file OksConfigObject.cpp.

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

◆ 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 180 of file OksConfigObject.cpp.

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

◆ 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 150 of file OksConfigObject.cpp.

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

◆ 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 162 of file OksConfigObject.cpp.

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

◆ 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 174 of file OksConfigObject.cpp.

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

◆ 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 138 of file OksConfigObject.cpp.

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

◆ 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 192 of file OksConfigObject.cpp.

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

◆ 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 282 of file OksConfigObject.cpp.

283{
284 get_vector(name, value);
285}
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 342 of file OksConfigObject.cpp.

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

◆ 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 336 of file OksConfigObject.cpp.

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

◆ 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 306 of file OksConfigObject.cpp.

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

◆ 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 318 of file OksConfigObject.cpp.

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

◆ 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 330 of file OksConfigObject.cpp.

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

◆ 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 294 of file OksConfigObject.cpp.

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

◆ 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 348 of file OksConfigObject.cpp.

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

◆ 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 300 of file OksConfigObject.cpp.

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

◆ 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 312 of file OksConfigObject.cpp.

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

◆ 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 324 of file OksConfigObject.cpp.

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

◆ 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 288 of file OksConfigObject.cpp.

289{
290 get_vector(name, value);
291}

◆ 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 144 of file OksConfigObject.cpp.

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

◆ 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 156 of file OksConfigObject.cpp.

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

◆ 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 168 of file OksConfigObject.cpp.

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

◆ 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 132 of file OksConfigObject.cpp.

133{
134 get_value(name, value);
135}

◆ get_type()

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

Definition at line 41 of file OksConfigObject.cpp.

42{
43 try
44 {
45 return m_obj->GetAttributeValue(name)->type;
46 }
47 catch (oks::exception& ex)
48 {
49 throw dunedaq::conffwk::Generic(ERS_HERE, mk_get_error_text("attribute", name, m_obj).c_str(), ex);
50 }
51}
enum dunedaq::oks::OksData::Type type

◆ get_value()

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

Definition at line 56 of file OksConfigObject.cpp.

57 {
58 std::lock_guard<std::mutex> scoped_lock(m_mutex);
59
60 try
61 {
64 value = *reinterpret_cast<T*>(&data->data); // really ugly stuff here, but should come out right
65 }
66 catch (oks::exception& ex)
67 {
68 throw dunedaq::conffwk::Generic(ERS_HERE, mk_get_error_text("attribute", name, m_obj).c_str(), ex);
69 }
70 }

◆ get_vector()

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

Definition at line 76 of file OksConfigObject.cpp.

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

◆ move()

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

Virtual method to move object to a file.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 973 of file OksConfigObject.cpp.

974{
975 std::lock_guard<std::mutex> scoped_lock(m_mutex);
976
978
979 if (OksFile * new_file_h = m_obj->GetClass()->get_kernel()->find_data_file(at))
980 {
981 OksFile * old_file_h = m_obj->get_file();
982 if (old_file_h != new_file_h)
983 {
984 try
985 {
986// static_cast<OksConfiguration *>(m_impl)->test_and_checkout(old_file_h);
987// static_cast<OksConfiguration *>(m_impl)->test_and_checkout(new_file_h);
988 m_obj->set_file(new_file_h, false);
989 }
990 catch (oks::exception& ex)
991 {
992 throw dunedaq::conffwk::Generic(ERS_HERE, ex.what());
993 }
994 }
995 }
996 else
997 {
998 std::ostringstream text;
999 text << "file \"" << at << "\" is not loaded";
1000 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
1001 }
1002}
OksKernel * get_kernel() const noexcept
Definition class.hpp:333
Provides interface to the OKS XML schema and data files.
Definition file.hpp:340
OksFile * find_data_file(const std::string &s) const
Finds OKS data file.
Definition kernel.cpp:2287
void set_file(OksFile *file, bool update_owner=true)
Move object to different file.
Definition object.cpp:1484
const OksClass * GetClass() const
Definition object.hpp:990

◆ 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 486 of file OksConfigObject.cpp.

487{
488 value.clear();
489
490 std::lock_guard<std::mutex> scoped_lock(m_mutex);
492
493 if (check_composite_only)
494 {
495 bool any_name = (rname == "*");
496
497 if (const std::list<OksRCR *> * rcr = m_obj->reverse_composite_rels())
498 {
499 for (const auto& i : *rcr)
500 {
501 if (any_name || rname == i->relationship->get_name())
502 {
503 value.push_back(conffwk::ConfigObject(static_cast<OksConfiguration *>(m_impl)->new_object(i->obj)));
504 }
505 }
506 }
507 }
508 else
509 {
510 if (OksObject::FList * objs = m_obj->get_all_rels(rname))
511 {
512 for (const auto& i : *objs)
513 {
514 value.push_back(conffwk::ConfigObject(static_cast<OksConfiguration *>(m_impl)->new_object(i)));
515 }
516
517 delete objs;
518 }
519 }
520}
const std::list< OksRCR * > * reverse_composite_rels() const
Return information about composite parents. The method returns list of the OKS object's reverse compo...
Definition object.hpp:1310
FList * get_all_rels(const std::string &name="*") const
Return objects referencing this one via relationship with given name.
Definition object.cpp:3129
std::list< OksObject *, boost::fast_pool_allocator< OksObject * > > FList
Definition object.hpp:877

◆ rel()

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

Definition at line 441 of file OksConfigObject.cpp.

442{
443 std::lock_guard<std::mutex> scoped_lock(m_mutex);
444
445 try
446 {
448
449 if (OksDataInfo * di = m_obj->GetClass()->get_data_info(name))
450 {
451 if (di->relationship)
452 {
454
455 if (data->type == OksData::object_type)
456 {
457 if (data->data.OBJECT != nullptr)
458 {
459 value.push_back(conffwk::ConfigObject(static_cast<OksConfiguration *>(m_impl)->new_object(data->data.OBJECT)));
460 }
461 }
462 else if (data->type == OksData::list_type)
463 {
464 for (const auto& it : *data->data.LIST)
465 {
466 if (it->type == OksData::object_type)
467 {
468 value.push_back(conffwk::ConfigObject(static_cast<OksConfiguration *>(m_impl)->new_object(it->data.OBJECT)));
469 }
470 }
471 }
472
473 return true;
474 }
475 }
476
477 return false;
478 }
479 catch (oks::exception& ex)
480 {
481 throw dunedaq::conffwk::Generic(ERS_HERE, mk_get_error_text("relationship", name, m_obj).c_str(), ex);
482 }
483}
OksDataInfo * get_data_info(const std::string &s) const noexcept
Get OKS data information for attribute or relationship.
Definition class.hpp:874
Struct OKS data information.
Definition object.hpp:342

◆ rename()

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

Virtual method to change object ID.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 1006 of file OksConfigObject.cpp.

1007{
1008 try
1009 {
1011
1012// std::set<OksFile *> files;
1013//
1014// files.insert(m_obj->get_file());
1015//
1016// if (OksObject::FList * objs = m_obj->get_all_rels())
1017// {
1018// for (auto & f : *objs)
1019// {
1020// files.insert(f->get_file());
1021// }
1022//
1023// delete objs;
1024// }
1025//
1026// for (auto & f : files)
1027// {
1028// static_cast<OksConfiguration *>(m_impl)->test_and_checkout(f);
1029// }
1030
1031 m_obj->set_id(new_id);
1032 }
1033 catch (oks::exception& ex)
1034 {
1035 std::ostringstream text;
1036 text << "cannot rename object " << m_obj << " to new name \'" << new_id << "\' because " << ex.what();
1037 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
1038 }
1039}
void set_id(const std::string &id)
Set object ID.
Definition object.cpp:1506

◆ reset()

void OksConfigObject::reset ( )
virtual

Virtual method to reset the implementation object from unknown state.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 1042 of file OksConfigObject.cpp.

1043{
1044 if (OksClass * c = static_cast<OksConfiguration *>(m_impl)->m_kernel->find_class(*m_class_name))
1045 {
1046 m_obj = c->get_object(m_id);
1047 }
1048 else
1049 {
1050 m_obj = nullptr;
1051 }
1052
1054}
dunedaq::conffwk::ObjectState m_state
The OKS class.
Definition class.hpp:200

◆ 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 594 of file OksConfigObject.cpp.

595{
596 set_value(name, value);
597}
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 948 of file OksConfigObject.cpp.

949{
950 OksData d((value != nullptr) ? static_cast<const OksConfigObject*>(value->implementation())->m_obj : (OksObject *) nullptr);
951 set_rel_value(name, d, skip_non_null_check);
952}
OksObject describes instance of OksClass.
Definition object.hpp:836
void set_rel_value(const std::string &name, oks::OksData &value, bool skip_non_null_check)

◆ 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 649 of file OksConfigObject.cpp.

650{
651 set_value(name, value);
652}

◆ 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 754 of file OksConfigObject.cpp.

755{
756 set_vector(name, value);
757}
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 955 of file OksConfigObject.cpp.

956{
957 OksData d(new OksData::List());
958
959 for (const auto& i : value)
960 {
961 d.data.LIST->push_back(new OksData(static_cast<const OksConfigObject*>(i->implementation())->m_obj));
962 }
963
964 set_rel_value(name, d, skip_non_null_check);
965}
std::list< OksData *, boost::fast_pool_allocator< OksData * > > List
Definition object.hpp:455

◆ 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 814 of file OksConfigObject.cpp.

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

◆ 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 808 of file OksConfigObject.cpp.

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

◆ 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 778 of file OksConfigObject.cpp.

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

◆ 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 790 of file OksConfigObject.cpp.

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

◆ 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 802 of file OksConfigObject.cpp.

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

◆ 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 766 of file OksConfigObject.cpp.

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

◆ 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 820 of file OksConfigObject.cpp.

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

◆ 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 772 of file OksConfigObject.cpp.

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

◆ 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 784 of file OksConfigObject.cpp.

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

◆ 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 796 of file OksConfigObject.cpp.

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

◆ 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 760 of file OksConfigObject.cpp.

761{
762 set_vector(name, value);
763}

◆ 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 644 of file OksConfigObject.cpp.

645{
646 set_value(name, value);
647}

◆ 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 639 of file OksConfigObject.cpp.

640{
641 set_value(name, value);
642}

◆ 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 614 of file OksConfigObject.cpp.

615{
616 set_value(name, value);
617}

◆ 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 624 of file OksConfigObject.cpp.

625{
626 set_value(name, value);
627}

◆ 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 634 of file OksConfigObject.cpp.

635{
636 set_value(name, value);
637}

◆ 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 604 of file OksConfigObject.cpp.

605{
606 set_value(name, value);
607}

◆ 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 609 of file OksConfigObject.cpp.

610{
611 set_value(name, value);
612}

◆ 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 619 of file OksConfigObject.cpp.

620{
621 set_value(name, value);
622}

◆ 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 629 of file OksConfigObject.cpp.

630{
631 set_value(name, value);
632}

◆ 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 599 of file OksConfigObject.cpp.

600{
601 set_value(name, value);
602}

◆ set() [27/27]

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

Definition at line 144 of file OksConfigObject.hpp.

145 {
146 m_obj = obj;
147 }

◆ set_attr_value()

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

Definition at line 529 of file OksConfigObject.cpp.

530{
531 std::lock_guard<std::mutex> scoped_lock(m_mutex);
532
533 try
534 {
536 //test_checkout_needs();
537 m_obj->SetAttributeValue(name, &data);
538 }
539 catch (dunedaq::conffwk::Generic& ex)
540 {
541 throw dunedaq::conffwk::Generic( ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
542 }
543 catch(oks::exception& ex)
544 {
545 throw dunedaq::conffwk::Generic( ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
546 }
547}
static std::string mk_set_error_text(const char *what, const std::string &name, const OksObject *o, const char *error=nullptr)
void SetAttributeValue(const std::string &name, OksData *data)
Set value of attribute by name.
Definition object.cpp:1990

◆ 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 684 of file OksConfigObject.cpp.

685{
686 OksData d;
687
688 d.data.CLASS = nullptr;
689 d.type = OksData::class_type;
690
691 // try to find any attribute in this class; throw exception "no such attribute", if the class has no attributes at all
692 {
693 std::lock_guard<std::mutex> scoped_lock(m_mutex);
695
696 const std::list<OksAttribute *> * attrs = m_obj->GetClass()->all_attributes();
697
698 if (!attrs || attrs->empty())
699 {
700 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("attribute", name, m_obj, "no such attribute").c_str());
701 }
702
703 try
704 {
705 d.SetValue(value.c_str(), attrs->front());
706 }
707 catch (oks::exception & ex)
708 {
709 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
710 }
711 }
712
713 set_attr_value(name, d);
714}
const std::list< OksAttribute * > * all_attributes() const noexcept
Definition class.hpp:475
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 862 of file OksConfigObject.cpp.

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

◆ 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 717 of file OksConfigObject.cpp.

718{
719 OksData d;
720 d.type = OksData::date_type;
721
722 try
723 {
724 d.SetValue(value.c_str(), nullptr);
725 }
726 catch (oks::exception& ex)
727 {
728 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
729 }
730
731 set_attr_value(name, d);
732}

◆ 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 902 of file OksConfigObject.cpp.

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

◆ 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 655 of file OksConfigObject.cpp.

656{
657 OksData d;
658
659 {
660 std::lock_guard<std::mutex> scoped_lock(m_mutex);
662
663 if (OksAttribute * a = m_obj->GetClass()->find_attribute(name))
664 {
665 try
666 {
667 d.data.ENUMERATION = a->get_enum_value(value);
668 d.type = OksData::enum_type;
669 }
670 catch (std::exception& ex)
671 {
672 throw(dunedaq::conffwk::Generic( ERS_HERE, mk_set_error_text("attribute", name, m_obj, ex.what()).c_str()) );
673 }
674 }
675 else
676 {
677 throw ( dunedaq::conffwk::Generic( ERS_HERE, mk_set_error_text("attribute", name, m_obj, "no such attribute").c_str()) );
678 }
679 }
680
681 set_attr_value(name, d);
682}
OKS attribute class.
OksAttribute * find_attribute(const std::string &name) const noexcept
Find attribute (search in this and base classes).
Definition class.cpp:1026

◆ 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 826 of file OksConfigObject.cpp.

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

◆ set_rel_value()

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

Definition at line 550 of file OksConfigObject.cpp.

551{
552 std::lock_guard<std::mutex> scoped_lock(m_mutex);
553
554 try
555 {
557 //test_checkout_needs();
558 m_obj->SetRelationshipValue(name, &data, skip_non_null_check);
559 }
560 catch (dunedaq::conffwk::Generic& ex)
561 {
562 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("relationship", name, m_obj).c_str(), ex );
563 }
564 catch(oks::exception& ex)
565 {
566 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("relationship", name, m_obj).c_str(), ex);
567 }
568}
void SetRelationshipValue(const std::string &name, OksData *data, bool skip_non_null_check=false)
Set value of relationship by name.
Definition object.cpp:2189

◆ 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 735 of file OksConfigObject.cpp.

736{
737 OksData d;
738 d.type = OksData::time_type;
739
740 try
741 {
742 d.SetValue(value.c_str(), nullptr);
743 }
744 catch (oks::exception& ex)
745 {
746 throw dunedaq::conffwk::Generic( ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
747 }
748
749 set_attr_value(name, d);
750}

◆ 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 925 of file OksConfigObject.cpp.

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

◆ set_value()

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

Definition at line 573 of file OksConfigObject.cpp.

574 {
575 OksData d(value);
576 set_attr_value(name, d);
577 }

◆ set_vector()

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

Definition at line 581 of file OksConfigObject.cpp.

582 {
583 OksData d(new OksData::List());
584
585 for (const auto& i : value)
586 {
587 d.data.LIST->push_back(new OksData(i));
588 }
589
590 set_attr_value(name, d);
591 }

Friends And Related Symbol Documentation

◆ ConfigurationImpl

friend class ConfigurationImpl
friend

Definition at line 21 of file OksConfigObject.hpp.

◆ OksConfiguration

friend class OksConfiguration
friend

Definition at line 22 of file OksConfigObject.hpp.

Member Data Documentation

◆ m_obj

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

Definition at line 153 of file OksConfigObject.hpp.


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