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 221 of file gtool.cpp.

222{
223 if ( ofn.empty() )
224 {
225 write_to_cout ( g );
226 }
227 else
228 {
229 write_to_file ( g, ofn );
230 }
231}
void write_to_cout(gtool::t_graph const &)
Definition gtool.cpp:233

◆ 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 233 of file gtool.cpp.

234{
235 INFO ( "Sending output to stdout", "Program execution control" )
236 boost::write_graphviz (
237 std::cout, g, boost::make_label_writer ( boost::get ( &gtool::vertex_label::label, g ) ) );
238}
#define INFO(...)
Definition messenger.hpp:96
Definition file.hpp:28

◆ 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 240 of file gtool.cpp.

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