DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dbe::tool::graph Namespace Reference

Classes

class  gtool
class  segregated_graph_write
class  stats
class  writegraph

Functions

void write (gtool::t_graph const &, std::string const &)
void write_to_cout (gtool::t_graph const &)
void write_to_file (gtool::t_graph const &, std::string const &)

Function Documentation

◆ write()

void dbe::tool::graph::write ( gtool::t_graph const & g,
std::string const & ofn )

Send a graph to output or a file. The file is used if the second parameter is not an empty string.

Parameters
Thegraph to send to file
Thefile name to write to

Definition at line 226 of file gtool.cpp.

227{
228 if ( ofn.empty() )
229 {
230 write_to_cout ( g );
231 }
232 else
233 {
234 write_to_file ( g, ofn );
235 }
236}
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

◆ write_to_cout()

void dbe::tool::graph::write_to_cout ( gtool::t_graph const & g)

Send a graph to standard output

Parameters
thegraph to write

Definition at line 238 of file gtool.cpp.

239{
240 INFO ( "Sending output to stdout", "Program execution control" )
241 boost::write_graphviz (
242 std::cout, g, boost::make_label_writer ( boost::get ( &gtool::vertex_label::label, g ) ) );
243}
#define INFO(...)

◆ write_to_file()

void dbe::tool::graph::write_to_file ( gtool::t_graph const & g,
std::string const & ofn )

Send a graph to file. If the operation could not be completed EXIT_FAIL is returned

Parameters
Thegraph to write
Thefilename to write to
Returns
EXIT_SUCCESS in case of success

Definition at line 245 of file gtool.cpp.

246{
247 std::ofstream of;
248 of.open ( ofn );
249
250 if ( of.is_open() )
251 {
252 INFO ( "Sending output to file", "Program execution control", "File name:", ofn );
253 boost::write_graphviz (
254 of, g, boost::make_label_writer ( boost::get ( &gtool::vertex_label::label, g ) ) );
255
256 of.close();
257
258 if ( of.fail() )
259 {
260 ERROR ( "Could not close file", "Program execution control", "File name:", ofn );
261 }
262 else
263 {
264 NOTE ( "Output written to file", "Program execution control success", "File name:", ofn );
265 }
266 }
267 else
268 {
269 ERROR (
270 "Output could not be written file", "Stream could not be opened", "File name:", ofn );
271 write_to_cout ( g );
272 }
273}
#define ERROR(...)
Definition messenger.hpp:93
#define NOTE(...)