src/terralib/binding/v8/plugin/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 CppPlugin.h
22 
23  \brief A class that handles JavaScript Plugins using Google's V8 engine.
24  */
25 
26 #ifndef __TERRALIB_BINDING_V8_PLUGIN_INTERNAL_PLUGIN_H
27 #define __TERRALIB_BINDING_V8_PLUGIN_INTERNAL_PLUGIN_H
28 
29 // TerraLib
30 #include "../../../plugin/Plugin.h"
31 #include "Config.h"
32 
33 // Google V8
34 #include <v8.h>
35 
36 namespace te
37 {
38  namespace v8
39  {
40 // Forward declaration
41  namespace common { class JsContext; }
42 
43  namespace plugin
44  {
45  /*!
46  \class Plugin
47 
48  \brief A class that handles JavaScript Plugins using Google's V8 engine.
49 
50  \sa te::plugin::Plugin, te::plugin::PluginEngine, te::java::PluginEngine, te::plugin::PluginEngineFactory, te::v8::PluginEngineFactory
51  */
53  {
54  public:
55 
56  /*!
57  \brief It creates a new Java plugin.
58 
59  \param pInfo Basic plugin information.
60  */
61  Plugin(const te::plugin::PluginInfo& pInfo);
62 
63  /*! \brief Destructor. */
64  ~Plugin();
65 
66  void startup() throw(...) ;
67 
68  void shutdown() throw(...) ;
69 
70  private:
71 
72  te::v8::common::JsContext* m_ctx; //!< The context used to run this plugin. (note: the manager is the owner of this context!)
73  ::v8::Persistent<::v8::Function> m_jspluginFtor; //!< A reference to plugin's class constructor function.
74  ::v8::Persistent<::v8::Object> m_jsplugin; //!< A reference to an instance of the plugin.
75  ::v8::Persistent<::v8::Function> m_startup; //!< A reference to plugin startup method.
76  ::v8::Persistent<::v8::Function> m_shutdown; //!< A reference to plugin shutdown method.
77 
78  friend class PluginEngine;
79  };
80 
81  } // end namespace plugin
82  } // end namespace v8
83 } // end namespace te
84 
85 #endif // __TERRALIB_BINDING_V8_PLUGIN_INTERNAL_PLUGIN_H
86 
::v8::Persistent<::v8::Function > m_jspluginFtor
A reference to plugin&#39;s class constructor function.
A plugin engine for plugins written in JavaScript using Google&#39;s V8 engine.
Definition: PluginEngine.h:46
A class for keeping reference to a persistent context.
Definition: JsContext.h:54
::v8::Persistent<::v8::Function > m_startup
A reference to plugin startup method.
URI C++ Library.
Definition: Attributes.h:37
#define TEV8PLUGINEXPORT
You can use this macro in order to export/import classes and functions from this module.
A base class for plugin types.
::v8::Persistent<::v8::Function > m_shutdown
A reference to plugin shutdown method.
te::v8::common::JsContext * m_ctx
The context used to run this plugin. (note: the manager is the owner of this context!) ...
The basic information about a plugin.
::v8::Persistent<::v8::Object > m_jsplugin
A reference to an instance of the plugin.
A class that handles JavaScript Plugins using Google&#39;s V8 engine.