8#ifndef CONFFWK_CONFIGOBJECT_H_
9#define CONFFWK_CONFIGOBJECT_H_
112 bool operator==(const
ConfigObject& other) const noexcept;
116 template <typename T>
119 this->
get(attrname, attrval);
123 template <
typename T>
125 std::vector<T> attrvals;
126 this->
get(attrname, attrvals);
130 template <
typename T>
183 return (
m_impl ==
nullptr);
278 template<
class T>
void get(
const std::string& name, T& value) {
297 rel(
const std::string& name, std::vector<ConfigObject>& value)
328 const std::string& relationship_name =
"*",
329 bool check_composite_only =
true,
330 unsigned long rlevel = 0,
331 const std::vector<std::string> * rclasses =
nullptr )
const {
350 m_impl->
set(name, o, skip_non_null_check);
365 void set_objs(
const std::string& name,
const std::vector<const ConfigObject*> & o,
bool skip_non_null_check =
false) {
366 m_impl->
set(name, o, skip_non_null_check);
391 template<
class T>
void set_by_val(
const std::string& name, T value) {
412 template<
class T>
void set_by_ref(
const std::string& name, T& value) {
429 void set_enum(
const std::string& name,
const std::string& value) {
446 void set_class(
const std::string& name,
const std::string& value) {
463 void set_date(
const std::string& name,
const std::string& value) {
480 void set_time(
const std::string& name,
const std::string& value) {
497 void set_enum(
const std::string& name,
const std::vector<std::string>& value) {
514 void set_class(
const std::string& name,
const std::vector<std::string>& value) {
531 void set_date(
const std::string& name,
const std::vector<std::string>& value) {
548 void set_time(
const std::string& name,
const std::vector<std::string>& value) {
564 void move(
const std::string& at) {
580 rename(
const std::string& new_id);
587 void print_ptr(std::ostream& s)
const noexcept;
597 const std::string& prefix =
"",
598 bool show_contained_in =
false
Implements database objects.
void convert(bool &value, const ConfigObject &obj, const std::string &attr_name) noexcept
virtual void clear() noexcept
Virtual method to clean resources used by the implementation object.
virtual const std::string contained_in() const =0
Virtual method to get object's database file name.
virtual void set(const std::string &attribute, bool value)=0
Virtual method to set boolean attribute value.
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 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 relat...
bool is_deleted() const
Check object and return true if the object has been deleted.
const std::string * m_class_name
virtual void set_time(const std::string &attribute, const std::string &value)=0
Virtual method to set time attribute value.
virtual void move(const std::string &at)=0
Virtual method to move object to a file.
virtual void set_enum(const std::string &attribute, const std::string &value)=0
Virtual method to set enumeration attribute value.
virtual void get(const std::string &attribute, bool &value)=0
Virtual method to read boolean attribute value.
virtual void set_class(const std::string &attribute, const std::string &value)=0
Virtual method to set enumeration attribute value.
virtual void set_date(const std::string &attribute, const std::string &value)=0
Virtual method to set date attribute value.
Represents database objects.
void set_time(const std::string &name, const std::string &value)
Set attribute time value.
void set_by_val(const std::string &name, T value)
Set attribute value.
ConfigObject * get_obj_pybind(const std::string &attrname)
void set_time(const std::string &name, const std::vector< std::string > &value)
Set attribute vector-of-times value.
T get_value_pybind(const std::string &attrname)
ConfigObject() noexcept
Default constructor.
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::string &value)
Set attribute date value.
void print_ptr(std::ostream &s) const noexcept
Print object's pointer in format 'obj-id@class-name'.
void set_objs(const std::string &name, const std::vector< const ConfigObject * > &o, bool skip_non_null_check=false)
Set relationship multi-value.
void move(const std::string &at)
Move object to a different database.
const std::string & UID() const noexcept
Return object identity.
void set_enum(const std::string &name, const std::vector< std::string > &value)
Set attribute vector-of-enumerations value.
ConfigObjectImpl * m_impl
Configuration * get_configuration() const
Get pointer to configuration object.
void set_class(const std::string &name, const std::string &value)
Set attribute class value.
void set_by_ref(const std::string &name, T &value)
Set attribute value.
bool is_deleted() const
Check if object was deleted.
void action_on_object_update(Configuration *db, const std::string &name)
void set_list_pybind(const std::string &attrname, std::vector< T > l)
void set_date(const std::string &name, const std::vector< std::string > &value)
Set attribute vector-of-dates value.
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.
void get(const std::string &name, T &value)
Get value of object's attribute or relationship.
void set_enum(const std::string &name, const std::string &value)
Set attribute enumeration value.
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.
const std::string full_name() const noexcept
Return full object name.
void set_obj(const std::string &name, const ConfigObject *o, bool skip_non_null_check=false)
Set relationship single-value.
bool is_null() const noexcept
Check if object's implementation points to null.
const ConfigObjectImpl * implementation() const noexcept
Returns pointer on implementation.
void rename(const std::string &new_id)
Rename object.
std::vector< T > get_list_pybind(const std::string &attrname)
const std::string & class_name() const noexcept
Return object's class name.
bool rel(const std::string &name, std::vector< ConfigObject > &value)
Get value of object's relationship.
const std::string contained_in() const
Return the name of the database file this object belongs to.
Provides pure virtual interface used by the Configuration class.
Defines base class for cache of template objects.
The base class for any generated DAL object.
DalRegistry: A registry of DalObjects It provides a single interface to create, cache and manage DalO...
std::ostream & operator<<(std::ostream &, const ConfigurationChange &)