Plugin.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/Plugin.h
22 
23  \brief A base class for plugin types.
24 */
25 
26 #ifndef __TERRALIB_PLUGIN_INTERNAL_PLUGIN_H
27 #define __TERRALIB_PLUGIN_INTERNAL_PLUGIN_H
28 
29 // TerraLib
30 #include "AbstractPlugin.h"
31 #include "Config.h"
32 #include "PluginInfo.h"
33 
34 namespace te
35 {
36  namespace plugin
37  {
38  /*!
39  \class Plugin
40 
41  \brief A base class for plugin types.
42 
43  This class already provides a default implementation
44  for all plugin methods and some attributes.
45 
46  \ingroup plugin
47 
48  \sa AbstractPlugin, PluginManager, PluginInfo, PluginEngine
49  */
51  {
52  public:
53 
54  const PluginInfo& getInfo() const;
55 
56  bool isStarted() const;
57 
58  /*! \brief Do nothing! Just set plugin as started */
59  virtual void startup();
60 
61  /*! \brief Do nothing! Just set plugin as stopped */
62  virtual void shutdown();
63 
64  /*! \brief Virtual destructor. */
65  virtual ~Plugin();
66 
67  protected:
68 
69  /*!
70  \brief It initializes a new plugin.
71 
72  \param pInfo Basic plugin information.
73  */
74  Plugin(const PluginInfo& pInfo);
75 
76  protected:
77 
78  PluginInfo m_pluginInfo; //!< Information about the plugin.
79  bool m_initialized; //!< A flag that indicates if the plugin was started or not.
80  };
81 
82  /*!
83  \typedef Plugin* (*GetPluginFPtr)(const PluginInfo& info);
84 
85  \brief It exports Plugin's access function type.
86 
87  When you are building a C++ Plugin, you will have to define a special function
88  (that has a special name convention)
89  to be called by TerraLib in order to load your plugin.
90  Please, see the documentation HowTo Create C++ TerraLib Plugins for more information.
91  */
92  typedef Plugin* (*GetPluginFPtr)(const PluginInfo& info);
93 
94  } // end namespace plugin
95 } // end namespace te
96 
97 #endif // __TERRALIB_PLUGIN_INTERNAL_PLUGIN_H
98 
bool m_initialized
A flag that indicates if the plugin was started or not.
Definition: Plugin.h:79
An abstract class for TerraLib Plugins.
Configuration flags for the TerraLib Plugin module.
An abstract class for TerraLib Plugins.
URI C++ Library.
A base class for plugin types.
Definition: Plugin.h:50
PluginInfo m_pluginInfo
Information about the plugin.
Definition: Plugin.h:78
#define TEPLUGINEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:120
The basic information about a plugin.
Definition: PluginInfo.h:61
The basic information about a plugin.