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 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::OksObject * m_obj

Friends

class ConfigurationImpl
class OksConfiguration

Additional Inherited Members

Static Public Member Functions inherited from dunedaq::conffwk::ConfigObjectImpl
static ConfigObjectImpl * default_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
ConfigurationImpl * m_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 100 of file OksConfigObject.cpp.

101 : ConfigObjectImpl(impl, obj->GetId())
102 , m_obj(obj)
103{
104}
ConfigObjectImpl(ConfigurationImpl *impl, const std::string &id, dunedaq::conffwk::ObjectState state=dunedaq::conffwk::Valid) noexcept
The constructor stores configuration implementation pointer.
msgpack::object obj

◆ ~OksConfigObject()

OksConfigObject::~OksConfigObject ( )
virtualnoexcept

Definition at line 106 of file OksConfigObject.cpp.

106{}

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

110{
111 std::lock_guard<std::mutex> scoped_lock(m_mutex);
113 return m_obj->get_file()->get_full_file_name();
114}
const std::string & get_full_file_name() const
Definition file.hpp:528
OksFile * get_file() const
Definition object.hpp:1306

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

118{
119 get_value(name, value);
120}
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 214 of file OksConfigObject.cpp.

215{
216 OksData* data = 0;
217
218 std::lock_guard<std::mutex> scoped_lock(m_mutex);
219
220 try {
223 } catch (oks::exception& ex) {
224 throw dunedaq::conffwk::Generic(ERS_HERE, mk_get_error_text("relationship", name, m_obj).c_str(), ex);
225 }
226
227 if (data->type != OksData::object_type) {
228 if (data->type == OksData::uid_type || data->type == OksData::uid2_type) {
229 std::ostringstream text;
230 text << "referenced object " << *data << " is not loaded";
231 throw dunedaq::conffwk::Generic(ERS_HERE,
232 mk_get_error_text("relationship", name, m_obj, text.str().c_str()).c_str());
233 }
234
235 std::ostringstream text;
236 text << "bad value of relationship \"" << name << "\" of object " << m_obj << ": ";
237
238 if (data->type == OksData::list_type) {
239 text << "the relationship is multi-value";
240 } else {
241 text << "non-object type was read";
242 }
243 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
244 }
245
246 if (data->data.OBJECT != nullptr) {
247 value = static_cast<OksConfiguration*>(m_impl)->new_object(data->data.OBJECT);
248 } else {
249 value = nullptr;
250 }
251}
#define ERS_HERE
static std::string mk_get_error_text(const char *what, const std::string &name, const OksObject *o, const char *error=nullptr)
OksData * GetRelationshipValue(const std::string &) const
Get value of relationship by name.
Definition object.cpp:1944

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

178{
179 get_value(name, value);
180}

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

172{
173 get_value(name, value);
174}

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

142{
143 get_value(name, value);
144}

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

154{
155 get_value(name, value);
156}

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

166{
167 get_value(name, value);
168}

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

130{
131 get_value(name, value);
132}

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

184{
185 OksData* data = 0;
186
187 std::lock_guard<std::mutex> scoped_lock(m_mutex);
188
189 try {
192 } catch (oks::exception& ex) {
193 throw dunedaq::conffwk::Generic(ERS_HERE, mk_get_error_text("attribute", name, m_obj).c_str(), ex);
194 }
195
196 if ((data->type == OksData::string_type) || (data->type == OksData::enum_type)) {
197 value = *data->data.STRING;
198 return;
199 } else if (data->type == OksData::date_type || data->type == OksData::time_type) {
200 value = data->str();
201 return;
202 } else if (data->type == OksData::class_type) {
203 value = data->data.CLASS->get_name();
204 return;
205 } else {
206 std::ostringstream text;
207 text << "read wrong attribute type instead of expected \'string\' for attribute \"" << name << "\" of object "
208 << m_obj;
209 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
210 }
211}
OksData * GetAttributeValue(const std::string &name) const
Get value of attribute by name.
Definition object.cpp:1852

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

255{
256 get_vector(name, value);
257}
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 314 of file OksConfigObject.cpp.

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

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

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

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

279{
280 get_vector(name, value);
281}

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

