All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AbstractGraphFactory.h
Go to the documentation of this file.
1 /* Copyright (C) 2008-2011 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 AbstractGraphFactory.h
22 
23  \brief This is the abstract factory for Graphs.
24 */
25 
26 #ifndef __TERRALIB_GRAPH_INTERNAL_ABSTRACTGRAPHFACTORY_H
27 #define __TERRALIB_GRAPH_INTERNAL_ABSTRACTGRAPHFACTORY_H
28 
29 // TerraLib
30 #include "../../common/AbstractFactory.h"
31 #include "../graphs/Graph.h"
32 #include "../Config.h"
33 
34 
35 namespace te
36 {
37  namespace graph
38  {
39  //forward declarations
40  class AbstractGraph;
41 
42  /*!
43  \class AbstractGraphFactory
44 
45  \brief This is the abstract factory for Graphs.
46 
47  \sa AbstractGraph
48  */
49  class TEGRAPHEXPORT AbstractGraphFactory : public te::common::AbstractFactory<AbstractGraph, std::string>
50  {
51  public:
52 
53  /*!
54  \brief It creates and returns an empty graph with default graph type.
55 
56  \return An empty graph.
57 
58  \note The caller will take the ownership of the returned pointer.
59  */
60  static AbstractGraph* make();
61 
62  /*!
63  \brief It creates an empty graph with the proper type.
64 
65  \param gType The name of the specific graph type to be used to create the graph.
66 
67  \return An empty graph.
68 
69  \note The caller will take the ownership of the returned pointer.
70  */
71  static AbstractGraph* make(const std::string& gType);
72 
73  /*!
74  \brief It creates a graph with the given parameters using the default graph type.
75 
76  \param dsInfo The necessary information to access the data source.
77  \param gInfo The necessary information to create the graph.
78 
79  \return A new graph.
80 
81  \note The caller will take the ownership of the returned pointer.
82 
83  */
84  static AbstractGraph* make(const std::map<std::string, std::string>& dsInfo, const std::map<std::string, std::string>& gInfo);
85 
86  /*!
87  \brief It creates a graph with the given parameters using the default graph type.
88 
89  \param gType The name of the specific driver to create the raster.
90  \param dsInfo The necessary information to access the data source.
91  \param gInfo The necessary information to create the graph.
92 
93  \return A new graph.
94 
95  \note The caller will take the ownership of the returned pointer.
96 
97  */
98  static AbstractGraph* make(const std::string& gType, const std::map<std::string, std::string>& dsInfo, const std::map<std::string, std::string>& gInfo);
99 
100  /*!
101  \brief It opens a graph with the given parameters and default graph type.
102 
103  \param dsInfo The necessary information to access the data source.
104  \param gInfo The necessary information to create the graph.
105 
106  \return The opened graph.
107 
108  \note The caller will take the ownership of the returned pointer.
109  */
110  static AbstractGraph* open(const std::map<std::string, std::string>& dsInfo, const std::map<std::string, std::string>& gInfo);
111 
112  /*!
113  \brief It creates a graph with the given parameters.
114 
115  \param gType The name of the specific graph type to create the graph.
116  \param dsInfo The necessary information to access the data source.
117  \param gInfo The necessary information to create the graph.
118 
119  \return The opened graph.
120 
121  \note The caller will take the ownership of the returned pointer.
122  */
123  static AbstractGraph* open(const std::string& gType, const std::map<std::string, std::string>& dsInfo, const std::map<std::string, std::string>& gInfo);
124 
125 
126  /*! \brief Destructor. */
128 
129  /*! \brief Returns the type (name) of this factory. */
130  virtual const std::string& getType() const = 0;
131 
132  /*! \brief It returns the list of parameters accepted as graph info. */
133  virtual void getCreationalParameters(std::vector< std::pair<std::string, std::string> >& params) const = 0;
134 
135  protected:
136 
137  /*!
138  \brief Constructor.
139 
140  \param factoryKey The key that identifies the factory.
141  */
142  AbstractGraphFactory(const std::string& factoryKey);
143 
144  /*!
145  \brief This method must be re-implemented by subclasses in order to have a finner control for the graph object instantiation.
146 
147  \param dsInfo The necessary information to access the data source.
148  \param gInfo The necessary information to create the graph.
149 
150  \return A graph.
151 
152  \note The caller will take the ownership of the returned pointer.
153  */
154  virtual AbstractGraph* iOpen(const std::map<std::string, std::string>& dsInfo, const std::map<std::string, std::string>& gInfo) = 0;
155 
156  /*!
157  \brief This method must be implemented by subclasses (graph types).
158 
159  \param dsInfo The necessary information to access the data source.
160  \param gInfo The necessary information to create the graph.
161 
162  \return The new graph.
163 
164  \note The caller will take the ownership of the returned pointer.
165  */
166  virtual AbstractGraph* create(const std::map<std::string, std::string>& dsInfo, const std::map<std::string, std::string>& gInfo) = 0;
167  };
168 
169  } // end namespace graph
170 } // end namespace te
171 
172 #endif // __TERRALIB_GRAPH_INTERNAL_ABSTRACTGRAPHFACTORY_H
This is the abstract factory for Graphs.
Abstract class used to define the main functions of graph struct. All graph implementations must used...
Definition: AbstractGraph.h:56
#define TEGRAPHEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:216
This class defines the interface of abstract factories without initializing parameters.
virtual ~AbstractGraphFactory()
Destructor.