cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
graphml.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Read/write graphs as GraphML
4
5
Author: Michael Tautschnig, mt@eecs.qmul.ac.uk
6
7
\*******************************************************************/
8
11
12
#ifndef CPROVER_XMLLANG_GRAPHML_H
13
#define CPROVER_XMLLANG_GRAPHML_H
14
15
#include <iosfwd>
16
#include <string>
17
18
#include <
util/irep.h
>
19
#include <
util/graph.h
>
20
#include <
util/xml.h
>
21
22
class
message_handlert
;
23
24
struct
xml_edget
25
{
26
xmlt
xml_node
;
27
};
28
29
struct
xml_graph_nodet
:
public
graph_nodet
<xml_edget>
30
{
31
typedef
graph_nodet<xml_edget>::edget
edget
;
32
typedef
graph_nodet<xml_edget>::edgest
edgest
;
33
34
std::string
node_name
;
35
irep_idt
file
;
36
irep_idt
line
;
37
bool
is_violation
;
38
bool
has_invariant
;
39
std::string
invariant
;
40
std::string
invariant_scope
;
41
};
42
43
class
graphmlt
:
public
grapht
<xml_graph_nodet>
44
{
45
public
:
46
bool
has_node
(
const
std::string &node_name)
const
47
{
48
for
(
const
auto
&n :
nodes
)
49
if
(n.node_name==node_name)
50
return
true
;
51
52
return
false
;
53
}
54
55
node_indext
add_node_if_not_exists
(std::string node_name)
56
{
57
for
(
node_indext
i=0; i<
nodes
.size(); ++i)
58
{
59
if
(
nodes
[i].node_name==node_name)
60
return
i;
61
}
62
63
return
grapht<xml_graph_nodet>::add_node
();
64
}
65
66
typedef
std::map<std::string, std::string>
key_valuest
;
67
key_valuest
key_values
;
68
};
69
70
bool
read_graphml
(
71
std::istream &is,
72
graphmlt
&dest,
73
graphmlt::node_indext
&entry,
74
message_handlert
&message_handler);
75
bool
read_graphml
(
76
const
std::string &filename,
77
graphmlt
&dest,
78
graphmlt::node_indext
&entry,
79
message_handlert
&message_handler);
80
81
bool
write_graphml
(
const
graphmlt
&src, std::ostream &os);
82
83
#endif
// CPROVER_XMLLANG_GRAPHML_H
graph_nodet
This class represents a node in a directed graph.
Definition
graph.h:35
graph_nodet::edget
E edget
Definition
graph.h:39
graph_nodet::edgest
std::map< node_indext, edget > edgest
Definition
graph.h:40
graphmlt
Definition
graphml.h:44
graphmlt::has_node
bool has_node(const std::string &node_name) const
Definition
graphml.h:46
graphmlt::add_node_if_not_exists
node_indext add_node_if_not_exists(std::string node_name)
Definition
graphml.h:55
graphmlt::key_valuest
std::map< std::string, std::string > key_valuest
Definition
graphml.h:66
graphmlt::key_values
key_valuest key_values
Definition
graphml.h:67
grapht
A generic directed graph with a parametric node type.
Definition
graph.h:167
grapht< xml_graph_nodet >::nodes
nodest nodes
Definition
graph.h:176
grapht< xml_graph_nodet >::node_indext
nodet::node_indext node_indext
Definition
graph.h:173
grapht::add_node
node_indext add_node(arguments &&... values)
Definition
graph.h:180
message_handlert
Definition
message.h:27
xmlt
Definition
xml.h:21
graph.h
A Template Class for Graphs.
read_graphml
bool read_graphml(std::istream &is, graphmlt &dest, graphmlt::node_indext &entry, message_handlert &message_handler)
Definition
graphml.cpp:175
write_graphml
bool write_graphml(const graphmlt &src, std::ostream &os)
Definition
graphml.cpp:203
irep.h
xml_edget
Definition
graphml.h:25
xml_edget::xml_node
xmlt xml_node
Definition
graphml.h:26
xml_graph_nodet
Definition
graphml.h:30
xml_graph_nodet::invariant
std::string invariant
Definition
graphml.h:39
xml_graph_nodet::file
irep_idt file
Definition
graphml.h:35
xml_graph_nodet::line
irep_idt line
Definition
graphml.h:36
xml_graph_nodet::has_invariant
bool has_invariant
Definition
graphml.h:38
xml_graph_nodet::invariant_scope
std::string invariant_scope
Definition
graphml.h:40
xml_graph_nodet::is_violation
bool is_violation
Definition
graphml.h:37
xml_graph_nodet::edgest
graph_nodet< xml_edget >::edgest edgest
Definition
graphml.h:32
xml_graph_nodet::edget
graph_nodet< xml_edget >::edget edget
Definition
graphml.h:31
xml_graph_nodet::node_name
std::string node_name
Definition
graphml.h:34
irep_idt
dstringt irep_idt
Definition
verification_result.h:16
xml.h
xmllang
graphml.h
Generated by
1.17.0