291{
292 get_vector(name, value);
293}

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

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

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

267{
268 get_vector(name, value);
269}

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

321{
322 OksData* data = 0;
323
324 std::lock_guard<std::mutex> scoped_lock(m_mutex);
325
326 try {
329 } catch (oks::exception& ex) {
330 throw dunedaq::conffwk::Generic(ERS_HERE, mk_get_error_text("attribute", name, m_obj).c_str(), ex);
331 }
332
333 if (data->type != OksData::list_type) {
334 std::ostringstream text;
335 text << "attribute \"" << name << "\" of object " << m_obj << " is not of a multi-value";
336 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
337 }
338
339 value.clear();
340
341 for (const auto& it : *data->data.LIST) {
342 if ((it->type == OksData::string_type) || (it->type == OksData::enum_type)) {
343 value.emplace_back(*it->data.STRING);
344 } else if (it->type == OksData::class_type) {
345 value.emplace_back(it->data.CLASS->get_name());
346 } else if (it->type == OksData::date_type || it->type == OksData::time_type) {
347 value.emplace_back(it->str());
348 } else {
349 std::ostringstream text;
350 text << "wrong type of attribute \"" << name << "\" of object " << m_obj << " (instead of expected string)";
351 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
352 }
353 }
354}

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

273{
274 get_vector(name, value);
275}

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

285{
286 get_vector(name, value);
287}

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

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

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

261{
262 get_vector(name, value);
263}

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

136{
137 get_value(name, value);
138}

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

148{
149 get_value(name, value);
150}

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

160{
161 get_value(name, value);
162}

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

124{
125 get_value(name, value);
126}

◆ get_type()

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

Definition at line 47 of file OksConfigObject.cpp.

48{
49 try {
50 return m_obj->GetAttributeValue(name)->type;
51 } catch (oks::exception& ex) {
52 throw dunedaq::conffwk::Generic(ERS_HERE, mk_get_error_text("attribute", name, m_obj).c_str(), ex);
53 }
54}
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 59 of file OksConfigObject.cpp.

