55 if(
this == &other ||
m_impl == other.m_impl)
return true;
56 if(!
m_impl || !other.m_impl)
return false;
57 return ((
UID() == other.UID()) && (
class_name() == other.class_name()));
67 s <<
"(deleted object " <<
full_name() <<
')';
83 return m_impl->m_impl->m_conf;
131 s << static_cast<uint16_t>(val);
138 s << static_cast<int16_t>(val);
151 std::vector<T> value;
153 obj.get(name, value);
157 for (
unsigned int i = 0; i < value.size(); ++i)
173 obj.get(name, value);
182 s <<
"[bad_object] (could not get value of \'" << name <<
"\' of object \'" << &
obj <<
"\': " << ex <<
')';
190 return (o ==
nullptr || o->
is_null());
196 static bool expand_aggregation = (getenv(
"TDAQ_CONFFWK_PRINT_EXPAND_AGGREGATIONS"));
201 s << prefix <<
"(null)";
207 << prefix <<
"Object:\n"
208 << prefix <<
" id: \'" <<
UID() <<
"\', class name: \'" <<
class_name() <<
"\'\n";
210 if (show_contained_in)
211 s << prefix <<
" contained in: \'" <<
contained_in() <<
"\'\n";
220 const std::string& aname(i.p_name);
221 const bool ismv(i.p_is_multi_value);
223 s << prefix <<
" " << aname <<
": ";
244 default: s <<
"*** bad type ***";
253 s << prefix <<
" " << i.p_name <<
':';
254 if (expand_aggregation ==
false || i.p_is_aggregation ==
false)
263 std::string prefix2(prefix +
" ");
267 std::vector<ConfigObject> value;
268 obj.get(i.p_name, value);
270 s << prefix2 <<
"(null)\n";
272 for (
const auto& x : value)
273 x.print_ref(s,
conffwk, prefix2, show_contained_in);
278 obj.get(i.p_name, value);
280 s << prefix2 <<
"(null)\n";
287 catch (dunedaq::conffwk::Exception& ex)
289 s <<
"cannot get schema description: caught dunedaq::conffwk::Exception exception" << std::endl;
290 std::cerr <<
"ERROR: " << ex << std::endl;
302 this->
get(attrname, *newobject);
Implements database objects.
Represents database objects.
ConfigObject * get_obj_pybind(const std::string &attrname)
ConfigObject() noexcept
Default constructor.
friend class Configuration
bool operator==(const ConfigObject &other) const noexcept
Compare two objects.
void print_ptr(std::ostream &s) const noexcept
Print object's pointer in format 'obj-id@class-name'.
const std::string & UID() const noexcept
Return object identity.
ConfigObjectImpl * m_impl
Configuration * get_configuration() const
Get pointer to configuration object.
void action_on_object_update(Configuration *db, const std::string &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.
void get(const std::string &name, T &value)
Get value of object's attribute or relationship.
ConfigObject & operator=(const ConfigObject &other) noexcept
Assignment operator.
const std::string full_name() const noexcept
Return full object name.
bool is_null() const noexcept
Check if object's implementation points to null.
void rename(const std::string &new_id)
Rename object.
~ConfigObject() noexcept
Destructor.
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.
void action_on_update(const ConfigObject &obj, const std::string &name)
void rename_object(ConfigObject &obj, const std::string &new_id)
Cache of template object of given type.
Base class for any user define issue.
void print_val(const T &val, std::ostream &s)
static void print_sep(const char sep, std::ostream &s)
void print_val< uint8_t >(const uint8_t &val, std::ostream &s)
bool is_null_obj(const ConfigObject *o)
void print_value(const ConfigObject &const_obj, const std::string &name, const bool ismv, const char sep, std::ostream &s)
void print_val< int8_t >(const int8_t &val, std::ostream &s)
std::ostream & operator<<(std::ostream &, const ConfigurationChange &)
const std::vector< attribute_t > p_attributes
const std::vector< relationship_t > p_relationships