All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GraphDataManager.cpp
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 GraphDataManager.cpp
22 
23  \brief This class defines a interface to access the graph
24  elements inside a data source. Its use a implementation of
25  Loader Strategy that defines how a data must be loaded.
26 
27 */
28 
29 // Terralib Includes
30 #include "../../common/Translator.h"
31 #include "../../common/StringUtils.h"
32 #include "../core/Edge.h"
33 #include "../core/Vertex.h"
34 #include "../loader/AbstractGraphLoaderStrategy.h"
35 #include "../Config.h"
36 #include "../Exception.h"
37 #include "GraphDataManager.h"
38 
39 
41 {
42 }
43 
45 {
46  delete m_loadStrategy;
47 }
48 
50 {
51  return m_loadStrategy;
52 }
53 
55 {
56  m_loadStrategy = loaderStrategy;
57 }
58 
60 {
61  if(m_loadStrategy)
62  {
63  m_loadStrategy->loadDataByVertexId(vertexId, m_graph, gc);
64  }
65 }
66 
68 {
69  if(m_loadStrategy)
70  {
71  m_loadStrategy->loadDataByEdgeId(edgeId, m_graph, gc);
72  }
73 }
74 
76 {
77  if(m_loadStrategy)
78  {
79  m_loadStrategy->saveData(data);
80  }
81 }
82 
84 {
85  if(m_loadStrategy)
86  {
87  m_loadStrategy->removeEdge(id);
88  }
89 }
90 
92 {
93  if(m_loadStrategy)
94  {
95  m_loadStrategy->removeVertex(id);
96  }
97 }
void saveGraphData(GraphData *data)
Save the graph data structure in Data Source.
void loadGraphDataByVertexId(int vertexId, te::graph::GraphCache *gc=0)
Load a set of vertex elements that includes the desired element.
virtual ~GraphDataManager()
Default destructor.
void removeEdge(int id)
Function used to remove a edge from data source.
void setLoaderStrategy(AbstractGraphLoaderStrategy *loaderStrategy)
Function used to set a current loader strategy.
AbstractGraphLoaderStrategy * getLoaderStrategy()
Function used to get the current loader strategy.
This class defines a interface to access the graph elements inside a data source. Its use a implement...
Abstract class used to define the main functions of graph struct. All graph implementations must used...
Definition: AbstractGraph.h:55
This class define the main functions necessary to save and load the graph data and metadata informati...
Class used to manager the graph data elements. This class uses a cache policy to control the elements...
Definition: GraphCache.h:60
void loadGraphDataByEdgeId(int edgeId, te::graph::GraphCache *gc=0)
Load a set of edges elements that includes the desired element.
GraphDataManager(te::graph::AbstractGraph *g)
Default constructor.
void removeVertex(int id)
Function used to remove a vertex from data source.
This class define a important struct used to group a map of vertex and edges. A flag is used to indic...
Definition: GraphData.h:55