DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dbe::config::api::graph::linked::through Namespace Reference

Functions

template<typename T>
std::vector< T > relations (tref const &item)
template<typename T>
std::vector< T > attributes (tref const &item)
template<typename T>
relation (tref item, dunedaq::conffwk::relationship_t const &relation)
template<typename T>
attribute (tref item, dunedaq::conffwk::attribute_t const &attr)
template<>
tref attribute< tref > (tref object, dunedaq::conffwk::attribute_t const &attr)
template<>
std::vector< trefattribute< std::vector< tref > > (tref item, dunedaq::conffwk::attribute_t const &attr)
template<>
tref relation< tref > (tref object, dunedaq::conffwk::relationship_t const &r)
template<>
std::vector< trefrelation< std::vector< tref > > (tref item, dunedaq::conffwk::relationship_t const &r)
template<>
QStringList relation< QStringList > (tref item, dunedaq::conffwk::relationship_t const &r)
template<>
std::vector< dbe::config_object_description< std::string > > relation< std::vector< dbe::config_object_description< std::string > > > (tref object, dunedaq::conffwk::relationship_t const &relation)

Function Documentation

◆ attribute()

template<typename T>
T dbe::config::api::graph::linked::through::attribute ( tref item,
dunedaq::conffwk::attribute_t const & attr )

Get object reference/s through a specified attribute

e.g. A-C->B

returns B for object A through relation C

Parameters
itemis the object to retrieve the relation value
relationis the relation to retrieve the value for
Returns
the value of the relation converted to the specified type

◆ attribute< std::vector< tref > >()

template<>
std::vector< tref > dbe::config::api::graph::linked::through::attribute< std::vector< tref > > ( tref item,
dunedaq::conffwk::attribute_t const & attr )

Definition at line 49 of file config_api_graph.cpp.

57{
58 if ( attr.p_type == dunedaq::conffwk::class_type )
59 {
60 if ( attr.p_is_multi_value )
61 {
62 std::vector<tref> adj;
63 item.get ( attr.p_name, adj );
64 return adj;
65 }
66 else if ( attr.p_is_not_null )
67 {
68 try
69 {
70 return
71 { attribute<tref> ( item, attr ) };
72 }
73 catch ( daq::dbe::config_object_retrieval_result_is_null const & e )
74 {
75 if ( attr.p_is_not_null )
76 {
77 WARN (
78 "Query returned null value for an attr that has p_is_not_null set true",
79 "Program parsing data validation failure", item.full_name(),
80 " for attribute ", attr.p_name );
81 }
82 else
83 {
84 DEBUG ( "Query returned null value", "Program parsing data validation" );
85 }
86 }
87 }
88 }
89
90 return
91 {};
92}
#define WARN(...)
Definition messenger.hpp:85
#define DEBUG(...)
tref attribute< tref >(tref object, dunedaq::conffwk::attribute_t const &attr)

◆ attribute< tref >()

Definition at line 49 of file config_api_graph.cpp.

50{
51 return object.get<tref> ( attr.p_name );
52}
inner::configobject::tref tref
Definition tref.hpp:35

◆ attributes()

template<typename T>
template std::vector< tref > dbe::config::api::graph::linked::through::attributes< tref > ( tref const & item)

Get objects referenced by an object through any attributes

e.g. A-c->B , and another A-c->D returns {B,D} but A-c->B , A-d->B return {B}

Parameters
itemis the object for which objects must be retrieved
Returns
a vector of linked objects

Definition at line 215 of file config_api_graph.cpp.

216{
218 { info::onclass::definition ( o.class_name(), true ) };
219
220 std::vector<T> voisins;
221
222 for ( dunedaq::conffwk::attribute_t const & attr : classdef.p_attributes )
223 {
224 std::vector<tref> a = attribute<std::vector<T>> ( o, attr );
225 voisins.insert ( voisins.end(), a.begin(), a.end() );
226 }
227
228 voisins.erase ( std::unique ( std::begin ( voisins ), std::end ( voisins ) ),
229 std::end ( voisins ) );
230 return voisins;
231}
static dunedaq::conffwk::class_t definition(std::string const &cn, bool direct_only)
T attribute(tref item, dunedaq::conffwk::attribute_t const &attr)
const std::vector< attribute_t > p_attributes
Definition Schema.hpp:170

