Loading...
Searching...
No Matches
GraphData.h
Go to the documentation of this file.
1/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19
20/*!
21 \file GraphData.h
22
23 \brief This class define a important struct used to group
24 a map of vertex and edges. A flag is used to indicate
25 if any element of this group was changed.
26*/
27
28#ifndef __TERRALIB_GRAPH_INTERNAL_GRAPHDATA_H
29#define __TERRALIB_GRAPH_INTERNAL_GRAPHDATA_H
30
31// Terralib Includes
32#include "../Config.h"
33
34// STL Includes
35#include <map>
36
37namespace te
38{
39 namespace graph
40 {
41 //forward declarations
42 class Vertex;
43 class Edge;
44
45 /*!
46 \class GraphData
47
48 \brief This class define a important struct used to group
49 a map of vertex and edges. A flag is used to indicate
50 if any element of this group was changed.
51
52 \sa GraphCache
53 */
54
56 {
57 public:
58
59 /*! \brief Default constructor. */
60 GraphData(int id);
61
62 /*! \brief Default destructor. */
64
65
66 typedef std::map<int, Vertex*> VertexMap; //!< typedef for vertex map
67
68 typedef std::map<int, Edge*> EdgeMap; //!< typedef for edge map
69
70 /*! \brief Get data identifier. */
71 int getId();
72
73 /** @name Graph Data Access Methods
74 * Method used to access the graph data, vertex and edge, and properties
75 */
76 //@{
77
78
79 void addVertex(Vertex* v);
80
81 bool removeVertex(int id);
82
83 Vertex* getVertex(int id);
84
85
86 /*!
87 \brief It returns the the vertex map
88
89 \return Map with all vertex from this graph data
90 */
92
93 /*!
94 \brief Used to set a map of vertex elements
95
96 \param map Vertex map
97
98 */
99 void setVertexMap(const VertexMap& map);
100
101
102 void addEdge(Edge* e);
103
104 bool removeEdge(int id);
105
106 Edge* getEdge(int id);
107
108
109 /*!
110 \brief It returns the the edge map
111
112 \return Map with all edges from this graph data
113 */
115
116 /*!
117 \brief Used to set a map of edge elements
118
119 \param map Edge map
120
121 */
122 void setEdgeMap(const EdgeMap& map);
123
124 //@}
125
126
127 /*!
128 \brief Flag used to define the graph data state
129
130 \param status Boolean value to define the state
131
132 */
133 void setDirty(bool status);
134
135 /*!
136 \brief Used to check the graph data state
137
138 \return Boolean value that defines the graph data state
139
140 */
141 bool isDirty();
142
143 private:
144
145 int m_id; //!< Data identifier
146 bool m_dirty; //!< Flag used to indicate that a element was changed
147
148 VertexMap m_vertexMap; //!< This map contains all vertexs from this graph.
149 EdgeMap m_edgeMap; //!< This map contains all edges from this graph.
150
151 };
152 } // end namespace graph
153} // end namespace te
154
155#endif // __TERRALIB_GRAPH_INTERNAL_GRAPHDATA_H
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
Definition: Edge.h:59
This class define a important struct used to group a map of vertex and edges. A flag is used to indic...
Definition: GraphData.h:56
int getId()
Get data identifier.
int m_id
Data identifier.
Definition: GraphData.h:145
std::map< int, Vertex * > VertexMap
typedef for vertex map
Definition: GraphData.h:66
bool removeVertex(int id)
EdgeMap & getEdgeMap()
It returns the the edge map.
bool isDirty()
Used to check the graph data state.
void setVertexMap(const VertexMap &map)
Used to set a map of vertex elements.
bool removeEdge(int id)
EdgeMap m_edgeMap
This map contains all edges from this graph.
Definition: GraphData.h:149
GraphData(int id)
Default constructor.
void addVertex(Vertex *v)
void setDirty(bool status)
Flag used to define the graph data state.
void setEdgeMap(const EdgeMap &map)
Used to set a map of edge elements.
Edge * getEdge(int id)
VertexMap m_vertexMap
This map contains all vertexs from this graph.
Definition: GraphData.h:148
void addEdge(Edge *e)
std::map< int, Edge * > EdgeMap
typedef for edge map
Definition: GraphData.h:68
VertexMap & getVertexMap()
It returns the the vertex map.
Vertex * getVertex(int id)
~GraphData()
Default destructor.
bool m_dirty
Flag used to indicate that a element was changed.
Definition: GraphData.h:146
From the point of view of graph theory, vertices are treated as featureless and indivisible objects,...
Definition: Vertex.h:69
TerraLib.
#define TEGRAPHEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:178