AbstractPluginEngine.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/plugin/AbstractPluginEngine.h
22 
23  \brief An abstract class for plugin engines.
24 */
25 
26 #ifndef __TERRALIB_PLUGIN_INTERNAL_ABSTRACTPLUGINENGINE_H
27 #define __TERRALIB_PLUGIN_INTERNAL_ABSTRACTPLUGINENGINE_H
28 
29 // Boost
30 #include <boost/noncopyable.hpp>
31 
32 namespace te
33 {
34  namespace plugin
35  {
36 // Forward declaration
37  class AbstractPlugin;
38 
39  struct PluginInfo;
40 
41  /*!
42  \class CppPluginEngine
43 
44  \brief An abstract class for plugin engines.
45 
46  For each kind of programming language there will be
47  an specific engine capable of loading and preparing the
48  plugin before the startup method is called.
49 
50  \ingroup plugin,
51 
52  \sa Plugin, PluginInfo, PluginEngineFactory, CppPluginEngine
53  */
54  class AbstractPluginEngine : public boost::noncopyable
55  {
56  public:
57 
58  /*! Default construtor. */
60 
61  /*! \brief Virtual destructor. */
62  virtual ~AbstractPluginEngine() { }
63 
64  /*!
65  \brief It try to create and load the informed plugin.
66 
67  \param pInfo The information needed to create and load the plugin.
68 
69  \return It returns a loaded plugin. The caller will take the ownership of the returned plugin.
70 
71  \exception Exception It throws an exception if the plugin can not be loaded.
72 
73  \note If the parameter PluginInfo::m_folder does not contains the required plugin it may be searched and loaded using a set of default paths.
74  */
75  virtual AbstractPlugin* load(const PluginInfo& pInfo) = 0;
76 
77  /*!
78  \brief It try to unload the informed plugin.
79 
80  On success the informed plugin will be also destroyed
81  and its pointer will be invalidated.
82 
83  \param plugin The plugin to be unloaded.
84 
85  \exception Exception It throws an exception if the plugin can not be unloaded.
86  */
87  virtual void unload(AbstractPlugin* plugin) = 0;
88  };
89 
90  } // end namespace plugin
91 } // end namespace te
92 
93 #endif // __TERRALIB_PLUGIN_INTERNAL_ABSTRACTPLUGINENGINE_H
94 
An abstract class for TerraLib Plugins.
URI C++ Library.
virtual void unload(AbstractPlugin *plugin)=0
It try to unload the informed plugin.
virtual AbstractPlugin * load(const PluginInfo &pInfo)=0
It try to create and load the informed plugin.
virtual ~AbstractPluginEngine()
Virtual destructor.
The basic information about a plugin.
Definition: PluginInfo.h:61