FunctionCatalogManager.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 terralib/dataaccess/query/FunctionCatalogManager.h
22 
23  \brief A FunctionCatalogManager is a singleton that can be used to manage function catalogs of data source implementations.
24 */
25 
26 #ifndef __TERRALIB_DATAACCESS_INTERNAL_FUNCTIONCATALOGMANAGER_H
27 #define __TERRALIB_DATAACCESS_INTERNAL_FUNCTIONCATALOGMANAGER_H
28 
29 // TerraLib
30 #include "../../common/Singleton.h"
31 #include "../Config.h"
32 
33 // STL
34 #include <map>
35 #include <string>
36 
37 namespace te
38 {
39  namespace da
40  {
41 // Forward declarations
42  class FunctionCatalog;
43 
44  /*!
45  \class FunctionCatalogManager
46 
47  \brief A FunctionCatalogManager is a singleton that can be used to manage function catalogs of data source implementations.
48 
49  Each data source implementation must register its function catalog
50  in this singleton. This can be achieved by providing the data source
51  identification token (a string) and its catalog.
52 
53  \sa FunctionCatalog
54  */
55  class TEDATAACCESSEXPORT FunctionCatalogManager : public te::common::Singleton<FunctionCatalogManager>
56  {
58 
59  public:
60 
61  /*! \brief Destructor. */
63 
64  /*!
65  \brief It inserts the function catalog associated to the given data source type.
66 
67  \param dsType The type of data source.
68  \param fcatalog The function catalog. The manager will take the ownership of the given function catalog.
69 
70  \exception Exception It throws an exception if a catalog is already registered for the given data source type.
71  */
72  void insert(const std::string& dsType, FunctionCatalog* fcatalog);
73 
74  /*!
75  \brief It finds the function catalog with the given data source type.
76 
77  \param dsType The data source type.
78 
79  \return The catalog fr the given data source type.
80 
81  \note Don't delete the returned pointer, it belongs to the manager!
82  */
83  FunctionCatalog* find(const std::string& dsType);
84 
85  protected:
86 
87  /*! \brief No constructor available for clients. */
89 
90  private:
91 
92  std::map<std::string, FunctionCatalog*> m_fcatalogMap; //!< Function map: datasource-type -> FunctionCatalog*.
93  };
94 
95  } // end namespace da
96 } // end namespace te
97 
98 #endif // __TERRALIB_DATAACCESS_INTERNAL_FUNCTIONCATALOGMANAGER_H
99 
100 
A FunctionCatalogManager is a singleton that can be used to manage function catalogs of data source i...
FunctionCatalogManager()
No constructor available for clients.
std::map< std::string, FunctionCatalog * > m_fcatalogMap
Function map: datasource-type -> FunctionCatalog*.
mydialect insert("+", new te::da::BinaryOpEncoder("+"))
URI C++ Library.
#define TEDATAACCESSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:97
A FunctionCatalog can be used to keep track of registered functions.
Template support for singleton pattern.
Definition: Singleton.h:100