libstorage-ng
Loading...
Searching...
No Matches
Graphviz.h
1/*
2 * Copyright (c) [2016-2019] SUSE LLC
3 *
4 * All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2 of the GNU General Public License as published
8 * by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, contact Novell, Inc.
17 *
18 * To contact Novell about this file by physical or electronic mail, you may
19 * find current contact information at www.novell.com.
20 */
21
22
23#ifndef STORAGE_GRAPHVIZ_H
24#define STORAGE_GRAPHVIZ_H
25
26
27#include <string>
28#include <map>
29
30
31namespace storage
32{
33
34 class Device;
35 class Holder;
36
37
44 enum class GraphvizFlags : unsigned int
45 {
46 NONE = 0,
47 CLASSNAME = 1 << 0,
48 PRETTY_CLASSNAME = 1 << 1,
49 NAME = 1 << 2,
50 SID = 1 << 3,
51 SIZE = 1 << 4,
52 ACTIVE = 1 << 5,
53 IN_ETC = 1 << 6,
54 DISPLAYNAME = 1 << 7
55 };
56
57
60
61 bool operator&&(GraphvizFlags a, GraphvizFlags b);
62
63
72 {
73 public:
74
75 virtual ~GraphStyleCallbacks() {}
76
80 virtual std::map<std::string, std::string> graph() = 0;
81
85 virtual std::map<std::string, std::string> nodes() = 0;
86
90 virtual std::map<std::string, std::string> edges() = 0;
91
96 static std::string escape(const std::string&);
97
98 };
99
100
105 {
106 public:
107
108 virtual ~DevicegraphStyleCallbacks() {}
109
113 virtual std::map<std::string, std::string> node(const Device* device) = 0;
114
118 virtual std::map<std::string, std::string> edge(const Holder* holder) = 0;
119
120 };
121
122
126 class ActiongraphStyleCallbacks;
127
128
135
136
142 ActiongraphStyleCallbacks* get_debug_actiongraph_style_callbacks();
143
144}
145
146
147#endif
An abstract base class for storage devices.
Definition Device.h:82
Style callbacks used by Devicegraph::write_graphviz().
Definition Graphviz.h:105
virtual std::map< std::string, std::string > edge(const Holder *holder)=0
Attributes for a specific edge.
virtual std::map< std::string, std::string > node(const Device *device)=0
Attributes for a specific node.
Base class for DevicegraphStyleCallbacks and ActiongraphStyleCallbacks.
Definition Graphviz.h:72
virtual std::map< std::string, std::string > edges()=0
Default attributes for edges.
virtual std::map< std::string, std::string > graph()=0
Attributes for the graph.
static std::string escape(const std::string &)
Helper function to escape a string to a graphviz escString, see https://graphviz.gitlab....
virtual std::map< std::string, std::string > nodes()=0
Default attributes for nodes.
An abstract base class for storage holders.
Definition Holder.h:57
The storage namespace.
Definition Actiongraph.h:40
DevicegraphStyleCallbacks * get_debug_devicegraph_style_callbacks()
Get a DevicegraphStyleCallbacks object for debugging.
ActiongraphStyleCallbacks * get_debug_actiongraph_style_callbacks()
Get a ActiongraphStyleCallbacks object for debugging.
GraphvizFlags
Bitfield to control graphviz output.
Definition Graphviz.h:45