◆ relation()

template<typename T>
T dbe::config::api::graph::linked::through::relation ( tref item,
dunedaq::conffwk::relationship_t const & relation )

Get object reference/s through a specified relation

e.g. A-C->B

returns B for object A through relation C

Parameters
itemis the object to retrieve the relation value
relationis the relation to retrieve the value for
Returns
the value of the relation converted to the specified type

◆ relation< QStringList >()

template<>
template QStringList dbe::config::api::graph::linked::through::relation< QStringList > ( tref item,
dunedaq::conffwk::relationship_t const & r )

Definition at line 131 of file config_api_graph.cpp.

133{
134 QStringList result;
135 std::vector<tref> adjacent = relation<std::vector<tref>> ( item, r );
136
137 for ( auto const & x : adjacent )
138 {
139 result.push_back ( x.UID().c_str() );
140 }
141
142 return result;
143}
T relation(tref item, dunedaq::conffwk::relationship_t const &relation)

◆ relation< std::vector< dbe::config_object_description< std::string > > >()

template<>
std::vector< dbe::config_object_description< std::string > > dbe::config::api::graph::linked::through::relation< std::vector< dbe::config_object_description< std::string > > > ( tref object,
dunedaq::conffwk::relationship_t const & relation )

Definition at line 131 of file config_api_graph.cpp.

149{
150 std::vector<dbe::config_object_description<std::string>> result;
151
152 std::vector<tref> adjacent = linked::through::relation<std::vector<tref>> ( object,
153 relation );
154
155 for ( auto const & x : adjacent )
156 {
157 result.push_back ( x );
158 }
159
160 return result;
161}

◆ relation< std::vector< tref > >()

template<>
std::vector< tref > dbe::config::api::graph::linked::through::relation< std::vector< tref > > ( tref item,
dunedaq::conffwk::relationship_t const & r )

Definition at line 100 of file config_api_graph.cpp.

108{
110 {
111 try
112 {
113 return
114 { through::relation<tref> ( item, r ) };
115 }
116 catch ( daq::dbe::config_object_retrieval_result_is_null const & e )
117 {
118 return
119 {};
120 }
121 }
122 else
123 {
124 std::vector<tref> adjacent;
125 item.get ( r.p_name, adjacent );
126 return adjacent;
127 }
128}
tref relation< tref >(tref object, dunedaq::conffwk::relationship_t const &r)
bool is_simple(dunedaq::conffwk::relationship_t const &)

◆ relation< tref >()

Definition at line 100 of file config_api_graph.cpp.

101{
102 return object.get<tref> ( r.p_name );
103}

◆ relations()

template<typename T>
template std::vector< tref > dbe::config::api::graph::linked::through::relations< tref > ( tref const & item)

Get objects referenced by an object through any relation

e.g. A-c->B , and another A-c->D returns {B,D} but A-c->B , A-d->B return {B}

Parameters
itemis the object for which objects must be retrieved
Returns
a vector of linked objects

Definition at line 192 of file config_api_graph.cpp.

193{
195 { info::onclass::definition ( o.class_name(), false ) };
196
197 std::vector<T> voisins;
198
199 for ( dunedaq::conffwk::relationship_t const & r : classdef.p_relationships )
200 {
201 std::vector<T> a = relation<std::vector<T>> ( o, r );
202 voisins.insert ( voisins.end(), a.begin(), a.end() );
203 }
204
205 voisins.erase ( std::unique ( std::begin ( voisins ), std::end ( voisins ) ),
206 std::end ( voisins ) );
207 return voisins;
208}
const std::vector< relationship_t > p_relationships
Definition Schema.hpp:171