FunctionCatalog.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/FunctionCatalog.h
22 
23  \brief A FunctionCatalog can be used to keep track of registered functions.
24 */
25 
26 #ifndef __TERRALIB_DATAACCESS_INTERNAL_FUNCTIONCATALOG_H
27 #define __TERRALIB_DATAACCESS_INTERNAL_FUNCTIONCATALOG_H
28 
29 // TerraLib
30 #include "../Config.h"
31 
32 // STL
33 #include <map>
34 #include <string>
35 #include <vector>
36 
37 // Boost
38 #include <boost/noncopyable.hpp>
39 
40 namespace te
41 {
42  namespace da
43  {
44 // Forward declarations
45  class FunctionDefn;
46 
47  /*!
48  \class FunctionCatalog
49 
50  \brief A FunctionCatalog can be used to keep track of registered functions.
51 
52  \sa FunctionDefn, FunctionCatalogManager
53  */
54  class TEDATAACCESSEXPORT FunctionCatalog : public boost::noncopyable
55  {
56  public:
57 
58  /*!
59  \brief Constructor.
60 
61  \param name The parameter name.
62  \param t The parameter type.
63  */
65 
66  /*! \brief Destructor. */
67  ~FunctionCatalog();
68 
69  /*!
70  \brief It inserts the function into the catalog.
71 
72  \param fdfn The function definition. The catalog will take the ownership of the given pointer.
73  */
74  void insert(FunctionDefn* fdfn);
75 
76  /*!
77  \brief It finds the function with the given name.
78 
79  \param functionName The function name you are looking information for.
80 
81  \return The list of functions with the given name. Remember, a function name may be overloaded. If none is found, return NULL.
82 
83  \note Don't delete the returned pointer, it belongs to the catalog!
84  */
85  std::vector<FunctionDefn*>* find(const std::string& functionName) const;
86 
87  private:
88 
89  std::map<std::string, std::vector<FunctionDefn*>* > m_fMap; //!< Function map: function-name -> std::vector<FunctionDef*>*.
90  };
91 
92  } // end namespace da
93 } // end namespace te
94 
95 #endif // __TERRALIB_DATAACCESS_INTERNAL_FUNCTIONCATALOG_H
96 
97 
mydialect insert("+", new te::da::BinaryOpEncoder("+"))
URI C++ Library.
FunctionCatalog()
Constructor.
#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.
The definition of a function that can be used in a query object.
Definition: FunctionDefn.h:56
std::map< std::string, std::vector< FunctionDefn * > * > m_fMap
Function map: function-name -> std::vector*.