All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GraphData.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 GraphData.cpp
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 // Terralib Includes
29 #include "../../common/STLUtils.h"
30 #include "../core/Edge.h"
31 #include "../core/Vertex.h"
32 #include "GraphData.h"
33 
34 
36  m_id(id),
37  m_dirty(false)
38 {
39 }
40 
42 {
43  te::common::FreeContents(m_vertexMap);
44  te::common::FreeContents(m_edgeMap);
45 
46  m_vertexMap.clear();
47  m_edgeMap.clear();
48 }
49 
51 {
52  return m_id;
53 }
54 
56 {
57  return m_vertexMap;
58 }
59 
61 {
62  m_vertexMap = map;
63 }
64 
66 {
67  return m_edgeMap;
68 }
69 
71 {
72  m_edgeMap = map;
73 }
74 
76 {
77  m_dirty = status;
78 }
79 
81 {
82  return m_dirty;
83 }
bool isDirty()
Used to check the graph data state.
Definition: GraphData.cpp:80
void setDirty(bool status)
Flag used to define the graph data state.
Definition: GraphData.cpp:75
int getId()
Get data identifier.
Definition: GraphData.cpp:50
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...
Definition: BoostUtils.h:55
std::map< int, Vertex * > VertexMap
typedef for vertex map
Definition: GraphData.h:66
GraphData(int id)
Default constructor.
Definition: GraphData.cpp:35
void setVertexMap(const VertexMap &map)
Used to set a map of vertex elements.
Definition: GraphData.cpp:60
~GraphData()
Default destructor.
Definition: GraphData.cpp:41
This class define a important struct used to group a map of vertex and edges. A flag is used to indic...
std::map< int, Edge * > EdgeMap
typedef for edge map
Definition: GraphData.h:68
void setEdgeMap(const EdgeMap &map)
Used to set a map of edge elements.
Definition: GraphData.cpp:70
EdgeMap & getEdgeMap()
It returns the the edge map.
Definition: GraphData.cpp:65
VertexMap & getVertexMap()
It returns the the vertex map.
Definition: GraphData.cpp:55