Ocean
JSSceneDescriptionManager.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_INTERACTION_JS_SCENE_DESCRIPTION_MANAGER_H
9 #define META_OCEAN_INTERACTION_JS_SCENE_DESCRIPTION_MANAGER_H
10 
13 
14 namespace Ocean
15 {
16 
17 namespace Interaction
18 {
19 
20 namespace JavaScript
21 {
22 
23 /**
24  * This class implements a wrapper for a JavaScript SceneDescriptionManager object.
25  * @ingroup interactionjs
26  */
27 class OCEAN_INTERACTION_JS_EXPORT JSSceneDescriptionManager : public JSBase
28 {
29  friend class JSLibrary;
30 
31  public:
32 
33  /**
34  * Returns the JavaScript name of this object.
35  * @return The object's JavaScript name
36  */
37  static inline const char* objectName();
38 
39  /**
40  * Returns the object template for this object.
41  * @return The object template
42  */
43  static inline v8::Local<v8::ObjectTemplate> objectTemplate();
44 
45  /**
46  * Releases the function and object template for this object.
47  */
48  static void release();
49 
50  protected:
51 
52  /**
53  * Creates the function object template for this object.
54  */
55  static void createObjectTemplate();
56 
57  /**
58  * Callback function for 'findNode()' function.
59  * @param info The function callback info
60  */
61  static void functionFindNode(const v8::FunctionCallbackInfo<v8::Value>& info);
62 
63  /**
64  * Callback function for 'findNodes()' function.
65  * @param info The function callback info
66  */
67  static void functionFindNodes(const v8::FunctionCallbackInfo<v8::Value>& info);
68 
69  /**
70  * Callback function for 'libraries()' function.
71  * @param info The function callback info
72  */
73  static void functionLibraries(const v8::FunctionCallbackInfo<v8::Value>& info);
74 
75  protected:
76 
77  /// Object template for the Vector2 object.
78  static v8::Persistent<v8::ObjectTemplate> objectTemplate_;
79 };
80 
82 {
83  return "SceneDescriptionManager";
84 }
85 
86 inline v8::Local<v8::ObjectTemplate> JSSceneDescriptionManager::objectTemplate()
87 {
88  if (objectTemplate_.IsEmpty())
89  {
91  }
92 
93  ocean_assert(objectTemplate_.IsEmpty() == false);
94  return objectTemplate_.Get(v8::Isolate::GetCurrent());
95 }
96 
98 {
99  ocean_assert(!objectTemplate_.IsEmpty());
100  objectTemplate_.Reset();
101 }
102 
103 }
104 
105 }
106 
107 }
108 
109 #endif // META_OCEAN_INTERACTION_JS_SCENE_DESCRIPTION_MANAGER_H
This class implements the base class for all JavaScript wrappers.
Definition: JSBase.h:34
This class implements the java script interaction library object.
Definition: JSLibrary.h:32
This class implements a wrapper for a JavaScript SceneDescriptionManager object.
Definition: JSSceneDescriptionManager.h:28
static v8::Local< v8::ObjectTemplate > objectTemplate()
Returns the object template for this object.
Definition: JSSceneDescriptionManager.h:86
static void functionFindNodes(const v8::FunctionCallbackInfo< v8::Value > &info)
Callback function for 'findNodes()' function.
static void functionLibraries(const v8::FunctionCallbackInfo< v8::Value > &info)
Callback function for 'libraries()' function.
static const char * objectName()
Returns the JavaScript name of this object.
Definition: JSSceneDescriptionManager.h:81
static v8::Persistent< v8::ObjectTemplate > objectTemplate_
Object template for the Vector2 object.
Definition: JSSceneDescriptionManager.h:78
static void release()
Releases the function and object template for this object.
Definition: JSSceneDescriptionManager.h:97
static void functionFindNode(const v8::FunctionCallbackInfo< v8::Value > &info)
Callback function for 'findNode()' function.
static void createObjectTemplate()
Creates the function object template for this object.
void release(T *object)
This functions allows to release a DirectShow object if it does exist.
Definition: DSObject.h:266
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15