Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

ogdf::OgmlParser Class Reference

Objects of this class represent a validating parser for files in Ogml. More...

#include <ogdf/fileformats/OgmlParser.h>

Public Member Functions

 OgmlParser ()
 Constructs an OGML parser. More...
 
 ~OgmlParser ()
 
bool read (istream &is, Graph &G)
 Reads a graph G from istream is in OGML format. More...
 
bool read (istream &is, Graph &G, ClusterGraph &CG)
 Reads a cluster graph CG from istream is in OGML format. More...
 
bool read (istream &is, Graph &G, GraphAttributes &GA)
 Reads a graph G with attributes GA from istream is in OGML format. More...
 
bool read (istream &is, Graph &G, ClusterGraph &CG, ClusterGraphAttributes &CGA)
 Reads a cluster graph CG with attributes CGA from istream is in OGML format. More...
 

Private Types

enum  Mode { compMode = 0, choiceMode, optMode }
 

Private Member Functions

bool addAttributes (Graph &G, GraphAttributes &GA, ClusterGraphAttributes *pCGA, const XmlTagObject *root)
 Build a cluster graph with style/layout attributes. More...
 
bool buildCluster (const XmlTagObject *rootTag, Graph &G, ClusterGraph &CG)
 Builds a cluster graph. More...
 
bool buildClusterRecursive (const XmlTagObject *xmlTag, cluster parent, Graph &G, ClusterGraph &CG)
 Recursive part of buildCluster. More...
 
bool buildGraph (Graph &G)
 Builds a graph; ignores nodes which have hierarchical structure. More...
 
bool checkGraphType (const XmlTagObject *xmlTag) const
 Checks the graph type and stores it in the member variable m_graphType xmlTag has to be the root or the graph or the structure Ogml-tag returns false if something goes wrong. More...
 
bool doRead (istream &is, Graph &G, ClusterGraph *pCG, GraphAttributes *pGA, ClusterGraphAttributes *pCGA)
 Unified read method for graphs. More...
 
EdgeArrow getArrowStyle (int i)
 
int getArrowStyleAsInt (string s)
 
FillPattern getFillPattern (string s)
 Returns fill pattern of string s. More...
 
Ogml::GraphType getGraphType ()
 
bool getIdFromString (string str, int &id)
 Returns the integer value of the id at the end of the string (if it exists). More...
 
string getLabelCaptionFromString (string str)
 
string getNodeTemplateFromOgmlValue (string s)
 Maps the OGML attribute values to corresponding GDE values. More...
 
Shape getShape (string s)
 Returns the shape as an integer value. More...
 
StrokeType getStrokeType (string s)
 Returns the line type as an integer value. More...
 
bool isGraphHierarchical (const XmlTagObject *xmlTag) const
 Returns true iff subgraph is an hierarchical graph. More...
 
bool isNodeHierarchical (const XmlTagObject *xmlTag) const
 Returns true iff node contains other nodes. More...
 
void printValidityInfo (const OgmlTag &ot, const XmlTagObject &xto, int valStatus, int line)
 Prints some useful information about un-/successful validation. More...
 
bool setLabelsRecursive (Graph &G, GraphAttributes &GA, ClusterGraphAttributes *pCGA, XmlTagObject *root)
 Recursive method for setting labels of clusters and nodes. More...
 
int validate (const XmlTagObject *xmlTag, int ogmlTag)
 Checks if all tags (XmlTagObject), their attributes (XmlAttributeObject) and their values are valid (are tags expected, do they own the rigth attributes...) and sets a valid flag to these. More...
 

Private Attributes

Hashing< int, OgmlAttribute > * m_attributes
 Hashtable for saving all ogml attributes. More...
 
Hashing< int, OgmlAttributeValue > * m_attValues
 Hashtable for saving all values of ogml attributes. More...
 
Hashing< int, string > m_clusterIds
 
Hashing< string, cluster > m_clusters
 
XmlTagObject * m_constraintsTag
 
Hashing< int, string > m_edgeIds
 
Hashing< string, edge > m_edges
 
Ogml::GraphType m_graphType
 Saves a graph type. More...
 
Hashing< string, const XmlTagObject * > m_ids
 Saves all ids of an ogml-file. More...
 
Hashing< int, string > m_nodeIds
 
Hashing< string, node > m_nodes
 
Hashing< string, OgmlEdgeTemplate * > m_ogmlEdgeTemplates
 
Hashing< string, OgmlNodeTemplate * > m_ogmlNodeTemplates
 
Hashing< string, DPoint > m_points
 
Hashing< int, OgmlTag > * m_tags
 Hashtable for saving all ogml tags. More...
 

Friends

ostream & operator<< (ostream &os, const OgmlParser::OgmlAttribute &oa)
 
ostream & operator<< (ostream &os, const OgmlParser::OgmlTag &ot)
 

Detailed Description