60{
61 std::lock_guard<std::mutex> scoped_lock(m_mutex);
62
63 try {
65 OksData* data(m_obj->GetAttributeValue(name));
66 value = *reinterpret_cast<T*>(&data->data); // really ugly stuff here, but should come out right
67 } catch (oks::exception& ex) {
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 75 of file OksConfigObject.cpp.

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

◆ move()

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

Virtual method to move object to a file.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 877 of file OksConfigObject.cpp.

878{
879 std::lock_guard<std::mutex> scoped_lock(m_mutex);
880
882
883 if (OksFile* new_file_h = m_obj->GetClass()->get_kernel()->find_data_file(at)) {
884 OksFile* old_file_h = m_obj->get_file();
885 if (old_file_h != new_file_h) {
886 try {
887 // static_cast<OksConfiguration *>(m_impl)->test_and_checkout(old_file_h);
888 // static_cast<OksConfiguration *>(m_impl)->test_and_checkout(new_file_h);
889 m_obj->set_file(new_file_h, false);
890 } catch (oks::exception& ex) {
891 throw dunedaq::conffwk::Generic(ERS_HERE, ex.what());
892 }
893 }
894 } else {
895 std::ostringstream text;
896 text << "file \"" << at << "\" is not loaded";
897 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
898 }
899}
OksKernel * get_kernel() const noexcept
Definition class.hpp:348
OksFile * find_data_file(const std::string &s) const
Finds OKS data file.
Definition kernel.cpp:2119
void set_file(OksFile *file, bool update_owner=true)
Move object to different file.
Definition object.cpp:1468
const OksClass * GetClass() const
Definition object.hpp:1286

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

431{
432 value.clear();
433
434 std::lock_guard<std::mutex> scoped_lock(m_mutex);
436
437 if (check_composite_only) {
438 bool any_name = (rname == "*");
439
440 if (const std::list<OksRCR*>* rcr = m_obj->reverse_composite_rels()) {
441 for (const auto& i : *rcr) {
442 if (any_name || rname == i->relationship->get_name()) {
443 value.push_back(conffwk::ConfigObject(static_cast<OksConfiguration*>(m_impl)->new_object(i->obj)));
444 }
445 }
446 }
447 } else {
448 if (OksObject::FList* objs = m_obj->get_all_rels(rname)) {
449 for (const auto& i : *objs) {
450 value.push_back(conffwk::ConfigObject(static_cast<OksConfiguration*>(m_impl)->new_object(i)));
451 }
452
453 delete objs;
454 }
455 }
456}
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:1589
FList * get_all_rels(const std::string &name="*") const
Return objects referencing this one via relationship with given name.
Definition object.cpp:3062
std::list< OksObject *, boost::fast_pool_allocator< OksObject * > > FList
Definition object.hpp:1181

◆ rel()

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

Definition at line 390 of file OksConfigObject.cpp.

391{
392 std::lock_guard<std::mutex> scoped_lock(m_mutex);
393
394 try {
396
397 if (OksDataInfo* di = m_obj->GetClass()->get_data_info(name)) {
398 if (di->relationship) {
399 OksData* data = m_obj->GetRelationshipValue(di);
400
401 if (data->type == OksData::object_type) {
402 if (data->data.OBJECT != nullptr) {
403 value.push_back(
404 conffwk::ConfigObject(static_cast<OksConfiguration*>(m_impl)->new_object(data->data.OBJECT)));
405 }
406 } else if (data->type == OksData::list_type) {
407 for (const auto& it : *data->data.LIST) {
408 if (it->type == OksData::object_type) {
409 value.push_back(
410 conffwk::ConfigObject(static_cast<OksConfiguration*>(m_impl)->new_object(it->data.OBJECT)));
411 }
412 }
413 }
414
415 return true;
416 }
417 }
418
419 return false;
420 } catch (oks::exception& ex) {
421 throw dunedaq::conffwk::Generic(ERS_HERE, mk_get_error_text("relationship", name, m_obj).c_str(), ex);
422 }
423}
OksDataInfo * get_data_info(const std::string &s) const noexcept
Get OKS data information for attribute or relationship.
Definition class.hpp:825

◆ rename()

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

Virtual method to change object ID.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 902 of file OksConfigObject.cpp.

903{
904 try {
906
907 // std::set<OksFile *> files;
908 //
909 // files.insert(m_obj->get_file());
910 //
911 // if (OksObject::FList * objs = m_obj->get_all_rels())
912 // {
913 // for (auto & f : *objs)
914 // {
915 // files.insert(f->get_file());
916 // }
917 //
918 // delete objs;
919 // }
920 //
921 // for (auto & f : files)
922 // {
923 // static_cast<OksConfiguration *>(m_impl)->test_and_checkout(f);
924 // }
925
926 m_obj->set_id(new_id);
927 } catch (oks::exception& ex) {
928 std::ostringstream text;
929 text << "cannot rename object " << m_obj << " to new name \'" << new_id << "\' because " << ex.what();
930 throw dunedaq::conffwk::Generic(ERS_HERE, text.str().c_str());
931 }
932}
void set_id(const std::string &id)
Set object ID.
Definition object.cpp:1488

◆ reset()

void OksConfigObject::reset ( )
virtual

Virtual method to reset the implementation object from unknown state.

Implements dunedaq::conffwk::ConfigObjectImpl.

Definition at line 935 of file OksConfigObject.cpp.

936{
937 if (OksClass* c = static_cast<OksConfiguration*>(m_impl)->m_kernel->find_class(*m_class_name)) {
938 m_obj = c->get_object(m_id);
939 } else {
940 m_obj = nullptr;
941 }
942
944}
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 518 of file OksConfigObject.cpp.

519{
520 set_value(name, value);
521}
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 850 of file OksConfigObject.cpp.

851{
852 OksData d((value != nullptr) ? static_cast<const OksConfigObject*>(value->implementation())->m_obj
853 : (OksObject*)nullptr);
854 set_rel_value(name, d, skip_non_null_check);
855}
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 584 of file OksConfigObject.cpp.

585{
586 set_value(name, value);
587}

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

676{
677 set_vector(name, value);
678}
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 858 of file OksConfigObject.cpp.

861{
862 OksData d(new OksData::List());
863
864 for (const auto& i : value) {
865 d.data.LIST->push_back(new OksData(static_cast<const OksConfigObject*>(i->implementation())->m_obj));
866 }
867
868 set_rel_value(name, d, skip_non_null_check);
869}
std::list< OksData *, boost::fast_pool_allocator< OksData * > > List
Definition object.hpp:515

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

736{
737 set_vector(name, value);
738}

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

730{
731 set_vector(name, value);
732}

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

700{
701 set_vector(name, value);
702}

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

712{
713 set_vector(name, value);
714}

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

724{
725 set_vector(name, value);
726}

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

688{
689 set_vector(name, value);
690}

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

742{
743 set_vector(name, value);
744}

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

694{
695 set_vector(name, value);
696}

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

706{
707 set_vector(name, value);
708}

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

718{
719 set_vector(name, value);
720}

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

682{
683 set_vector(name, value);
684}

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

579{
580 set_value(name, value);
581}

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

573{
574 set_value(name, value);
575}

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

543{
544 set_value(name, value);
545}

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

555{
556 set_value(name, value);
557}

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

567{
568 set_value(name, value);
569}

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

531{
532 set_value(name, value);
533}

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

537{
538 set_value(name, value);
539}

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

549{
550 set_value(name, value);
551}

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

561{
562 set_value(name, value);
563}

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

525{
526 set_value(name, value);
527}

◆ set() [27/27]

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

Definition at line 153 of file OksConfigObject.hpp.

153{ m_obj = obj; }

◆ set_attr_value()

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

Definition at line 465 of file OksConfigObject.cpp.

466{
467 std::lock_guard<std::mutex> scoped_lock(m_mutex);
468
469 try {
471 // test_checkout_needs();
472 m_obj->SetAttributeValue(name, &data);
473 } catch (dunedaq::conffwk::Generic& ex) {
474 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
475 } catch (oks::exception& ex) {
476 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
477 }
478}
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:1930

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

616{
617 OksData d;
618
619 d.data.CLASS = nullptr;
620 d.type = OksData::class_type;
621
622 // try to find any attribute in this class; throw exception "no such attribute", if the class has no attributes at all
623 {
624 std::lock_guard<std::mutex> scoped_lock(m_mutex);
626
627 const std::list<OksAttribute*>* attrs = m_obj->GetClass()->all_attributes();
628
629 if (!attrs || attrs->empty()) {
630 throw dunedaq::conffwk::Generic(ERS_HERE,
631 mk_set_error_text("attribute", name, m_obj, "no such attribute").c_str());
632 }
633
634 try {
635 d.SetValue(value.c_str(), attrs->front());
636 } catch (oks::exception& ex) {
637 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
638 }
639 }
640
641 set_attr_value(name, d);
642}
const std::list< OksAttribute * > * all_attributes() const noexcept
Definition class.hpp:470
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 776 of file OksConfigObject.cpp.

777{
778 OksData d(new OksData::List());
779
780 // try to find any attribute in this class; throw exception "no such attribute", if the class has no attributes at all
781
782 {
783 std::lock_guard<std::mutex> scoped_lock(m_mutex);
785
786 const std::list<OksAttribute*>* attrs = m_obj->GetClass()->all_attributes();
787
788 if (!attrs || attrs->empty()) {
789 throw dunedaq::conffwk::Generic(ERS_HERE,
790 mk_set_error_text("attribute", name, m_obj, "no such attribute").c_str());
791 }
792
793 for (const auto& i : value) {
794 OksData* d2 = new OksData();
795 d2->data.CLASS = 0;
797
798 try {
799 d2->SetValue(i.c_str(), attrs->front());
800 } catch (oks::exception& ex) {
801 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
802 }
803
804 d.data.LIST->push_back(d2);
805 }
806 }
807
808 set_attr_value(name, d);
809}
union dunedaq::oks::OksData::Data data
void SetValue(const char *s, const OksAttribute *a)
const OksClass * CLASS
Definition object.hpp:555

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

646{
647 OksData d;
648 d.type = OksData::date_type;
649
650 try {
651 d.SetValue(value.c_str(), nullptr);
652 } catch (oks::exception& ex) {
653 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
654 }
655
656 set_attr_value(name, d);
657}

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

813{
814 OksData d(new OksData::List());
815
816 for (const auto& i : value) {
817 OksData* d2 = new OksData();
819 try {
820 d2->SetValue(i.c_str(), nullptr);
821 } catch (oks::exception& ex) {
822 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
823 }
824 d.data.LIST->push_back(d2);
825 }
826
827 set_attr_value(name, d);
828}

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

591{
592 OksData d;
593
594 {
595 std::lock_guard<std::mutex> scoped_lock(m_mutex);
597
598 if (OksAttribute* a = m_obj->GetClass()->find_attribute(name)) {
599 try {
600 d.data.ENUMERATION = a->get_enum_value(value);
601 d.type = OksData::enum_type;
602 } catch (std::exception& ex) {
603 throw(dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("attribute", name, m_obj, ex.what()).c_str()));
604 }
605 } else {
606 throw(
607 dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("attribute", name, m_obj, "no such attribute").c_str()));
608 }
609 }
610
611 set_attr_value(name, d);
612}
OksAttribute * find_attribute(const std::string &name) const noexcept
Find attribute (search in this and base classes).
Definition class.cpp:985

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

