DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
gtool.hpp
Go to the documentation of this file.
1// DUNE DAQ modification notice:
2// This file has been modified from the original ATLAS dbe source for the DUNE DAQ project.
3// Fork baseline commit: dbe-02-12-17 (2022-05-12).
4// Renamed since fork: yes (from dbe/gtool.h to include/dbe/gtool.hpp).
5
6/************************************************************
7 * gtool.h
8 *
9 * Created on: Jun 10, 2016
10 * Author: Leonidas Georgopoulos
11 ************************************************************/
12
13#ifndef SRC_GTOOL_H_
14#define SRC_GTOOL_H_
15
17#include "dbe/messenger.hpp"
18#include "dbe/dbinfo.hpp"
19#include "dbe/tref.hpp"
20
21#include <boost/graph/graph_traits.hpp>
22#include <boost/graph/adjacency_list.hpp>
23#include <boost/graph/dijkstra_shortest_paths.hpp>
24#include <boost/graph/labeled_graph.hpp>
25
26#include <string>
27#include <vector>
28#include <set>
29
30namespace dbe
31{
32namespace tool
33{
34namespace graph
35{
36
37//------------------------------------------------------------------------------------------
38class gtool
39{
40public:
41
42// struct edge_label
43// {
44// std::string uid;
45// };
46
48 {
49 std::string uid;
50 std::string cname;
51 std::string label;
52 };
53
54 typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS,
56
57 typedef boost::graph_traits<t_graph>::edge_descriptor t_edge;
58 typedef boost::graph_traits<t_graph>::vertex_descriptor t_vertex;
59
60 typedef std::map<std::string, t_vertex> t_registry;
61
69 gtool ( std::string const & rl, dbinfo dbtype );
70
71 template<typename ALGO> inline int load_and_run ( ALGO const & );
72
78 t_graph const & getgraph() const;
79
86 static t_vertex add_object_and_friends ( t_graph &, tref const &, t_registry & registry );
87
98 static t_vertex add_object ( t_graph & g, tref const & o, bool uniqueness = true );
99
112 static t_vertex add_object ( t_graph & g, tref const & o, t_registry & registry );
113
114 typedef std::pair<bool, boost::graph_traits<gtool::t_graph>::vertex_iterator> t_lookup_ret;
121 static t_lookup_ret lookup ( t_graph const & g, vertex_label const & l );
122private:
123
124 void load_all();
125 void load_all_class_objects ( std::string const & cname );
126
127 void create_graph();
128
129 typedef std::vector<tref> t_objects;
130
134
135 std::string this_src;
136};
137//------------------------------------------------------------------------------------------
138
139//------------------------------------------------------------------------------------------
146{
147public:
148 writegraph ( std::string const & );
149 int operator() ( gtool const & ) const;
150private:
151 void write ( gtool::t_graph const & ) const;
152 std::string this_dest;
153};
154//------------------------------------------------------------------------------------------
155
156//------------------------------------------------------------------------------------------
164void write ( gtool::t_graph const &, std::string const & );
170void write_to_cout ( gtool::t_graph const & );
178void write_to_file ( gtool::t_graph const &, std::string const & );
179//------------------------------------------------------------------------------------------
180
181//------------------------------------------------------------------------------------------
182template<typename ALGO> inline int gtool::load_and_run ( ALGO const & algo )
183{
184 load_all();
185 create_graph();
186 return algo ( static_cast<gtool const &> ( *this ) );
187}
188//------------------------------------------------------------------------------------------
189} /* namespace graph */
190} /* namespace tool */
191} /* namespace dbe */
192
193#endif /* SRC_GTOOL_H_ */
boost::graph_traits< t_graph >::vertex_descriptor t_vertex
Definition gtool.hpp:58
t_objects this_all_objects
Definition gtool.hpp:132
std::map< std::string, t_vertex > t_registry
Definition gtool.hpp:60
gtool(std::string const &rl, dbinfo dbtype)
Definition gtool.cpp:37
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, vertex_label > t_graph
Definition gtool.hpp:55
static t_lookup_ret lookup(t_graph const &g, vertex_label const &l)
Definition gtool.cpp:188
std::pair< bool, boost::graph_traits< gtool::t_graph >::vertex_iterator > t_lookup_ret
Definition gtool.hpp:114
boost::graph_traits< t_graph >::edge_descriptor t_edge
Definition gtool.hpp:57
std::string this_src
Definition gtool.hpp:135
std::vector< tref > t_objects
Definition gtool.hpp:129
t_registry already_processed
Definition gtool.hpp:133
int load_and_run(ALGO const &)
Definition gtool.hpp:182
static t_vertex add_object(t_graph &g, tref const &o, bool uniqueness=true)
Definition gtool.cpp:118
void load_all_class_objects(std::string const &cname)
Definition gtool.cpp:89
static t_vertex add_object_and_friends(t_graph &, tref const &, t_registry &registry)
Definition gtool.cpp:166
t_graph const & getgraph() const
Definition gtool.cpp:68
void write(gtool::t_graph const &) const
Definition gtool.cpp:219
int operator()(gtool const &) const
Definition gtool.cpp:211
writegraph(std::string const &)
Definition gtool.cpp:205
void write(gtool::t_graph const &, std::string const &)
Definition gtool.cpp:226
void write_to_cout(gtool::t_graph const &)
Definition gtool.cpp:238
void write_to_file(gtool::t_graph const &, std::string const &)
Definition gtool.cpp:245
Include QT Headers.
inner::configobject::tref tref
Definition tref.hpp:35
dbinfo
Definition dbinfo.hpp:20