The Gaudi Framework  master (34daa81a)
Loading...
Searching...
No Matches
GraphDumper.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2026 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#pragma once
12
13#include <fstream>
14#include <string>
15#include <string_view>
16
17namespace Gaudi::Hive {
18
19 enum class FileType : short { UNKNOWN, DOT, MD, ML };
20
30 class Graph {
31
32 public:
40 Graph( std::string_view fileName, FileType type = FileType::UNKNOWN );
41
42 ~Graph();
43
44 std::string const& fileName();
45
46 void addNode( std::string_view id, std::string_view name );
47
48 void addEdge( std::string_view srcId, std::string_view tgtId, std::string_view label = "" );
49
50 private:
51 // Utilities to write file headers and trailers in case a format needs them
52 void writeHeader();
53 void writeTrailer();
54
56 std::string m_fileName;
58 std::ofstream m_stream;
61 };
62
63} // end namespace Gaudi::Hive
void addNode(std::string_view id, std::string_view name)
FileType m_type
type of file used
Definition GraphDumper.h:60
void addEdge(std::string_view srcId, std::string_view tgtId, std::string_view label="")
std::string m_fileName
name of the filed used for storing the graph
Definition GraphDumper.h:56
std::string const & fileName()
Graph(std::string_view fileName, FileType type=FileType::UNKNOWN)
Creates a graph with given type and given file name.
std::ofstream m_stream
stream to the graph file
Definition GraphDumper.h:58