DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dbe::inner::configobject::ref_interface< T > Class Template Reference

#include <config_reference.hpp>

Inheritance diagram for dbe::inner::configobject::ref_interface< T >:
[legend]

Public Member Functions

bool is_null () const
std::string UID () const
std::string class_name () const
std::string full_name () const
std::string contained_in () const
template<typename U>
U get (std::string const &key)
template<typename U>
void get (std::string const &key, U &val)
std::vector< T > referenced_by (std::string const &name="*", bool check_composite_only=true) const
void set_obj_null (std::string const &name, bool is_simple, bool skip_non_null_check=false)
void set_obj (std::string const &name, T const &other, bool skip_non_null_check=false)
void set_objs (std::string const &name, std::vector< T > const &others, bool skip_non_null_check=false)
template<typename U>
void set_by_val (std::string const &name, U val)
template<typename U>
void set_by_ref (std::string const &name, U &val)
void set_enum (std::string const &name, std::string const &val)
void set_class (std::string const &name, std::string const &val)
void set_date (std::string const &name, std::string const &val)
void set_time (std::string const &name, std::string const &val)
void set_enum (std::string const &name, const std::vector< std::string > &value)
void set_class (std::string const &name, const std::vector< std::string > &value)
void set_date (std::string const &name, const std::vector< std::string > &value)
void set_time (std::string const &name, const std::vector< std::string > &value)
void move (std::string const &at)
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.

Protected Member Functions

template<typename U>
U getdirect (std::string const &key) const

Private Member Functions

 operator dunedaq::conffwk::ConfigObject & () noexcept
 operator dunedaq::conffwk::ConfigObject & () const noexcept

Friends

template<typename X, typename U>
class authorized_getter
class dbe::inner::configobject::tref
class dbe::inner::configobject::vref
class dbe::inner::configobject::aref< T >
std::ostream & operator<< (std::ostream &os, dbe::inner::configobject::tref const &atref)

Detailed Description

template<typename T>
class dbe::inner::configobject::ref_interface< T >

Definition at line 143 of file config_reference.hpp.

Member Function Documentation

◆ class_name()

template<typename T>
std::string dbe::inner::configobject::ref_interface< T >::class_name ( ) const
inline

◆ contained_in()

template<typename T>
std::string dbe::inner::configobject::ref_interface< T >::contained_in ( ) const
inline

Definition at line 184 of file config_reference.hpp.

184{ return static_cast<dunedaq::conffwk::ConfigObject&>(*this).contained_in(); }

◆ full_name()

template<typename T>
std::string dbe::inner::configobject::ref_interface< T >::full_name ( ) const
inline

Definition at line 182 of file config_reference.hpp.

182{ return static_cast<dunedaq::conffwk::ConfigObject&>(*this).full_name(); }

◆ get() [1/2]

template<typename T>
template<typename U>
U dbe::inner::configobject::ref_interface< T >::get ( std::string const & key)
inline

Retrieve values of type U referred by the given key

Parameters
keyis the attribute name
Returns
the value of type U referred by the named attribute

Definition at line 193 of file config_reference.hpp.

194 {
196 return guard(key);
197 }

◆ get() [2/2]

template<typename T>
template<typename U>
void dbe::inner::configobject::ref_interface< T >::get ( std::string const & key,
U & val )
inline

Compatibility interface to support ConfigObject style queries

Parameters
keya string of what to look for
valis a reference to the object where the value of matching type will be placed

Definition at line 206 of file config_reference.hpp.

207 {
208 val = get<U>(key);
209 }

◆ getdirect()

template<typename T>
template<typename U>
U dbe::inner::configobject::ref_interface< T >::getdirect ( std::string const & key) const
inlineprotected

Retrieve values of type U referred by the given key

Parameters
keyis the attribute name
Returns
the value of type U referred by the named attribute

Definition at line 158 of file config_reference.hpp.

159 {
160 U value;
161 try {
162 static_cast<dunedaq::conffwk::ConfigObject&>(*const_cast<ref_interface<T>*>(this)).get(key, value);
163 } catch (dunedaq::conffwk::Exception const& e) {
164 // TODO handle retrieval errors here
165 }
166 return value;
167 }

◆ is_null()

template<typename T>
bool dbe::inner::configobject::ref_interface< T >::is_null ( ) const
inline

