DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
gtool.hpp
Go to the documentation of this file.
1/************************************************************
2 * gtool.h
3 *
4 * Created on: Jun 10, 2016
5 * Author: Leonidas Georgopoulos
6 ************************************************************/
7
8#ifndef SRC_GTOOL_H_
9#define SRC_GTOOL_H_
10
12#include "dbe/messenger.hpp"
13#include "dbe/dbinfo.hpp"
14#include "dbe/tref.hpp"
15
16#include <boost/graph/graph_traits.hpp>
17#include <boost/graph/adjacency_list.hpp>
18#include <boost/graph/dijkstra_shortest_paths.hpp>
19#include <boost/graph/labeled_graph.hpp>
20
21#include <string>
22#include <vector>
23#include <set>
24
25namespace dbe
26{
27namespace tool
28{
29namespace graph
30{
31
32//------------------------------------------------------------------------------------------
33class gtool
34{
35public:
36
37// struct edge_label
38// {
39// std::string uid;
40// };
41
43 {
44 std::string uid;
45 std::string cname;
46 std::string label;
47 };
48
49 typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS,
51
52 typedef boost::graph_traits<t_graph>::edge_descriptor t_edge;
53 typedef boost::graph_traits<t_graph>::vertex_descriptor t_vertex;
54
55 typedef std::map<std::string, t_vertex> t_registry;
56
64 gtool ( std::string const & rl, dbinfo dbtype );
65
66 template<typename ALGO> inline int load_and_run ( ALGO const & );
67
73 t_graph const & getgraph() const;
74
81 static t_vertex add_object_and_friends ( t_graph &, tref const &, t_registry & registry );
82
93 static t_vertex add_object ( t_graph & g, tref const & o, bool uniqueness = true );
94
107 static t_vertex add_object ( t_graph & g, tref const & o, t_registry & registry );
108
109 typedef std::pair<bool, boost::graph_traits<gtool::t_graph>::vertex_iterator> t_lookup_ret;
116 static t_lookup_ret lookup ( t_graph const & g, vertex_label const & l );
117private:
118
119 void load_all();
120 void load_all_class_objects ( std::string const & cname );
121
122 void create_graph();
123
124 typedef std::vector<tref> t_objects;
125
129
130 std::string this_src;
131};
132//------------------------------------------------------------------------------------------
133
134//------------------------------------------------------------------------------------------
141{
142public:
143 writegraph ( std::string const & );
144 int operator() ( gtool const & ) const;
145private:
146 void write ( gtool::t_graph const & ) const;
147 std::string this_dest;
148};
149//------------------------------------------------------------------------------------------
150
151//------------------------------------------------------------------------------------------
159void write ( gtool::t_graph const &, std::string const & );
165void write_to_cout ( gtool::t_graph const & );
173void write_to_file ( gtool::t_graph const &, std::string const & );
174//------------------------------------------------------------------------------------------
175
176//------------------------------------------------------------------------------------------
177template<typename ALGO> inline int gtool::load_and_run ( ALGO const & algo )
178{
179 load_all();
180 create_graph();
181 return algo ( static_cast<gtool const &> ( *this ) );
182}
183//------------------------------------------------------------------------------------------
184} /* namespace graph */
185} /* namespace tool */
186} /* namespace dbe */
187
188#endif /* SRC_GTOOL_H_ */
boost::graph_traits< t_graph >::edge_descriptor t_edge
Definition gtool.hpp:52
t_objects this_all_objects
Definition gtool.hpp:127
gtool(std::string const &rl, dbinfo dbtype)
Definition gtool.cpp:32
static t_lookup_ret lookup(t_graph const &g, vertex_label const &l)
Definition gtool.cpp:183
std::pair< bool, boost::graph_traits< gtool::t_graph >::vertex_iterator > t_lookup_ret
Definition gtool.hpp:109
std::string this_src
Definition gtool.hpp:130
std::map< std::string, t_vertex > t_registry
Definition gtool.hpp:55
boost::graph_traits< t_graph >::vertex_descriptor t_vertex
Definition gtool.hpp:53
t_registry already_processed
Definition gtool.hpp:128
int load_and_run(ALGO const &)
Definition gtool.hpp:177
static t_vertex add_object(t_graph &g, tref const &o, bool uniqueness=true)
Definition gtool.cpp:113
void load_all_class_objects(std::string const &cname)
Definition gtool.cpp:84
static t_vertex add_object_and_friends(t_graph &, tref const &, t_registry &registry)
Definition gtool.cpp:161
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, vertex_label > t_graph
Definition gtool.hpp:50
std::vector< tref > t_objects
Definition gtool.hpp:124
t_graph const & getgraph() const
Definition gtool.cpp:63
void write(gtool::t_graph const &) const
Definition gtool.cpp:214
int operator()(gtool const &) const
Definition gtool.cpp:206
writegraph(std::string const &)
Definition gtool.cpp:200
void write(gtool::t_graph const &, std::string const &)
Definition gtool.cpp:221
void write_to_cout(gtool::t_graph const &)
Definition gtool.cpp:233
void write_to_file(gtool::t_graph const &, std::string const &)
Definition gtool.cpp:240
Include QT Headers.
dbinfo
Definition dbinfo.hpp:15