PluginEngineManager.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
3 
4  This file is part of the TerraLib - a Framework for building GIS enabled applications.
5 
6  TerraLib is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published by
8  the Free Software Foundation, either version 3 of the License,
9  or (at your option) any later version.
10 
11  TerraLib is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with TerraLib. See COPYING. If not, write to
18  TerraLib Team at <terralib-team@terralib.org>.
19  */
20 
21 /*!
22  \file terralib/core/plugin/PluginEngineManager.h
23 
24  \brief A singleton that can be used to register plugin engines.
25 
26  \author Gilberto Ribeiro de Queiroz
27  \author Matheus Cavassan Zaglia
28  */
29 
30 #ifndef __TERRALIB_CORE_PLUGIN_PLUGINENGINEMANAGER_H__
31 #define __TERRALIB_CORE_PLUGIN_PLUGINENGINEMANAGER_H__
32 
33 // TerraLib
34 #include "../Config.h"
35 
36 // STL
37 #include <memory>
38 #include <string>
39 
40 namespace te
41 {
42  namespace core
43  {
44 
45 // Forward declaration
46  class AbstractPluginEngine;
47 
48  /*!
49  \class PluginEngineManager
50 
51  \brief A singleton that can be used to register plugin engines.
52  */
54  {
55  public:
56 
57  /*!
58  \brief Register a new plugin engine.
59 
60  \exception InvalidArgumentException It throws an exception if the engine argument is not valid or another
61  engine with the same name is already registered.
62  */
63  void insert(std::unique_ptr<AbstractPluginEngine> engine);
64 
65  /*!
66  \brief Unregister the plugin engine.
67 
68  \exception OutOfRangeException If an engine with the given id is not found.
69  */
70  void remove(const std::string& engine_id);
71 
72  /*!
73  \brief Find a plugin engine with the given id.
74 
75  \exception OutOfRangeException If an engine with the given id is not found.
76  */
77  AbstractPluginEngine& get(const std::string& engine_id) const;
78 
79  /*!
80  \brief Unregister every plugin engine.
81  */
82  void clear();
83 
84  /*! \brief Access the singleton. */
85  static PluginEngineManager& instance();
86 
87  protected:
88 
89  /*! \brief Consructor. */
91 
92  /*! \brief Destructor. */
94 
95  private:
96 
97 // No copy allowed
99  PluginEngineManager& operator=(const PluginEngineManager&);
100 
101  private:
102 
103  struct Impl;
104 
105  Impl* m_pimpl;
106  };
107 
108  } // end namespace plugin
109 } // end namespace te
110 
111 #endif // __TERRALIB_CORE_PLUGIN_PLUGINENGINEMANAGER_H__
A singleton that can be used to register plugin engines.
#define TECOREEXPORT
Definition: Config.h:40
mydialect insert("+", new te::da::BinaryOpEncoder("+"))
URI C++ Library.
The base class for plugin engines.