Objects of this class represent a validating parser for files in Ogml.

Definition at line 46 of file OgmlParser.h.

Member Enumeration Documentation

◆ Mode

enum ogdf::OgmlParser::Mode
private
Enumerator
compMode 
choiceMode 
optMode 

Definition at line 70 of file OgmlParser.h.

Constructor & Destructor Documentation

◆ OgmlParser()

ogdf::OgmlParser::OgmlParser ( )

Constructs an OGML parser.

◆ ~OgmlParser()

ogdf::OgmlParser::~OgmlParser ( )

Member Function Documentation

◆ addAttributes()

bool ogdf::OgmlParser::addAttributes ( Graph &  G,
GraphAttributes &  GA,
ClusterGraphAttributes *  pCGA,
const XmlTagObject *  root 
)
private

Build a cluster graph with style/layout attributes.

◆ buildCluster()

bool ogdf::OgmlParser::buildCluster ( const XmlTagObject *  rootTag,
Graph &  G,
ClusterGraph &  CG 
)
private

Builds a cluster graph.

◆ buildClusterRecursive()

bool ogdf::OgmlParser::buildClusterRecursive ( const XmlTagObject *  xmlTag,
cluster  parent,
Graph &  G,
ClusterGraph &  CG 
)
private

Recursive part of buildCluster.

◆ buildGraph()

bool ogdf::OgmlParser::buildGraph ( Graph &  G)
private

Builds a graph; ignores nodes which have hierarchical structure.

◆ checkGraphType()

bool ogdf::OgmlParser::checkGraphType ( const XmlTagObject *  xmlTag) const
private

Checks the graph type and stores it in the member variable m_graphType xmlTag has to be the root or the graph or the structure Ogml-tag returns false if something goes wrong.

◆ doRead()

bool ogdf::OgmlParser::doRead ( istream &  is,
Graph &  G,
ClusterGraph *  pCG,
GraphAttributes *  pGA,
ClusterGraphAttributes *  pCGA 
)
private

Unified read method for graphs.

◆ getArrowStyle()

EdgeArrow ogdf::OgmlParser::getArrowStyle ( int  i)
private

◆ getArrowStyleAsInt()

int ogdf::OgmlParser::getArrowStyleAsInt ( string  s)
private

◆ getFillPattern()

FillPattern ogdf::OgmlParser::getFillPattern ( string  s)
private

Returns fill pattern of string s.

◆ getGraphType()

Ogml::GraphType ogdf::OgmlParser::getGraphType ( )
inlineprivate

Definition at line 123 of file OgmlParser.h.

◆ getIdFromString()

bool ogdf::OgmlParser::getIdFromString ( string  str,
int &  id 
)
private

Returns the integer value of the id at the end of the string (if it exists).

◆ getLabelCaptionFromString()

string ogdf::OgmlParser::getLabelCaptionFromString ( string  str)
private

◆ getNodeTemplateFromOgmlValue()

string ogdf::OgmlParser::getNodeTemplateFromOgmlValue ( string  s)
private

Maps the OGML attribute values to corresponding GDE values.

◆ getShape()

Shape ogdf::OgmlParser::getShape ( string  s)
private

Returns the shape as an integer value.

◆ getStrokeType()

StrokeType ogdf::OgmlParser::getStrokeType ( string  s)
private

Returns the line type as an integer value.

◆ isGraphHierarchical()

bool ogdf::OgmlParser::isGraphHierarchical ( const XmlTagObject *  xmlTag) const
private

Returns true iff subgraph is an hierarchical graph.

◆ isNodeHierarchical()

bool ogdf::OgmlParser::isNodeHierarchical ( const XmlTagObject *  xmlTag) const
private

Returns true iff node contains other nodes.

◆ printValidityInfo()

void ogdf::OgmlParser::printValidityInfo ( const OgmlTag &  ot,
const XmlTagObject &  xto,
int  valStatus,
int  line 
)
private

Prints some useful information about un-/successful validation.

◆ read() [1/4]

bool ogdf::OgmlParser::read ( istream &  is,
Graph &  G 
)
inline

Reads a graph G from istream is in OGML format.

Parameters
isis the input stream to be parsed as OGML file.
Gis the graph to be build from the OGML file.
Returns
true if succesfull, false otherwise.

Definition at line 239 of file OgmlParser.h.

◆ read() [2/4]

bool ogdf::OgmlParser::read ( istream &  is,
Graph &  G,
ClusterGraph &  CG 
)
inline

Reads a cluster graph CG from istream is in OGML format.

Parameters
isis the input stream to be parsed as OGML file.
Gis the graph to be build from the OGML file; must be the graph associated with CG.
CGis the cluster graph to be build from the OGML file.
Returns
true if succesfull, false otherwise.

Definition at line 250 of file OgmlParser.h.

◆ read() [3/4]

