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 44 of file config_api_graph.cpp.

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

◆ attribute< tref >()

Definition at line 44 of file config_api_graph.cpp.

45{
46 return object.get<tref> ( attr.p_name );
47}

◆ 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 210 of file config_api_graph.cpp.

211{
213 { info::onclass::definition ( o.class_name(), true ) };
214
215 std::vector<T> voisins;
216
217 for ( dunedaq::conffwk::attribute_t const & attr : classdef.p_attributes )
218 {
219 std::vector<tref> a = attribute<std::vector<T>> ( o, attr );
220 voisins.insert ( voisins.end(), a.begin(), a.end() );
221 }
222
223 voisins.erase ( std::unique ( std::begin ( voisins ), std::end ( voisins ) ),
224 std::end ( voisins ) );
225 return voisins;
226}

◆ 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 126 of file config_api_graph.cpp.

128{
129 QStringList result;
130 std::vector<tref> adjacent = relation<std::vector<tref>> ( item, r );
131
132 for ( auto const & x : adjacent )
133 {
134 result.push_back ( x.UID().c_str() );
135 }
136
137 return result;
138}

◆ 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 126 of file config_api_graph.cpp.

144{
145 std::vector<dbe::config_object_description<std::string>> result;
146
147 std::vector<tref> adjacent = linked::through::relation<std::vector<tref>> ( object,
148 relation );
149
150 for ( auto const & x : adjacent )
151 {
152 result.push_back ( x );
153 }
154
155 return result;
156}
T relation(tref item, dunedaq::conffwk::relationship_t const &relation)

◆ 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 95 of file config_api_graph.cpp.

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

◆ relation< tref >()

Definition at line 95 of file config_api_graph.cpp.

96{
97 return object.get<tref> ( r.p_name );
98}

◆ 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 187 of file config_api_graph.cpp.

188{
190 { info::onclass::definition ( o.class_name(), false ) };
191
192 std::vector<T> voisins;
193
194 for ( dunedaq::conffwk::relationship_t const & r : classdef.p_relationships )
195 {
196 std::vector<T> a = relation<std::vector<T>> ( o, r );
197 voisins.insert ( voisins.end(), a.begin(), a.end() );
198 }
199
200 voisins.erase ( std::unique ( std::begin ( voisins ), std::end ( voisins ) ),
201 std::end ( voisins ) );
202 return voisins;
203}