Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
GmlParser.h
Go to the documentation of this file.
1
32#pragma once
33
38
39namespace ogdf {
40
41namespace gml {
42
45 Object* pBrother; // brother of node in tree
46 Key key; // tag of node
47 ObjectType valueType; // type of node
48
49 // the entry in the union is selected according to m_valueType:
50 // IntValue -> m_intValue
51 // DoubleValue -> m_doubleValue
52 // StringValue -> m_stringValue
53 // ListBegin -> m_pFirstSon (in case of a list, m_pFirstSon is pointer
54 // to first son and the sons are chained by m_pBrother)
55 union {
58 const char* stringValue;
60 };
61
62 // construction
63 Object(Key k, int value)
64 : pBrother(nullptr), key(k), valueType(ObjectType::IntValue), intValue(value) { }
65
66 Object(Key k, double value)
67 : pBrother(nullptr), key(k), valueType(ObjectType::DoubleValue), doubleValue(value) { }
68
69 Object(Key k, const char* value)
70 : pBrother(nullptr), key(k), valueType(ObjectType::StringValue), stringValue(value) { }
71
73 : pBrother(nullptr), key(k), valueType(ObjectType::ListBegin), pFirstSon(nullptr) { }
74
76};
77
80 std::istream* m_is;
81 bool m_error;
82
83 char *m_rLineBuffer, *m_lineBuffer, *m_pCurrent, *m_pStore, m_cStore;
84
87 const char* m_stringSymbol;
90
91 Object* m_objectTree; // root node of GML parse tree
92
96
97public:
98 // construction: creates object tree
99 // sets m_error flag if an error occured
100 explicit Parser(std::istream& is, bool doCheck = false);
101
104
105 // true <=> an error in GML files has been detected
106 bool error() const { return m_error; }
107
108 // creates graph from GML parse tree
109 bool read(Graph& G);
110 // creates attributed graph from GML parse tree
112
113 //read only cluster part of object tree and create cluster graph structure
115
116protected:
119 ClusterGraphAttributes* ACG = nullptr);
120
121private:
122 void createObjectTree(std::istream& is, bool doCheck);
123 void setError(const string& errorString, Logger::Level level = Logger::Level::Default);
124
127 bool getLine();
128
129 Object* getNodeIdRange(int& minId, int& maxId);
131
133};
134
135}
136
137}
Derived class of GraphObserver providing additional functionality to handle clustered graphs.
Declares ClusterGraphAttributes, an extension of class GraphAttributes, to store clustergraph layout ...
GML related enums and string conversion functions.
Declaration of class GraphAttributes which extends a Graph by additional attributes.
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:214
Representation of clusters in a clustered graph.
Stores additional attributes of a clustered graph (like layout information).
Representation of clustered graphs.
Polylines with PointType points.
Definition geometry.h:253
Stores additional attributes of a graph (like layout information).
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:521
Level
supported log-levels from lowest to highest importance
Definition Logger.h:103
Reads GML file and constructs GML parse tree.
Definition GmlParser.h:79
void createObjectTree(std::istream &is, bool doCheck)
~Parser()
Destruction: destroys object tree.
Object * getNodeIdRange(int &minId, int &maxId)
Object * parseList(ObjectType closingKey)
Object * m_graphObject
Definition GmlParser.h:95
Array< node > m_mapToNode
Definition GmlParser.h:94
string m_longString
Definition GmlParser.h:89
Parser(std::istream &is, bool doCheck=false)
void setError(const string &errorString, Logger::Level level=Logger::Level::Default)
ObjectType getNextSymbol()
void readLineAttribute(Object *object, DPolyline &dpl)
std::istream * m_is
Definition GmlParser.h:80
bool readCluster(Graph &G, ClusterGraph &CG, ClusterGraphAttributes *ACG=nullptr)
double m_doubleSymbol
Definition GmlParser.h:86
bool read(Graph &G, GraphAttributes &GA)
bool read(Graph &G)
bool error() const
Definition GmlParser.h:106
bool recursiveClusterRead(Object *clusterObject, ClusterGraph &CG, cluster c, ClusterGraphAttributes *ACG=nullptr)
Reads cluster subtree information recursively.
const char * m_stringSymbol
Definition GmlParser.h:87
Object * m_objectTree
Definition GmlParser.h:91
void destroyObjectList(Object *object)
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
#define OGDF_NEW_DELETE
Makes the class use OGDF's memory allocator.
Definition memory.h:84
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
ObjectType
Definition GML.h:44
The namespace for all OGDF objects.
Represents node in GML parse tree.
Definition GmlParser.h:44
ObjectType valueType
Definition GmlParser.h:47
Object(Key k, double value)
Definition GmlParser.h:66
Object(Key k, int value)
Definition GmlParser.h:63
Object(Key k, const char *value)
Definition GmlParser.h:69
Object * pFirstSon
Definition GmlParser.h:59
Object * pBrother
Definition GmlParser.h:45
const char * stringValue
Definition GmlParser.h:58