JsContext.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 JsContext.h
22 
23  \brief A class for keeping reference to a persistent context.
24  */
25 
26 #ifndef __TERRALIB_BINDING_V8_COMMON_INTERNAL_JSCONTEXT_H
27 #define __TERRALIB_BINDING_V8_COMMON_INTERNAL_JVM_H
28 
29 // TerraLib
30 #include "Config.h"
31 
32 // Google V8
33 #include <v8.h>
34 
35 namespace te
36 {
37  namespace v8
38  {
39  namespace common
40  {
41  /*!
42  \class JsContext
43 
44  \brief A class for keeping reference to a persistent context.
45 
46  As stated in the Google's V8 JavaScript Engine, a context is
47  an executiion environment that allows separate, unrelated, JavaScript applications
48  to run in a single instance of V8.
49 
50  In TerraLib, several plugins can use the same context.
51 
52  \sa JsContextManager
53  */
55  {
56  public:
57 
58  /*! \brief Default constructor. */
59  JsContext();
60 
61  /*! \brief Destructor. */
62  ~JsContext();
63 
64  ::v8::Persistent<::v8::Context> getCtx() const
65  {
66  return m_ctx;
67  }
68 
69  private:
70 
71  /*!
72  \brief Copy constructor not allowed.
73 
74  \param rhs The right-hand-side copy that would be used to copy from.
75  */
76  JsContext(const JsContext& rhs);
77 
78  /*!
79  \brief Assignment operator not allowed.
80 
81  \param rhs The right-hand-side copy that would be used to copy from.
82 
83  \return A reference to this.
84  */
85  JsContext& operator=(const JsContext& rhs);
86 
87  private:
88 
89  ::v8::Persistent<::v8::Context> m_ctx ; //!< The context to run JavaScript code.
90  };
91 
92  } // end namespace common
93  } // end namespace v8
94 } // end namespace te
95 
96 #endif // __TERRALIB_BINDING_V8_COMMON_INTERNAL_JSCONTEXT_H
::v8::Persistent<::v8::Context > getCtx() const
Definition: JsContext.h:64
A class for keeping reference to a persistent context.
Definition: JsContext.h:54
#define TEV8COMMONEXPORT
You can use this macro in order to export/import classes and functions from this module.
URI C++ Library.
Definition: Attributes.h:37
::v8::Persistent<::v8::Context > m_ctx
The context to run JavaScript code.
Definition: JsContext.h:89