Loading...
Searching...
No Matches
MemoryIterator.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 Memoryterator.h
22
23 \brief This class defines a commun interface to represents a graph
24 iterator class. The main diferency to anothers iterators is
25 the possibility to iterate over the edges or vertexs from a
26 graph.
27*/
28
29#ifndef __TERRALIB_GRAPH_INTERNAL_MEMORYITERATOR_H
30#define __TERRALIB_GRAPH_INTERNAL_MEMORYITERATOR_H
31
32// Terralib Includes
33#include "../Config.h"
34#include "AbstractIterator.h"
35
36
37// STL Includes
38#include <map>
39
40namespace te
41{
42 namespace graph
43 {
44 //forward declarations
45 class AbstractGraph;
46 class Edge;
47 class Vertex;
48
49 /*!
50 \class Memoryterator
51
52 \brief This class defines a commun interface to represents a graph
53 iterator class. The main diferency to anothers iterators is
54 the possibility to iterate over the edges or vertexs from a
55 graph.
56
57 \sa
58 */
59
61 {
62 public:
63
64 /*! \brief Default constructor. */
66
67 /*! \brief Virtual destructor. */
68 virtual ~MemoryIterator();
69
70
71 /** @name Vertex Iterator Methods
72 * Method used to access vertex elements from a graph.
73 */
74 //@{
75
76 /*!
77 \brief It returns a pointer to the first vertex element of a graph
78
79 \return A valid vertex point if the element was found and a null pointer in other case.
80 */
82
83 /*!
84 \brief It returns a pointer to the next vertex element of a graph
85
86 \return A valid vertex point if the element was found and a null pointer in other case.
87 */
89
90 /*!
91 \brief It returns a pointer to the previous vertex element of a graph
92
93 \return A valid vertex point if the element was found and a null pointer in other case.
94 */
96
97 /*!
98 \brief Used to check the iterator position
99
100 \return True if the iterator is at after the end and false in other case
101 */
103
104 /*!
105 \brief It returns the number of elements of this iterator
106
107 \return Size t value.
108 */
109 virtual size_t getVertexInteratorCount();
110
111 //@}
112
113 /** @name Vertex Iterator Methods
114 * Method used to access vertex elements from a graph.
115 */
116 //@{
117
118 /*!
119 \brief It returns a pointer to the first edge element of a graph
120
121 \return A valid edge point if the element was found and a null pointer in other case.
122 */
124
125 /*!
126 \brief It returns a pointer to the next edge element of a graph
127
128 \return A valid edge point if the element was found and a null pointer in other case.
129 */
131
132 /*!
133 \brief It returns a pointer to the previous edge element of a graph
134
135 \return A valid edge point if the element was found and a null pointer in other case.
136 */
138
139 /*!
140 \brief Used to check the iterator position
141
142 \return True if the iterator is at after the end and false in other case
143 */
145
146 /*!
147 \brief It returns the number of elements of this iterator
148
149 \return Size t value.
150 */
151 virtual size_t getEdgeInteratorCount();
152
153 //@}
154
155 protected:
156
157 std::map<int, Vertex*> m_vertexMap; //!< This map contains all vertexs from this graph.
158 std::map<int, Edge*> m_edgeMap; //!< This map contains all edges from this graph.
159
160 std::map<int, Vertex*>::iterator m_vertexMapIt; //!< Iterator for all vertexs from this graph.
161 std::map<int, Edge*>::iterator m_edgeMapIt; //!< Iterator for all edges from this graph.
162
163 };
164
165 } // end namespace graph
166} // end namespace te
167
168#endif // __TERRALIB_GRAPH_INTERNAL_MEMORYITERATOR_H
This class defines a commun interface to represents a graph iterator class. The main diferency to ano...
Abstract class used to define the main functions of graph struct. All graph implementations must used...
Definition: AbstractGraph.h:56
This class defines a commun interface to represents a graph iterator class. The main diferency to ano...
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
Definition: Edge.h:59
MemoryIterator(te::graph::AbstractGraph *g)
Default constructor.
std::map< int, Vertex * >::iterator m_vertexMapIt
Iterator for all vertexs from this graph.
virtual te::graph::Edge * getFirstEdge()
It returns a pointer to the first edge element of a graph.
virtual bool isEdgeIteratorAfterEnd()
Used to check the iterator position.
std::map< int, Edge * > m_edgeMap
This map contains all edges from this graph.
virtual bool isVertexIteratorAfterEnd()
Used to check the iterator position.
virtual te::graph::Vertex * getFirstVertex()
It returns a pointer to the first vertex element of a graph.
virtual size_t getVertexInteratorCount()
It returns the number of elements of this iterator.
virtual ~MemoryIterator()
Virtual destructor.
virtual te::graph::Edge * getNextEdge()
It returns a pointer to the next edge element of a graph.
virtual te::graph::Vertex * getNextVertex()
It returns a pointer to the next vertex element of a graph.
virtual te::graph::Edge * getPreviousEdge()
It returns a pointer to the previous edge element of a graph.
std::map< int, Vertex * > m_vertexMap
This map contains all vertexs from this graph.
std::map< int, Edge * >::iterator m_edgeMapIt
Iterator for all edges from this graph.
virtual te::graph::Vertex * getPreviousVertex()
It returns a pointer to the previous vertex element of a graph.
virtual size_t getEdgeInteratorCount()
It returns the number of elements of this iterator.
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