Loading...
Searching...
No Matches
AbstractGraphLoaderStrategy.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 AbstractGraphLoaderStrategy.h
22
23 \brief This class define the main functions necessary to
24 save and load the graph data and metadata information
25 using the Graph Data and Graph Cache conceptions.
26*/
27
28#ifndef __TERRALIB_GRAPH_INTERNAL_ABSTRACTGRAPHLOADERSTRATEGY_H
29#define __TERRALIB_GRAPH_INTERNAL_ABSTRACTGRAPHLOADERSTRATEGY_H
30
31// Terralib Includes
32#include "../core/GraphMetadata.h"
33#include "../Config.h"
34
35namespace te
36{
37 namespace graph
38 {
39 class AbstractGraph;
40 class Edge;
41 class GraphCache;
42 class GraphData;
43 class GraphMetadata;
44 class Vertex;
45 /*!
46 \class AbstractGraphLoaderStrategy
47
48 \brief This class define the main functions necessary to
49 save and load the graph data and metadata information
50 using the Graph Cache conception.
51
52 \sa AbstractGraph, GraphMetadata, GraphCache
53 */
54
56 {
57 public:
58
59 /*! \brief Default constructor. */
61
62 /*! \brief Default destructor. */
64
65 /** @name Abstract Graph Loader Strategy Methods
66 * Method used to manager a graph data
67 */
68 //@{
69
70 /*!
71 \brief Functio used to load a group of vertex elements given a base element
72
73 \param vertexId Attribute used to identify the base element
74
75 \param g Pointer to a graph, parent of this element
76
77 \param gc This is a optional attribute, if present the cache will be check if the already been loaded
78
79 */
80 virtual void loadDataByVertexId(int vertexId, te::graph::AbstractGraph* g, te::graph::GraphCache* gc = 0) = 0;
81
82 /*!
83 \brief Functio used to load a group of edges elements given a base element
84
85 \param edgeId Attribute used to identify the base element
86
87 \param g Pointer to a graph, parent of this element
88
89 \param gc This is a optional attribute, if present the cache will be check if the already been loaded
90
91 */
92 virtual void loadDataByEdgeId(int edgeId, te::graph::AbstractGraph* g, te::graph::GraphCache* gc = 0) = 0;
93
94 /*!
95 \brief Save the graph data structure in Data Source
96
97 \param data Pointer to a valid graph data
98
99 */
100 virtual void saveData(GraphData* data);
101
102 /*!
103 \brief Function used to remove a edge saved in a data source
104
105 \param id The edge identifier
106
107 */
108 virtual void removeEdge(int id);
109
110 /*!
111 \brief Function used to remove a vertex saved in a data source
112
113 \param id The vertex identifier
114
115 */
116 virtual void removeVertex(int id);
117
118 /*!
119 \brief It returns a pointer to a class that describes the graph metadata
120
121 \return A valid pointer if exists and null pointer in other case
122 */
124
125 protected:
126
127 /*!
128 \brief Used to save the edge elements from a graph data
129
130 \param data Pointer to a valid graph data
131 */
133
134 /*!
135 \brief Used to save the vertex elements attributes from a graph data
136
137 \param data Pointer to a valid graph data
138 */
140
141 /*!
142 \brief Used to save the vertex elements from a graph data
143
144 \param data Pointer to a valid graph data
145 */
147
148 /*!
149 \brief Used to save the edges elements attributes from a graph data
150
151 \param data Pointer to a valid graph data
152 */
154
155 /*!
156 \brief Function used to load one vertex given a ID
157
158 \param id The vertex identifier
159
160 \note This function is used in case the graph was saved using the vertex list
161
162 \return A valid vertex pointer if the element was found and a null pointer in other case
163 */
165
166 /*!
167 \brief Function used to load one vertex given a ID
168
169 \param id The vertex identifier
170
171 \note This function is used in case the graph was saved using the edge list
172
173 \return A valid vertex pointer if the element was found and a null pointer in other case
174 */
176
177 /*!
178 \brief Function used to load one edge given a ID
179
180 \param id The edge identifier
181
182 \note This function is used in case the graph was saved using the edge list
183
184 \return A valid edge pointer if the element was found and a null pointer in other case
185 */
186 Edge* loadEdge(int id);
187
188 /*!
189 \brief Function used to load one edge given a ID
190
191 \param id The edge identifier
192
193 \note This function is used in case the graph was saved using the vertex list
194
195 \return A valid vertex pointer if the element was found and a null pointer in other case
196 */
198
199 //@}
200
201 protected:
202
203 te::graph::GraphMetadata* m_graphMetadata; //!< Graph metadata attribute
204 };
205 } // end namespace graph
206} // end namespace te
207
208#endif // __TERRALIB_GRAPH_INTERNAL_ABSTRACTGRAPHLOADERSTRATEGY_H
This class define the main functions necessary to save and load the graph data and metadata informati...
void saveEdgeAttributes(GraphData *data)
Used to save the edges elements attributes from a graph data.
Vertex * loadVertexAttrs(int id)
Function used to load one vertex given a ID.
te::graph::GraphMetadata * getMetadata()
It returns a pointer to a class that describes the graph metadata.
virtual void loadDataByEdgeId(int edgeId, te::graph::AbstractGraph *g, te::graph::GraphCache *gc=0)=0
Functio used to load a group of edges elements given a base element.
virtual void removeVertex(int id)
Function used to remove a vertex saved in a data source.
void saveGraphVertexList(GraphData *data)
Used to save the vertex elements from a graph data.
Vertex * loadVertex(int id)
Function used to load one vertex given a ID.
virtual void saveData(GraphData *data)
Save the graph data structure in Data Source.
AbstractGraphLoaderStrategy(te::graph::GraphMetadata *metadata)
Default constructor.
Edge * loadEdgeAttrs(int id)
Function used to load one edge given a ID.
void saveGraphEdgeList(GraphData *data)
Used to save the edge elements from a graph data.
virtual void removeEdge(int id)
Function used to remove a edge saved in a data source.
virtual ~AbstractGraphLoaderStrategy()
Default destructor.
void saveVertexAttributes(GraphData *data)
Used to save the vertex elements attributes from a graph data.
virtual void loadDataByVertexId(int vertexId, te::graph::AbstractGraph *g, te::graph::GraphCache *gc=0)=0
Functio used to load a group of vertex elements given a base element.
Edge * loadEdge(int id)
Function used to load one edge given a ID.
te::graph::GraphMetadata * m_graphMetadata
Graph metadata attribute.
Abstract class used to define the main functions of graph struct. All graph implementations must used...
Definition: AbstractGraph.h:56
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
Definition: Edge.h:59
Class used to manager the graph data elements. This class uses a cache policy to control the elements...
Definition: GraphCache.h:61
This class define a important struct used to group a map of vertex and edges. A flag is used to indic...
Definition: GraphData.h:56
Class used to define the graph metadata informations.
Definition: GraphMetadata.h:57
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