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/dbinfo.hpp"
18#include "dbe/messenger.hpp"
19#include "dbe/tref.hpp"
20
21#include <boost/graph/adjacency_list.hpp>
22#include <boost/graph/dijkstra_shortest_paths.hpp>
23#include <boost/graph/graph_traits.hpp>
24#include <boost/graph/labeled_graph.hpp>
25
26#include <set>
27#include <string>
28#include <vector>
29
30namespace dbe {
31namespace tool {
32namespace graph {
33
34//------------------------------------------------------------------------------------------
35class gtool
36{
37public:
38 // struct edge_label
39 // {
40 // std::string uid;
41 // };
42
44 {
45 std::string uid;
46 std::string cname;
47 std::string label;
48 };
49
50 typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, vertex_label> t_graph;
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>
67 inline int load_and_run(ALGO const&);
68
74 t_graph const& getgraph() const;
75
82 static t_vertex add_object_and_friends(t_graph&, tref const&, t_registry& registry);
83
94 static t_vertex add_object(t_graph& g, tref const& o, bool uniqueness = true);
95
108 static t_vertex add_object(t_graph& g, tref const& o, t_registry& registry);
109
110 typedef std::pair<bool, boost::graph_traits<gtool::t_graph>::vertex_iterator> t_lookup_ret;
117 static t_lookup_ret lookup(t_graph const& g, vertex_label const& l);
118
119private:
120 void load_all();
121 void load_all_class_objects(std::string const& cname);
122
123 void create_graph();
124
125 typedef std::vector<tref> t_objects;
126
130
131 std::string this_src;
132};
133//------------------------------------------------------------------------------------------
134
135//------------------------------------------------------------------------------------------
142{
143public:
144 writegraph(std::string const&);
145 int operator()(gtool const&) const;
146
147private:
148 void write(gtool::t_graph const&) const;
149 std::string this_dest;
150};
151//------------------------------------------------------------------------------------------
152
153//------------------------------------------------------------------------------------------
161void
162write(gtool::t_graph const&, std::string const&);
168void
177void
178write_to_file(gtool::t_graph const&, std::string const&);
179//------------------------------------------------------------------------------------------
180
181//------------------------------------------------------------------------------------------
182template<typename ALGO>
183inline int
184gtool::load_and_run(ALGO const& algo)
185{
186 load_all();
187 create_graph();
188 return algo(static_cast<gtool const&>(*this));
189}
190//------------------------------------------------------------------------------------------
191} /* namespace graph */
192} /* namespace tool */
193} /* namespace dbe */
194
195#endif /* SRC_GTOOL_H_ */
boost::graph_traits< t_graph >::vertex_descriptor t_vertex
Definition gtool.hpp:53
t_objects this_all_objects
Definition gtool.hpp:128
std::map< std::string, t_vertex > t_registry
Definition gtool.hpp:55
gtool(std::string const &rl, dbinfo dbtype)
Definition gtool.cpp:34
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, vertex_label > t_graph
Definition gtool.hpp:50
static t_lookup_ret lookup(t_graph const &g, vertex_label const &l)
Definition gtool.cpp:164
std::pair< bool, boost::graph_traits< gtool::t_graph >::vertex_iterator > t_lookup_ret
Definition gtool.hpp:110
boost::graph_traits< t_graph >::edge_descriptor t_edge
Definition gtool.hpp:52
std::string this_src
Definition gtool.hpp:131
std::vector< tref > t_objects
Definition gtool.hpp:125
t_registry already_processed
Definition gtool.hpp:129
int load_and_run(ALGO const &)
Definition gtool.hpp:184
static t_vertex add_object(t_graph &g, tref const &o, bool uniqueness=true)
Definition gtool.cpp:108
void load_all_class_objects(std::string const &cname)
Definition gtool.cpp:81
static t_vertex add_object_and_friends(t_graph &, tref const &, t_registry &registry)
Definition gtool.cpp:145
t_graph const & getgraph() const
Definition gtool.cpp:58
void write(gtool::t_graph const &) const
Definition gtool.cpp:194
int operator()(gtool const &) const
Definition gtool.cpp:185
writegraph(std::string const &)
Definition gtool.cpp:179
void write(gtool::t_graph const &, std::string const &)
Definition gtool.cpp:202
void write_to_cout(gtool::t_graph const &)
Definition gtool.cpp:212
void write_to_file(gtool::t_graph const &, std::string const &)
Definition gtool.cpp:219
Include QT Headers.
inner::configobject::tref tref
Definition tref.hpp:36
dbinfo
Definition dbinfo.hpp:19