bool ogdf::OgmlParser::read ( istream &  is,
Graph &  G,
GraphAttributes &  GA 
)
inline

Reads a graph G with attributes GA from istream is in OGML format.

Parameters
isis the input stream to be parsed as OGML file.
Gis the graph to be build from the OGML file.
GAare the graph attributes (associated with G) in which layout and style information are stored.
Returns
true if succesfull, false otherwise.

Definition at line 261 of file OgmlParser.h.

◆ read() [4/4]

bool ogdf::OgmlParser::read ( istream &  is,
Graph &  G,
ClusterGraph &  CG,
ClusterGraphAttributes &  CGA 
)
inline

Reads a cluster graph CG with attributes CGA from istream is in OGML format.

Parameters
isis the input stream to be parsed as OGML file.
Gis the graph to be build from the OGML file; must be the graph associated with CG.
CGis the cluster graph to be build from the OGML file.
CGAare the cluster graph attributes (associated with CG) in which layout and style information are stored.
Returns
true if succesfull, false otherwise.

Definition at line 277 of file OgmlParser.h.

◆ setLabelsRecursive()

bool ogdf::OgmlParser::setLabelsRecursive ( Graph &  G,
GraphAttributes &  GA,
ClusterGraphAttributes *  pCGA,
XmlTagObject *  root 
)
private

Recursive method for setting labels of clusters and nodes.

◆ validate()

int ogdf::OgmlParser::validate ( const XmlTagObject *  xmlTag,
int  ogmlTag 
)
private

Checks if all tags (XmlTagObject), their attributes (XmlAttributeObject) and their values are valid (are tags expected, do they own the rigth attributes...) and sets a valid flag to these.

Furthermore it checks if ids of tags are unique and if id references are valid. See OgmlTag.h for semantics of the encodings. Returns the validity state of the current processed tag.

Friends And Related Function Documentation

◆ operator<< [1/2]

ostream& operator<< ( ostream &  os,
const OgmlParser::OgmlAttribute &  oa 
)
friend

◆ operator<< [2/2]

ostream& operator<< ( ostream &  os,
const OgmlParser::OgmlTag &  ot 
)
friend

Member Data Documentation

◆ m_attributes

Hashing<int, OgmlAttribute>* ogdf::OgmlParser::m_attributes
private

Hashtable for saving all ogml attributes.

Definition at line 67 of file OgmlParser.h.

◆ m_attValues

Hashing<int, OgmlAttributeValue>* ogdf::OgmlParser::m_attValues
private

Hashtable for saving all values of ogml attributes.

Definition at line 68 of file OgmlParser.h.

◆ m_clusterIds

Hashing<int, string> ogdf::OgmlParser::m_clusterIds
private

Definition at line 140 of file OgmlParser.h.

◆ m_clusters

Hashing<string, cluster> ogdf::OgmlParser::m_clusters
private

Definition at line 131 of file OgmlParser.h.

◆ m_constraintsTag

XmlTagObject* ogdf::OgmlParser::m_constraintsTag
private

Definition at line 177 of file OgmlParser.h.

◆ m_edgeIds

Hashing<int, string> ogdf::OgmlParser::m_edgeIds
private

Definition at line 139 of file OgmlParser.h.

◆ m_edges

Hashing<string, edge> ogdf::OgmlParser::m_edges
private

Definition at line 130 of file OgmlParser.h.

◆ m_graphType

Ogml::GraphType ogdf::OgmlParser::m_graphType
mutableprivate

Saves a graph type.

Is set by checkGraphType.

Definition at line 72 of file OgmlParser.h.

◆ m_ids

Hashing<string, const XmlTagObject*> ogdf::OgmlParser::m_ids
private

Saves all ids of an ogml-file.

Definition at line 74 of file OgmlParser.h.

◆ m_nodeIds

Hashing<int, string> ogdf::OgmlParser::m_nodeIds
private

Definition at line 138 of file OgmlParser.h.

◆ m_nodes

Hashing<string, node> ogdf::OgmlParser::m_nodes
private

Definition at line 123 of file OgmlParser.h.

◆ m_ogmlEdgeTemplates

Hashing<string, OgmlEdgeTemplate*> ogdf::OgmlParser::m_ogmlEdgeTemplates
private

Definition at line 182 of file OgmlParser.h.

◆ m_ogmlNodeTemplates

Hashing<string, OgmlNodeTemplate*> ogdf::OgmlParser::m_ogmlNodeTemplates
private

Definition at line 181 of file OgmlParser.h.

◆ m_points

Hashing<string, DPoint> ogdf::OgmlParser::m_points
private

Definition at line 133 of file OgmlParser.h.

◆ m_tags

Hashing<int, OgmlTag>* ogdf::OgmlParser::m_tags
private

Hashtable for saving all ogml tags.

Definition at line 66 of file OgmlParser.h.


The documentation for this class was generated from the following file: