VTK  9.5.20250718
vtkRemoteSession.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3
30#ifndef vtkRemoteSession_h
31#define vtkRemoteSession_h
32
33#include "vtkType.h" // for vtkTypeUInt32
34#include "vtkWebAssemblySessionModule.h" // for no export macro
35
36#include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_5_0
37
38#include <emscripten/val.h> // for emscripten::val
39
40VTK_ABI_NAMESPACE_BEGIN
41
42typedef struct vtkSessionImpl* vtkSession;
43class VTKWEBASSEMBLYSESSION_EXPORT vtkRemoteSession
44{
45public:
50
55
61 bool RegisterState(emscripten::val state);
62
68 bool UnRegisterState(vtkTypeUInt32 object);
69
75 VTK_DEPRECATED_IN_9_5_0("Use vtkRemoteSession::Get(vtkTypeUInt32 object) instead.")
76 emscripten::val GetState(vtkTypeUInt32 object);
77
81 void Set(vtkTypeUInt32 object, emscripten::val properties);
82
86 emscripten::val Get(vtkTypeUInt32 object);
87
93 void SkipProperty(const std::string& className, const std::string& propertyName);
94
100 void UnSkipProperty(const std::string& className, const std::string& propertyName);
101
108 bool RegisterBlob(const std::string& hash, emscripten::val jsArray);
109
115 bool UnRegisterBlob(const std::string& hash);
116
122 emscripten::val GetBlob(const std::string& hash);
123
131 emscripten::val Invoke(vtkTypeUInt32 object, const std::string& methodName, emscripten::val args);
132
138 emscripten::val GetAllDependencies(vtkTypeUInt32 object);
139
144 void UpdateObjectFromState(emscripten::val state);
145
150 void UpdateStateFromObject(vtkTypeUInt32 object);
151
159 bool SetSize(vtkTypeUInt32 object, int width, int height);
160
166 bool Render(vtkTypeUInt32 object);
167
173 bool ResetCamera(vtkTypeUInt32 object);
174
180 bool StartEventLoop(vtkTypeUInt32 object);
181
187 bool StopEventLoop(vtkTypeUInt32 object);
188
195 bool BindRenderWindow(vtkTypeUInt32 object, const std::string canvasSelector);
196
204 unsigned long Observe(
205 vtkTypeUInt32 object, const std::string& eventName, emscripten::val jsFunction);
206
213 bool UnObserve(vtkTypeUInt32 object, unsigned long tag);
214
220 void Export(const std::string& fileName);
221
227 void Import(const std::string& stateFileName, const std::string& blobFileName);
228
232 void UpdateObjectsFromStates();
233
237 void UpdateStatesFromObjects();
238
242 void PruneUnusedBlobs();
243
247 void PruneUnusedObjects();
248
252 void PruneUnusedStates();
253
257 void Clear();
258
263 std::size_t GetTotalBlobMemoryUsage();
264
269 std::size_t GetTotalVTKDataObjectMemoryUsage();
270
274 void PrintSceneManagerInformation();
275
280 void SetDeserializerLogVerbosity(const std::string& verbosityLevel);
281
286 void SetInvokerLogVerbosity(const std::string& verbosityLevel);
287
292 void SetObjectManagerLogVerbosity(const std::string& verbosityLevel);
293
298 void SetSerializerLogVerbosity(const std::string& verbosityLevel);
299
300 vtkSession Session;
301};
302
303VTK_ABI_NAMESPACE_END
304#endif
Provides a remote session interface wrapped around vtk.h for managing VTK objects and states in a Web...
bool RegisterState(emscripten::val state)
Registers a state with the session.
~vtkRemoteSession()
Destructor for vtkRemoteSession cleans up the session.
vtkRemoteSession()
Constructor for vtkRemoteSession initializes the session.
bool UnRegisterState(vtkTypeUInt32 object)
Unregisters a state associated with a VTK object handle.
#define VTK_DEPRECATED_IN_9_5_0(reason)
struct vtkSessionImpl * vtkSession