748{
749 OksData d(new OksData::List());
750
751 {
752 std::lock_guard<std::mutex> scoped_lock(m_mutex);
754
755 if (OksAttribute* a = m_obj->GetClass()->find_attribute(name)) {
756 for (const auto& i : value) {
757 OksData* d2 = new OksData();
758 try {
759 d2->data.ENUMERATION = a->get_enum_value(i); // new OksString(i);
761 d.data.LIST->push_back(d2);
762 } catch (std::exception& ex) {
763 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
764 }
765 }
766 } else {
767 throw dunedaq::conffwk::Generic(ERS_HERE,
768 mk_set_error_text("attribute", name, m_obj, "no such attribute").c_str());
769 }
770 }
771
772 set_attr_value(name, d);
773}
const std::string * ENUMERATION
Definition object.hpp:571

◆ set_rel_value()

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

Definition at line 481 of file OksConfigObject.cpp.

482{
483 std::lock_guard<std::mutex> scoped_lock(m_mutex);
484
485 try {
487 // test_checkout_needs();
488 m_obj->SetRelationshipValue(name, &data, skip_non_null_check);
489 } catch (dunedaq::conffwk::Generic& ex) {
490 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("relationship", name, m_obj).c_str(), ex);
491 } catch (oks::exception& ex) {
492 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("relationship", name, m_obj).c_str(), ex);
493 }
494}
void SetRelationshipValue(const std::string &name, OksData *data, bool skip_non_null_check=false)
Set value of relationship by name.
Definition object.cpp:2125

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

