8#ifndef DBE_CONFIG_REFERENCE_HPP_
9#define DBE_CONFIG_REFERENCE_HPP_
19#ifndef DONOT_THROW_ON_NULL_CONFIGOBJECT_REFERENCE
20#define DEBUG_THROW_ON_NULL_CONFIGOBJECT_REFERENCE \
21 if(check_null and rval.is_deleted()) \
22 throw daq::dbe::null_config_reference_access(ERS_HERE);
24#define DEBUG_THROW_ON_NULL_CONFIGOBJECT_REFERENCE
62template<
typename >
class gref;
63template<
typename >
class aref;
72 template<
typename >
friend class aref;
73 template<
typename >
friend class gref;
97 void rename(std::string
const & newname)
132template<
typename T>
class ref_interface;
153 return static_cast<T*
>(
this)->ref();
158 return static_cast<T
const *
>(
this)->ref();
168 template<
typename U> U
getdirect(std::string
const & key)
const
175 catch (dunedaq::conffwk::Exception
const & e)
217 template<
typename U> U
get(std::string
const & key)
229 template<
typename U>
void get(std::string
const & key, U & val)
241 std::vector<T>
referenced_by(std::string
const & name =
"*",
bool check_composite_only =
244 void set_obj_null(std::string
const & name,
bool is_simple,
bool skip_non_null_check =
false)
255 void set_obj(std::string
const & name, T
const & other,
256 bool skip_non_null_check =
false)
260 skip_non_null_check);
263 void set_objs(std::string
const & name, std::vector<T>
const & others,
264 bool skip_non_null_check =
false)
266 std::vector<dunedaq::conffwk::ConfigObject const *> configobjects;
268 std::transform(std::begin(others), std::end(others),
269 std::back_inserter(configobjects), [](T
const &
aref )
277 template<
typename U>
void set_by_val(std::string
const & name, U val)
282 template<
typename U>
void set_by_ref(std::string
const & name, U & val)
287 void set_enum(std::string
const & name, std::string
const & val)
292 void set_class(std::string
const & name, std::string
const & val)
297 void set_date(std::string
const & name, std::string
const & val)
302 void set_time(std::string
const & name, std::string
const & val)
307 void set_enum(std::string
const & name,
const std::vector<std::string>& value)
312 void set_class(std::string
const & name,
const std::vector<std::string>& value)
317 void set_date(std::string
const & name,
const std::vector<std::string>& value)
322 void set_time(std::string
const & name,
const std::vector<std::string>& value)
327 void move(std::string
const & at)
339 const std::string& prefix =
"",
340 bool show_contained_in =
false
387 std::vector<configobject::tref>
operator()(std::string
const & key);
423 std::vector<dunedaq::conffwk::ConfigObject>
operator()(std::string
const & key) =
delete;
428 std::string
const & key)
430 return this->that->template getdirect<U>(key);
463 tref(std::shared_ptr<oref> other)
485 std::shared_ptr<oref> return_val =
493 vref(std::weak_ptr<oref> other)
504template<
typename T>
inline std::ostream &
operator<<(std::ostream & os,
507 return os << static_cast<T const &>(atref).
ref();
516 return l.UID() == r.UID() and l.class_name() == r.class_name();
authorized_getter(ref_interface< T > const *caller)
configobject::tref operator()(std::string const &key)
ref_interface< T > const * that
ref_interface< T > const * that
dunedaq::conffwk::ConfigObject operator()(std::string const &key)=delete
authorized_getter(ref_interface< T > const *caller)
ref_interface< T > const * that
authorized_getter(ref_interface< T > const *caller)
std::vector< configobject::tref > operator()(std::string const &key)
ref_interface< T > const * that
authorized_getter(ref_interface< T > const *caller)
std::vector< dunedaq::conffwk::ConfigObject > operator()(std::string const &key)=delete
ref_interface< T > const * that
authorized_getter(ref_interface< T > const *caller)
U operator()(std::string const &key)
std::string this_last_full_name
std::string full_name() const
friend bool operator==(dbe::cokey const &left, dbe::cokey const &right)
oref operator=(oref const &)=delete
oref(dunedaq::conffwk::ConfigObject const &o) noexcept(true)
void rename(std::string const &newname)
oref(oref const &)=delete
void set_enum(std::string const &name, std::string const &val)
void set_time(std::string const &name, const std::vector< std::string > &value)
U get(std::string const &key)
friend class dbe::inner::configobject::vref
void set_objs(std::string const &name, std::vector< T > const &others, bool skip_non_null_check=false)
void set_class(std::string const &name, const std::vector< std::string > &value)
U getdirect(std::string const &key) const
void set_obj_null(std::string const &name, bool is_simple, bool skip_non_null_check=false)
void set_by_ref(std::string const &name, U &val)
void set_date(std::string const &name, const std::vector< std::string > &value)
void get(std::string const &key, U &val)
void set_class(std::string const &name, std::string const &val)
std::string class_name() const
void print_ref(std::ostream &s, dunedaq::conffwk::Configuration &conf, const std::string &prefix="", bool show_contained_in=false) const
Print details of object's attributes and relationships.
void set_date(std::string const &name, std::string const &val)
void set_obj(std::string const &name, T const &other, bool skip_non_null_check=false)
std::vector< T > referenced_by(std::string const &name="*", bool check_composite_only=true) const
void move(std::string const &at)
void set_enum(std::string const &name, const std::vector< std::string > &value)
friend std::ostream & operator<<(std::ostream &os, dbe::inner::configobject::tref const &atref)
std::string full_name() const
void set_time(std::string const &name, std::string const &val)
friend class dbe::inner::configobject::tref
void set_by_val(std::string const &name, U val)
std::string contained_in() const
dunedaq::conffwk::ConfigObject & ref(bool check_null=true) const
std::shared_ptr< oref > refered
dunedaq::conffwk::ConfigObject & ref(bool check_null=false) const
std::weak_ptr< oref > refered
wref(wref const &)=delete
wref(dunedaq::conffwk::ConfigObject const &o)
wref operator=(wref const &)=delete
dunedaq::conffwk::ConfigObject ref
static dbcontroller & ref()
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.
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.
void move(const std::string &at)
Move object to a different database.
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_by_ref(const std::string &name, T &value)
Set attribute value.
bool is_deleted() const
Check if object was deleted.
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 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.
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.
#define DEBUG_THROW_ON_NULL_CONFIGOBJECT_REFERENCE
bool operator==(ref_interface< T > const &l, ref_interface< T > const &r)
std::ostream & operator<<(std::ostream &os, ref_interface< T > const &atref)
inner::configobject::aref< config_object_linked< std::string > > aref
size_t operator()(dbe::cokey const &o) const