14#include <pybind11/pybind11.h>
15#include <pybind11/stl.h>
16#include <pybind11/stl_bind.h>
22namespace py = pybind11;
30 py::class_<Configuration>(m,
"_Configuration")
32 .def(py::init<std::string>())
35 "Add include file to existing database.",
40 "Get the properties of each attribute in a given class",
41 py::arg(
"class_name"),
48 "Create a database from a list of files",
52 py::overload_cast<const std::string&, const std::string&, const std::string&>(
54 "Create new object by class name and object id.",
56 py::arg(
"class_name"),
59 py::overload_cast<const ConfigObject&, const std::string&, const std::string&>(
61 "Create new object by class name and object id.",
63 py::arg(
"class_name"),
66 .def(
"get_impl_param",
68 "Get implementation plug-in parameter used to build conffwk object")
71 "Get implementation plug-in and its parameter used to build conffwk object")
74 "Returns list of files included by given database.",
76 .def(
"get_schema_path",
78 "Get path to schema file with definition of the given class",
79 py::arg(
"class_name"))
82 "Create a configuration object containing the desired entity from the database",
83 py::arg(
"class_name"),
87 "Create a list of configuration objects of a given class from the database",
88 py::arg(
"class_name"),
89 py::arg(
"query") =
"")
90 .def(
"load", &
Configuration::load,
"Load database according to the name.", py::arg(
"db_name"))
96 "Get the properties of each relation in a given class",
97 py::arg(
"class_name"),
101 "Get the superclasses of a single class",
102 py::arg(
"class_name"),
106 "Get the subclasses of a single class",
107 py::arg(
"class_name"),
111 "Test the existence of the object",
112 py::arg(
"class_name"),
123 py::class_<ConfigObject>(m,
"_ConfigObject")
125 .def(py::init<const ConfigObject&>())
158 "Set relationship single-value",
161 py::arg(
"skip_non_null_check") =
false)
164 "Set relationship multi-value.",
167 py::arg(
"skip_non_null_check") =
false)
170 "Set the class name",
203 "Setter function for list",
208 "Setter function for list",
213 "Setter function for list",
218 "Setter function for list",
223 "Setter function for list",
228 "Setter function for list",
233 "Setter function for list",
238 "Setter function for list",
243 "Setter function for list",
246 .def(
"set_float_vec",
248 "Setter function for list",
251 .def(
"set_double_vec",
253 "Setter function for list",
256 .def(
"set_class_vec",
258 "Set list of classes",
271 .def(
"set_string_vec",
273 "Set list of strings",
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)
T get_value_pybind(const std::string &attrname)
void set_date(const std::string &name, const std::string &value)
Set attribute date value.
void set_objs(const std::string &name, const std::vector< const ConfigObject * > &o, bool skip_non_null_check=false)
Set relationship multi-value.
const std::string & UID() const noexcept
Return object identity.
void set_class(const std::string &name, const std::string &value)
Set attribute class value.
void set_list_pybind(const std::string &attrname, std::vector< T > l)
void set_enum(const std::string &name, const std::string &value)
Set attribute enumeration value.
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.
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.
const std::string contained_in() const
Return the name of the database file this object belongs to.
Defines base class for cache of template objects.
std::vector< ConfigObject > * get_objs_pybind(const std::string &class_name, const std::string &query="")
std::unordered_map< std::string, std::unordered_map< std::string, std::string > > attributes_pybind(const std::string &class_name, bool all)
void destroy_obj(ConfigObject &object)
Destroy object.
std::unordered_map< std::string, std::unordered_map< std::string, std::string > > relations_pybind(const std::string &class_name, bool all)
void remove_include(const std::string &db_name, const std::string &include)
Remove include file.
void load(const std::string &db_name)
Load database according to the name. If name is empty, take it from TDAQ_DB_NAME and TDAQ_DB_DATA env...
const std::string & get_impl_param() const noexcept
std::vector< std::string > superclasses_pybind(const std::string &class_name, bool all)
void create(const std::string &at, const std::string &class_name, const std::string &id, ConfigObject &object)
Create new object by class name and object id.
std::vector< std::string > subclasses_pybind(const std::string &class_name, bool all)
std::list< std::string > * return_includes_pybind(const std::string &db_name)
bool loaded() const noexcept
Check if database is correctly loaded.
std::vector< std::string > get_class_list() const
const std::string & get_schema_path_pybind(const std::string &class_name)
const std::string & get_impl_spec() const noexcept
void commit(const std::string &log_message="")
Commit database changes.
ConfigObject * get_obj_pybind(const std::string &class_name, const std::string &id)
void unload()
Unload database.
bool test_object(const std::string &class_name, const std::string &id, unsigned long rlevel=0, const std::vector< std::string > *rclasses=0)
Test the object existence.
void add_include(const std::string &db_name, const std::string &include)
Add include file to existing database.
ConfigObject * create_and_return_obj_pybind(const std::string &at, const std::string &class_name, const std::string &id)
void register_conffwk(py::module &m)
void register_conffwkobject(py::module &m)