Definition at line 173 of file config_reference.hpp.

174 {
175 return static_cast<dunedaq::conffwk::ConfigObject&>(static_cast<T const*>(this)->ref(false)).is_deleted();
176 }

◆ move()

template<typename T>
void dbe::inner::configobject::ref_interface< T >::move ( std::string const & at)
inline

Definition at line 298 of file config_reference.hpp.

298{ static_cast<dunedaq::conffwk::ConfigObject&>(*this).move(at); }

◆ operator dunedaq::conffwk::ConfigObject &() [1/2]

template<typename T>
dbe::inner::configobject::ref_interface< T >::operator dunedaq::conffwk::ConfigObject & ( ) const
inlineexplicitprivatenoexcept

Definition at line 148 of file config_reference.hpp.

148{ return static_cast<T const*>(this)->ref(); }

◆ operator dunedaq::conffwk::ConfigObject &() [2/2]

template<typename T>
dbe::inner::configobject::ref_interface< T >::operator dunedaq::conffwk::ConfigObject & ( )
inlineexplicitprivatenoexcept

Definition at line 146 of file config_reference.hpp.

146{ return static_cast<T*>(this)->ref(); }

◆ print_ref()

template<typename T>
void dbe::inner::configobject::ref_interface< T >::print_ref ( std::ostream & s,
dunedaq::conffwk::Configuration & conf,
const std::string & prefix = "",
bool show_contained_in = false ) const
inline

Print details of object's attributes and relationships.

Parameters
sthe output stream
confthe configuration object (required to read schema description)
prefixoptional shift output using prefix
show_contained_inoptional print out info about object database file

Definition at line 304 of file config_reference.hpp.

310 {
312 }
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.

◆ referenced_by()

template<typename T>
template std::vector< tref > dbe::inner::configobject::ref_interface< T >::referenced_by ( std::string const & name = "*",
bool check_composite_only = true ) const

New method to retrieve reference to this object through some relation

Parameters
nameof of the relation to check references through to this object
check_composite_onlyenables checking of only composite parent objects
Returns
a list of objects referencing this

Definition at line 34 of file dbcontroller.cpp.

35{
38
40
41 for (ConfigObject const& x : referees) {
42 try {
43 result.push_back(inner::dbcontroller::get({ x.UID(), x.class_name() }));
45 // Nothing needed to do here, this is normal, just the query has resulted in null
46 }
47 }
48
49 return result;
50}
std::vector< T > referenced_by(std::string const &name="*", bool check_composite_only=true) const

◆ set_by_ref()

template<typename T>
template<typename U>
void dbe::inner::configobject::ref_interface< T >::set_by_ref ( std::string const & name,
U & val )
inline

Definition at line 253 of file config_reference.hpp.

254 {
255 static_cast<dunedaq::conffwk::ConfigObject&>(*this).set_by_ref(name, val);
256 }
void set_by_ref(std::string const &name, U &val)

◆ set_by_val()

template<typename T>
template<typename U>
void dbe::inner::configobject::ref_interface< T >::set_by_val ( std::string const & name,
U val )
inline

Definition at line 247 of file config_reference.hpp.

248 {
249 static_cast<dunedaq::conffwk::ConfigObject&>(*this).set_by_val(name, val);
250 }
void set_by_val(std::string const &name, U val)

◆ set_class() [1/2]

template<typename T>
void dbe::inner::configobject::ref_interface< T >::set_class ( std::string const & name,
const std::vector< std::string > & value )
inline

Definition at line 283 of file config_reference.hpp.

284 {
285 static_cast<dunedaq::conffwk::ConfigObject&>(*this).set_class(name, value);
286 }
void set_class(std::string const &name, std::string const &val)

◆ set_class() [2/2]

template<typename T>
void dbe::inner::configobject::ref_interface< T >::set_class ( std::string const & name,
std::string const & val )
inline

Definition at line 263 of file config_reference.hpp.

264 {
265 static_cast<dunedaq::conffwk::ConfigObject&>(*this).set_class(name, val);
266 }

◆ set_date() [1/2]

template<typename T>
void dbe::inner::configobject::ref_interface< T >::set_date ( std::string const & name,
const std::vector< std::string > & value )
inline

Definition at line 288 of file config_reference.hpp.