661{
662 OksData d;
663 d.type = OksData::time_type;
664
665 try {
666 d.SetValue(value.c_str(), nullptr);
667 } catch (oks::exception& ex) {
668 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
669 }
670
671 set_attr_value(name, d);
672}

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

832{
833 OksData d(new OksData::List());
834
835 for (const auto& i : value) {
836 OksData* d2 = new OksData();
838 try {
839 d2->SetValue(i.c_str(), 0);
840 } catch (oks::exception& ex) {
841 throw dunedaq::conffwk::Generic(ERS_HERE, mk_set_error_text("attribute", name, m_obj).c_str(), ex);
842 }
843 d.data.LIST->push_back(d2);
844 }
845
846 set_attr_value(name, d);
847}

◆ set_value()

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

Definition at line 498 of file OksConfigObject.cpp.

499{
500 OksData d(value);
501 set_attr_value(name, d);
502}

◆ set_vector()

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

Definition at line 506 of file OksConfigObject.cpp.

507{
508 OksData d(new OksData::List());
509
510 for (const auto& i : value) {
511 d.data.LIST->push_back(new OksData(i));
512 }
513
514 set_attr_value(name, d);
515}

◆ ConfigurationImpl

friend class ConfigurationImpl
friend

Definition at line 29 of file OksConfigObject.hpp.

◆ OksConfiguration

friend class OksConfiguration
friend

Definition at line 30 of file OksConfigObject.hpp.

Member Data Documentation

◆ m_obj

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

Definition at line 158 of file OksConfigObject.hpp.


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