AbstractPluginEngine.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/AbstractPluginEngine.h
23 
24  \brief The base class for plugin engines.
25 
26  \author Gilberto Ribeiro de Queiroz
27  \author Matheus Cavassan Zaglia
28  */
29 
30 #ifndef __TERRALIB_CORE_PLUGIN_ABSTRACTPLUGINENGINE_H__
31 #define __TERRALIB_CORE_PLUGIN_ABSTRACTPLUGINENGINE_H__
32 
33 // TerraLib
34 #include "../Config.h"
35 #include "PluginInfo.h"
36 
37 // STL
38 #include <memory>
39 #include <string>
40 
41 namespace te
42 {
43  namespace core
44  {
45 
46 // Forward declaration
47  class AbstractPlugin;
48 
49  /*!
50  \class AbstractPluginEngine
51 
52  \brief The base class for plugin engines.
53  */
55  {
56  public:
57 
58  /*! \brief Default construtor. */
60 
61  /*! \brief Virtual destructor. */
62  virtual ~AbstractPluginEngine() = default;
63 
64  /*! \brief Every plugin engine must have a unique identifier. */
65  virtual const std::string& id() const = 0;
66 
67  /*! \brief The name of plugin engine with a brief title or description. */
68  virtual const std::string& name() const = 0;
69 
70  /*!
71  \brief Load the informed plugin.
72 
73  \param pinfo Information about the plugin to be loaded.
74 
75  \exception PluginEngineLoadException If the plugin can not be loaded.
76  */
77  virtual std::unique_ptr<AbstractPlugin> load(const PluginInfo& pinfo) = 0;
78 
79  /*!
80  \brief Unload the informed plugin.
81 
82  On success the informed plugin will be also destroyed
83  and its pointer will be invalidated.
84 
85  \exception PluginEngineUnloadException It may throws an exception.
86  */
87  virtual void unload(std::unique_ptr<AbstractPlugin> plugin) = 0;
88 
89  private:
90 
91 // no copy allowed
94  };
95 
96  } // end namespace core
97 } // end namespace te
98 
99 #endif // __TERRALIB_CORE_PLUGIN_ABSTRACTPLUGINENGINE_H__
Basic information about a plugin.
Definition: PluginInfo.h:63
virtual std::unique_ptr< AbstractPlugin > load(const PluginInfo &pinfo)=0
Load the informed plugin.
virtual ~AbstractPluginEngine()=default
Virtual destructor.
URI C++ Library.
The base class for plugin engines.
virtual void unload(std::unique_ptr< AbstractPlugin > plugin)=0
Unload the informed plugin.
virtual const std::string & id() const =0
Every plugin engine must have a unique identifier.
AbstractPluginEngine()
Default construtor.
The basic information about a plugin.
virtual const std::string & name() const =0
The name of plugin engine with a brief title or description.
AbstractPluginEngine & operator=(const AbstractPluginEngine &)