13#ifndef DBE_CONFIG_REFERENCE_HPP_
14#define DBE_CONFIG_REFERENCE_HPP_
24#ifndef DONOT_THROW_ON_NULL_CONFIGOBJECT_REFERENCE
25#define DEBUG_THROW_ON_NULL_CONFIGOBJECT_REFERENCE \
26 if (check_null and rval.is_deleted()) \
27 throw daq::dbe::null_config_reference_access(ERS_HERE);
29#define DEBUG_THROW_ON_NULL_CONFIGOBJECT_REFERENCE
99 void rename(std::string
const& newname)
127template<
typename T,
typename U>
163 }
catch (dunedaq::conffwk::Exception
const& e) {
169 template<
typename X,
typename U>
193 U
get(std::string
const& key)
206 void get(std::string
const& key, U& val)
218 std::vector<T>
referenced_by(std::string
const& name =
"*",
bool check_composite_only =
true)
const;
220 void set_obj_null(std::string
const& name,
bool is_simple,
bool skip_non_null_check =
false)
229 void set_obj(std::string
const& name, T
const& other,
bool skip_non_null_check =
false)
235 void set_objs(std::string
const& name, std::vector<T>
const& others,
bool skip_non_null_check =
false)
237 std::vector<dunedaq::conffwk::ConfigObject const*> configobjects;
239 std::transform(std::begin(others), std::end(others), std::back_inserter(configobjects), [](T
const&
aref) {
258 void set_enum(std::string
const& name, std::string
const& val)
263 void set_class(std::string
const& name, std::string
const& val)
268 void set_date(std::string
const& name, std::string
const& val)
273 void set_time(std::string
const& name, std::string
const& val)
278 void set_enum(std::string
const& name,
const std::vector<std::string>& value)
283 void set_class(std::string
const& name,
const std::vector<std::string>& value)
288 void set_date(std::string
const& name,
const std::vector<std::string>& value)
293 void set_time(std::string
const& name,
const std::vector<std::string>& value)
307 const std::string& prefix =
"",
308 bool show_contained_in =
false
355 std::vector<configobject::tref>
operator()(std::string
const& key);
391 std::vector<dunedaq::conffwk::ConfigObject>
operator()(std::string
const& key) =
delete;
394template<
typename T,
typename U>
398 return this->
that->template getdirect<U>(key);
427 tref(std::shared_ptr<oref> other)
448 std::shared_ptr<oref> return_val =
455 vref(std::weak_ptr<oref> other)
470 return os << static_cast<T const&>(atref).ref();
479 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)
friend class authorized_getter
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
tref(std::shared_ptr< oref > other)
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
vref(std::weak_ptr< oref > other)
wref(wref const &)=delete
wref(dunedaq::conffwk::ConfigObject const &o)
wref operator=(wref const &)=delete
dunedaq::conffwk::ConfigObject 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)
size_t operator()(dbe::cokey const &o) const