289 {
290 static_cast<dunedaq::conffwk::ConfigObject&>(*this).set_date(name, value);
291 }
void set_date(std::string const &name, std::string const &val)

◆ set_date() [2/2]

template<typename T>
void dbe::inner::configobject::ref_interface< T >::set_date ( std::string const & name,
std::string const & val )
inline

Definition at line 268 of file config_reference.hpp.

269 {
270 static_cast<dunedaq::conffwk::ConfigObject&>(*this).set_date(name, val);
271 }

◆ set_enum() [1/2]

template<typename T>
void dbe::inner::configobject::ref_interface< T >::set_enum ( std::string const & name,
const std::vector< std::string > & value )
inline

Definition at line 278 of file config_reference.hpp.

279 {
280 static_cast<dunedaq::conffwk::ConfigObject&>(*this).set_enum(name, value);
281 }
void set_enum(std::string const &name, std::string const &val)

◆ set_enum() [2/2]

template<typename T>
void dbe::inner::configobject::ref_interface< T >::set_enum ( std::string const & name,
std::string const & val )
inline

Definition at line 258 of file config_reference.hpp.

259 {
260 static_cast<dunedaq::conffwk::ConfigObject&>(*this).set_enum(name, val);
261 }

◆ set_obj()

template<typename T>
void dbe::inner::configobject::ref_interface< T >::set_obj ( std::string const & name,
T const & other,
bool skip_non_null_check = false )
inline

Definition at line 229 of file config_reference.hpp.

230 {
231 static_cast<dunedaq::conffwk::ConfigObject&>(*this).set_obj(
233 }
void set_obj(std::string const &name, T const &other, bool skip_non_null_check=false)

◆ set_obj_null()

template<typename T>
void dbe::inner::configobject::ref_interface< T >::set_obj_null ( std::string const & name,
bool is_simple,
bool skip_non_null_check = false )
inline

Definition at line 220 of file config_reference.hpp.

221 {
222 if (is_simple) {
223 static_cast<dunedaq::conffwk::ConfigObject&>(*this).set_obj(name, nullptr, skip_non_null_check);
224 } else {
226 }
227 }
void set_objs(std::string const &name, std::vector< T > const &others, bool skip_non_null_check=false)

◆ set_objs()

template<typename T>
void dbe::inner::configobject::ref_interface< T >::set_objs ( std::string const & name,
std::vector< T > const & others,
bool skip_non_null_check = false )
inline

◆ set_time() [1/2]

template<typename T>
void dbe::inner::configobject::ref_interface< T >::set_time ( std::string const & name,
const std::vector< std::string > & value )
inline

Definition at line 293 of file config_reference.hpp.

294 {
295 static_cast<dunedaq::conffwk::ConfigObject&>(*this).set_time(name, value);
296 }
void set_time(std::string const &name, std::string const &val)

◆ set_time() [2/2]

template<typename T>
void dbe::inner::configobject::ref_interface< T >::set_time ( std::string const & name,
std::string const & val )
inline

Definition at line 273 of file config_reference.hpp.

274 {
275 static_cast<dunedaq::conffwk::ConfigObject&>(*this).set_time(name, val);
276 }

◆ UID()

template<typename T>
std::string dbe::inner::configobject::ref_interface< T >::UID ( ) const
inline

Definition at line 178 of file config_reference.hpp.

178{ return static_cast<dunedaq::conffwk::ConfigObject&>(*this).UID(); }

◆ authorized_getter

template<typename T>
template<typename X, typename U>
friend class authorized_getter
friend

Definition at line 170 of file config_reference.hpp.

◆ dbe::inner::configobject::aref< T >

template<typename T>
friend class dbe::inner::configobject::aref< T >
friend

Definition at line 317 of file config_reference.hpp.

◆ dbe::inner::configobject::tref

template<typename T>
friend class dbe::inner::configobject::tref
friend

Definition at line 316 of file config_reference.hpp.

◆ dbe::inner::configobject::vref

template<typename T>
friend class dbe::inner::configobject::vref
friend

Definition at line 317 of file config_reference.hpp.

◆ operator<<

template<typename T>
std::ostream & operator<< ( std::ostream & os,
dbe::inner::configobject::tref const & atref )
friend

The documentation for this class was generated from the following files: