All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AbstractGraph.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2001-2009 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 AbstractGraph.cpp
22 
23  \brief
24 */
25 
26 // Terralib Includes
27 #include "../../common/Translator.h"
28 #include "../../common/StringUtils.h"
29 #include "../iterator/AbstractIterator.h"
30 #include "../Config.h"
31 #include "../Exception.h"
32 #include "AbstractGraph.h"
33 
35  m_iterator(0)
36 {
37 }
38 
40 {
41 }
42 
44 {
45  if(m_iterator == 0)
46  {
47  throw Exception(TR_GRAPH("Iterator not defined"));
48  }
49 
50  return m_iterator->getFirstVertex();
51 }
52 
54 {
55  if(m_iterator == 0)
56  {
57  throw Exception(TR_GRAPH("Iterator not defined"));
58  }
59 
60  return m_iterator->getNextVertex();
61 }
62 
64 {
65  if(m_iterator == 0)
66  {
67  throw Exception(TR_GRAPH("Iterator not defined"));
68  }
69 
70  return m_iterator->getPreviousVertex();
71 }
72 
74 {
75  if(m_iterator == 0)
76  {
77  throw Exception(TR_GRAPH("Iterator not defined"));
78  }
79 
80  return m_iterator->getFirstEdge();
81 }
82 
84 {
85  if(m_iterator == 0)
86  {
87  throw Exception(TR_GRAPH("Iterator not defined"));
88  }
89 
90  return m_iterator->getNextEdge();
91 }
92 
94 {
95  if(m_iterator == 0)
96  {
97  throw Exception(TR_GRAPH("Iterator not defined"));
98  }
99 
100  return m_iterator->getPreviousEdge();
101 }
102 
104 {
105  m_iterator = i;
106 }
107 
109 {
110  return m_iterator;
111 }
te::graph::Edge * getPreviousEdge()
It returns a pointer to the previous edge element of a graph.
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
Definition: Edge.h:58
void setIterator(te::graph::AbstractIterator *i)
Used to associate a iterator to graph.
From the point of view of graph theory, vertices are treated as featureless and indivisible objects...
Definition: Vertex.h:68
#define TR_GRAPH(message)
It marks a string in order to get translated. This is a special mark used in the Graph module of Terr...
Definition: Config.h:58
virtual te::graph::Vertex * getNextVertex()
It returns a pointer to the next vertex element of a graph.
virtual te::graph::Vertex * getPreviousVertex()
It returns a pointer to the previous vertex element of a graph.
virtual ~AbstractGraph()
Virtual destructor.
te::graph::Edge * getNextEdge()
It returns a pointer to the next edge element of a graph.
This class defines a commun interface to represents a graph iterator class. The main diferency to ano...
te::graph::Edge * getFirstEdge()
It returns a pointer to the first edge element of a graph.
AbstractGraph()
Default constructor.
te::graph::AbstractIterator * getIterator()
Used to get a iterator associated to graph.
Abstract class used to define the main functions of graph struct. All graph implementations must used...
virtual te::graph::Vertex * getFirstVertex()
It returns a pointer to the first vertex element of a graph.