DUNE-DAQ
DUNE Trigger and Data Acquisition software
|
Represents database objects. More...
#include <ConfigObject.hpp>
Public Member Functions | |
ConfigObject () noexcept | |
Default constructor. | |
ConfigObject (const ConfigObject &other) noexcept | |
Copy constructor. | |
ConfigObject (ConfigObjectImpl *impl) noexcept | |
Construct object from implementation object. | |
~ConfigObject () noexcept | |
Destructor. | |
ConfigObject & | operator= (const ConfigObject &other) noexcept |
Assignment operator. | |
ConfigObject & | operator= (ConfigObjectImpl *impl) noexcept |
Assignment from implementation object. | |
bool | operator== (const ConfigObject &other) const noexcept |
Compare two objects. | |
ConfigObject * | get_obj_pybind (const std::string &attrname) |
template<typename T > | |
T | get_value_pybind (const std::string &attrname) |
template<typename T > | |
std::vector< T > | get_list_pybind (const std::string &attrname) |
template<typename T > | |
void | set_list_pybind (const std::string &attrname, std::vector< T > l) |
bool | is_null () const noexcept |
Check if object's implementation points to null. | |
bool | is_deleted () const |
Check if object was deleted. | |
const std::string & | UID () const noexcept |
Return object identity. | |
const std::string & | class_name () const noexcept |
Return object's class name. | |
const std::string | full_name () const noexcept |
Return full object name. | |
const std::string | contained_in () const |
Return the name of the database file this object belongs to. | |
template<class T > | |
void | get (const std::string &name, T &value) |
Get value of object's attribute or relationship. | |
bool | rel (const std::string &name, std::vector< ConfigObject > &value) |
Get value of object's relationship. | |
void | referenced_by (std::vector< ConfigObject > &value, const std::string &relationship_name="*", bool check_composite_only=true, unsigned long rlevel=0, const std::vector< std::string > *rclasses=nullptr) const |
Get objects which have references to given object. | |
Configuration * | get_configuration () const |
Get pointer to configuration object. | |
void | set_obj (const std::string &name, const ConfigObject *o, bool skip_non_null_check=false) |
Set relationship single-value. | |
void | set_objs (const std::string &name, const std::vector< const ConfigObject * > &o, bool skip_non_null_check=false) |
Set relationship multi-value. | |
template<class T > | |
void | set_by_val (const std::string &name, T value) |
Set attribute value. | |
template<class T > | |
void | set_by_ref (const std::string &name, T &value) |
Set attribute value. | |
void | set_enum (const std::string &name, const std::string &value) |
Set attribute enumeration value. | |
void | set_class (const std::string &name, const std::string &value) |
Set attribute class value. | |
void | set_date (const std::string &name, const std::string &value) |
Set attribute date value. | |
void | set_time (const std::string &name, const std::string &value) |
Set attribute time value. | |
void | set_enum (const std::string &name, const std::vector< std::string > &value) |
Set attribute vector-of-enumerations value. | |
void | set_class (const std::string &name, const std::vector< std::string > &value) |
Set attribute vector-of-class value. | |
void | set_date (const std::string &name, const std::vector< std::string > &value) |
Set attribute vector-of-dates value. | |
void | set_time (const std::string &name, const std::vector< std::string > &value) |
Set attribute vector-of-times value. | |
void | move (const std::string &at) |
Move object to a different database. | |
void | rename (const std::string &new_id) |
Rename object. | |
void | print_ptr (std::ostream &s) const noexcept |
Print object's pointer in format 'obj-id@class-name'. | |
void | print_ref (std::ostream &s, Configuration &conf, const std::string &prefix="", bool show_contained_in=false) const noexcept |
Print details of object's attributes and relationships. | |
const ConfigObjectImpl * | implementation () const noexcept |
Returns pointer on implementation. | |
Private Member Functions | |
void | action_on_object_update (Configuration *db, const std::string &name) |
void | _clear () noexcept |
Private Attributes | |
ConfigObjectImpl * | m_impl |
Friends | |
class | Configuration |
class | ConfigurationImpl |
class | DalObject |
class | DalRegistry |
Represents database objects.
The class has default constructor, so user can declare instances locally or as a part of an array as he likes. However, the only way to retrieve a valid instance of the class is to call either Configuration::get(const std::string&, const std::string&, ConfigObject&) or Configuration::get(const std::string&, std::vector<ConfigObject>&) method.
The class has a copy constructor and an assignment operator, i.e. instances can be copied, passed by value, etc. All necessary bookkeeping is done transparent to user.
The class has methods to report object's class and identity:
Apart from this there is only one template method get() to retrieve values of object's attributes and relationships.
Definition at line 46 of file ConfigObject.hpp.
|
noexcept |
Default constructor.
The object is invalid until it is initialized by the Configuration::get(const std::string&, const std::string&, ConfigObject&) or Configuration::get(const std::string&, std::vector<ConfigObject>&) method.
Definition at line 13 of file ConfigObject.cpp.
|
noexcept |
Copy constructor.
All necessary bookkeeping relevant to implementation is done transparent to user.
Definition at line 18 of file ConfigObject.cpp.
|
noexcept |
Construct object from implementation object.
Definition at line 23 of file ConfigObject.cpp.
|
noexcept |
|
inlineprivatenoexcept |
Definition at line 614 of file ConfigObject.hpp.
|
private |
Definition at line 94 of file ConfigObject.cpp.
|
inlinenoexcept |
Return object's class name.
It corresponds to the actual name of the class from the database implementation.
The pair UID (see UID() method) and class name allows to identify object inside database.
Definition at line 231 of file ConfigObject.hpp.
|
inline |
Return the name of the database file this object belongs to.
dunedaq::conffwk::Generic | in case of an error |
Definition at line 249 of file ConfigObject.hpp.
|
inlinenoexcept |
Return full object name.
The method combines object identity and it's class name. Such full name is unique for any database object.
Definition at line 241 of file ConfigObject.hpp.
|
inline |
Get value of object's attribute or relationship.
Template parameter T can be:
All operations are simply forwarded to the implementation.
name | name of attribute or relationship |
value | type of attribute or relationship |
dunedaq::conffwk::Exception | in case of an error |
Definition at line 278 of file ConfigObject.hpp.
Configuration * dunedaq::conffwk::ConfigObject::get_configuration | ( | ) | const |
Get pointer to configuration object.
Definition at line 81 of file ConfigObject.cpp.
|
inline |
Definition at line 124 of file ConfigObject.hpp.
ConfigObject * dunedaq::conffwk::ConfigObject::get_obj_pybind | ( | const std::string & | attrname | ) |
Definition at line 297 of file ConfigObject.cpp.
|
inline |
Definition at line 117 of file ConfigObject.hpp.
|
inlinenoexcept |
Returns pointer on implementation.
This method exists only by the performance reasons.
Definition at line 608 of file ConfigObject.hpp.
|
inline |
Check if object was deleted.
Definition at line 192 of file ConfigObject.hpp.
|
inlinenoexcept |
Check if object's implementation points to null.
Returns false, if the object points to a valid implementation object. The object can point to null implementation object, if it was initialized via Configuration::get(relationship, object) and the relationship's value is not set.
Definition at line 181 of file ConfigObject.hpp.
|
inline |
Move object to a different database.
Forward operation to the implementation.
at | name of database file |
dunedaq::conffwk::Generic | in case of an error |
Definition at line 564 of file ConfigObject.hpp.
|
noexcept |
Assignment from implementation object.
Definition at line 43 of file ConfigObject.cpp.
|
noexcept |
Assignment operator.
All necessary bookkeeping relevant to implementation is done transparent to user.
Definition at line 33 of file ConfigObject.cpp.
|
noexcept |
Compare two objects.
Definition at line 53 of file ConfigObject.cpp.
|
noexcept |
Print object's pointer in format 'obj-id@class-name'.
Definition at line 61 of file ConfigObject.cpp.
|
noexcept |
Print details of object's attributes and relationships.
s | the output stream |
conf | the configuration object (required to read schema description) |
prefix | optional shift output using prefix |
show_contained_in | optional print out info about object database file |
Definition at line 194 of file ConfigObject.cpp.
|
inline |
Get objects which have references to given object.
The method returns objects, which have references on given object via explicitly provided relationship name. If the relationship name is set to "*", then the method takes into account all relationships of all objects. The method is efficient only for composite relationships (i.e. when a parent has composite reference on this object). For generic relationships the method performs full scan of all database objects, so at large scale this method should not be applied to every object.
value | returned objects |
relationship_name | name of relationship (if "*", then return objects referencing via ANY relationship) |
check_composite_only | only returned composite parent objects |
rlevel | optional references level to optimize performance (defines how many objects referenced by given object have also to be read to the implementation cache) |
rclasses | optional array of class names to optimize performance (defines which referenced objects have to be read to the implementation cache) |
dunedaq::conffwk::Generic | in case of an error |
Definition at line 327 of file ConfigObject.hpp.
|
inline |
Get value of object's relationship.
Forward to implementation and convert value.
name | name of relationship |
value | returned value of relationship |
dunedaq::conffwk::Exception | in case of an error |
Definition at line 297 of file ConfigObject.hpp.
void dunedaq::conffwk::ConfigObject::rename | ( | const std::string & | new_id | ) |
Rename object.
Forward operation to the implementation.
new_id | new object ID |
dunedaq::conffwk::Generic | in case of an error |
Definition at line 87 of file ConfigObject.cpp.
|
inline |
Set attribute value.
Template parameter T can be:
All operations are simply forwarded to the implementation.
name | name of attribute |
value | type of attribute |
dunedaq::conffwk::Generic | in case of an error |
Definition at line 412 of file ConfigObject.hpp.
|
inline |
Set attribute value.
Template parameter T can be:
All operations are simply forwarded to the implementation.
name | name of attribute |
value | type of attribute |
dunedaq::conffwk::Generic | in case of an error |
Definition at line 391 of file ConfigObject.hpp.
|
inline |
Set attribute class value.
Forward operation to the implementation.
name | name of attribute |
value | value of attribute |
dunedaq::conffwk::Generic | in case of an error |
Definition at line 446 of file ConfigObject.hpp.
|
inline |
Set attribute vector-of-class value.
Forward operation to the implementation.
name | name of attribute |
value | value of attribute |
dunedaq::conffwk::Generic | in case of an error |
Definition at line 514 of file ConfigObject.hpp.
|
inline |
Set attribute date value.
Forward operation to the implementation.
name | name of attribute |
value | value of attribute |
dunedaq::conffwk::Generic | in case of an error |
Definition at line 463 of file ConfigObject.hpp.
|
inline |
Set attribute vector-of-dates value.
Forward operation to the implementation.
name | name of attribute |
value | value of attribute |
dunedaq::conffwk::Generic | in case of an error |
Definition at line 531 of file ConfigObject.hpp.
|
inline |
Set attribute enumeration value.
Forward operation to the implementation.
name | name of attribute |
value | value of attribute |
dunedaq::conffwk::Generic | in case of an error |
Definition at line 429 of file ConfigObject.hpp.
|
inline |
Set attribute vector-of-enumerations value.
Forward operation to the implementation.
name | name of attribute |
value | value of attribute |
dunedaq::conffwk::Generic | in case of an error |
Definition at line 497 of file ConfigObject.hpp.
|
inline |
Definition at line 131 of file ConfigObject.hpp.
|
inline |
Set relationship single-value.
name | name of relationship |
o | pointer to object |
skip_non_null_check | if true, ignore low cardinality constraint |
dunedaq::conffwk::Generic | in case of an error |
Definition at line 349 of file ConfigObject.hpp.
|
inline |
Set relationship multi-value.
name | name of relationship |
o | vector of pointers on conffwk object |
skip_non_null_check | if true, ignore low cardinality constraint |
dunedaq::conffwk::Generic | in case of an error |
Definition at line 365 of file ConfigObject.hpp.
|
inline |
Set attribute time value.
Forward operation to the implementation.
name | name of attribute |
value | value of attribute |
dunedaq::conffwk::Generic | in case of an error |
Definition at line 480 of file ConfigObject.hpp.
|
inline |
Set attribute vector-of-times value.
Forward operation to the implementation.
name | name of attribute |
value | value of attribute |
dunedaq::conffwk::Generic | in case of an error |
Definition at line 548 of file ConfigObject.hpp.
|
inlinenoexcept |
Return object identity.
The identity corresponds to the unique identity of object within it's class. It is taken from database implementation. For named objects it can be a meaningful string.
The pair UID and class name (see class_name() method) allows to identify object inside database.
Definition at line 218 of file ConfigObject.hpp.
|
friend |
Definition at line 48 of file ConfigObject.hpp.
|
friend |
Definition at line 49 of file ConfigObject.hpp.
|
friend |
Definition at line 50 of file ConfigObject.hpp.
|
friend |
Definition at line 51 of file ConfigObject.hpp.
|
private |
Definition at line 625 of file ConfigObject.hpp.