GraphDataManager.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 GraphDataManager.h
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 #ifndef __TERRALIB_GRAPH_INTERNAL_GRAPHDATAMANAGER_H
30 #define __TERRALIB_GRAPH_INTERNAL_GRAPHDATAMANAGER_H
31 
32 // Terralib Includes
33 #include "../Config.h"
34 #include "../Enums.h"
35 
36 namespace te
37 {
38  namespace graph
39  {
40  //forward declarations
41  class AbstractGraph;
42  class AbstractGraphLoaderStrategy;
43  class Edge;
44  class GraphCache;
45  class GraphData;
46  class Vertex;
47 
48  /*!
49  \class AGraphDataManager
50 
51  \brief This class defines a interface to access the graph
52  elements inside a data source. Its use a implementation of
53  Loader Strategy that defines how a data must be loaded.
54 
55  \sa AbstractGraph, AbstractGraphLoaderStrategy
56  */
57 
59  {
60  public:
61 
62  /*! \brief Default constructor. */
64 
65  /*! \brief Default destructor. */
66  virtual ~GraphDataManager();
67 
68 
69  /*!
70  \brief Function used to get the current loader strategy
71 
72  \return A valid pointer to a loader strategy if exist and a null pointer in other case
73 
74  */
75  AbstractGraphLoaderStrategy* getLoaderStrategy();
76 
77  /*!
78  \brief Function used to set a current loader strategy
79 
80  \param loaderStrategy A pointer to loader strategy implementation
81 
82  */
83  void setLoaderStrategy(AbstractGraphLoaderStrategy* loaderStrategy);
84 
85  /** @name Graph Data Manager Methods
86  * Method used to manager a graph data
87  */
88  //@{
89 
90  /*!
91  \brief Load a set of vertex elements that includes the desired element.
92 
93  \param vertexId The vertex identifier of the desired element.
94 
95  \param gc A Graph Cache used to verify if the element already in memory
96 
97  */
98  void loadGraphDataByVertexId(int vertexId, te::graph::GraphCache* gc = 0);
99 
100  /*!
101  \brief Load a set of edges elements that includes the desired element.
102 
103  \param edgeId The edge identifier of the desired element.
104 
105  \param gc A Graph Cache used to verify if the element already in memory
106 
107  */
108  void loadGraphDataByEdgeId(int edgeId, te::graph::GraphCache* gc = 0);
109 
110  /*!
111  \brief Save the graph data structure in Data Source
112 
113  \param data A graph data with a group of vertex and edge elements
114 
115  \note Only the elements with a flag new with true value will be saved and
116  the elements with the flag dirty with true value will be updated the
117  other elements will be ignored
118 
119  */
120  void saveGraphData(GraphData* data);
121 
122  /*!
123  \brief Function used to remove a edge from data source
124 
125  \param id The edge Id
126 
127  */
128  void removeEdge(int id);
129 
130  /*!
131  \brief Function used to remove a vertex from data source
132 
133  \param id The vertex Id
134 
135  */
136  void removeVertex(int id);
137 
138  //@}
139 
140  private:
141 
142  AbstractGraphLoaderStrategy* m_loadStrategy; //!< Pointer to a loader strategy object
143  AbstractGraph* m_graph; //!< Pointer to a graph object
144  };
145  } // end namespace graph
146 } // end namespace te
147 
148 #endif // __TERRALIB_GRAPH_INTERNAL_GRAPHDATAMANAGER_H
#define TEGRAPHEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:178
Abstract class used to define the main functions of graph struct. All graph implementations must used...
Definition: AbstractGraph.h:55
URI C++ Library.
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
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
AbstractGraph * m_graph
Pointer to a graph object.
AbstractGraphLoaderStrategy * m_loadStrategy
Pointer to a loader strategy object.