VTK  9.6.20260206
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
29
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 <emscripten/val.h> // for emscripten::val
37
38VTK_ABI_NAMESPACE_BEGIN
39
40typedef struct vtkSessionImpl* vtkSession;
41class VTKWEBASSEMBLYSESSION_EXPORT vtkRemoteSession
42{
43public:
48
53
59 bool RegisterState(emscripten::val state);
60
66 bool UnRegisterState(vtkTypeUInt32 object);
67
74 bool Set(vtkTypeUInt32 object, emscripten::val properties);
75
81 emscripten::val Get(vtkTypeUInt32 object);
82
88 void SkipProperty(const std::string& className, const std::string& propertyName);
89
95 void UnSkipProperty(const std::string& className, const std::string& propertyName);
96
103 bool RegisterBlob(const std::string& hash, emscripten::val jsArray);
104
110 bool UnRegisterBlob(const std::string& hash);
111
117 emscripten::val GetBlob(const std::string& hash);
118
126 emscripten::val Invoke(vtkTypeUInt32 object, const std::string& methodName, emscripten::val args);
127
133 emscripten::val GetAllDependencies(vtkTypeUInt32 object);
134
140 bool UpdateObjectFromState(emscripten::val state);
141
146 void UpdateStateFromObject(vtkTypeUInt32 object);
147
155 bool SetSize(vtkTypeUInt32 object, int width, int height);
156
162 bool Render(vtkTypeUInt32 object);
163
169 bool ResetCamera(vtkTypeUInt32 object);
170
176 bool StartEventLoop(vtkTypeUInt32 object);
177
183 bool StopEventLoop(vtkTypeUInt32 object);
184
191 bool BindRenderWindow(vtkTypeUInt32 object, const std::string canvasSelector);
192
200 unsigned long Observe(
201 vtkTypeUInt32 object, const std::string& eventName, emscripten::val jsFunction);
202
209 bool UnObserve(vtkTypeUInt32 object, unsigned long tag);
210
216 void Export(const std::string& fileName);
217
223 void Import(const std::string& stateFileName, const std::string& blobFileName);
224
229
234
239
244
249
253 void Clear();
254
260
266
271
276 void SetDeserializerLogVerbosity(const std::string& verbosityLevel);
277
282 void SetInvokerLogVerbosity(const std::string& verbosityLevel);
283
288 void SetObjectManagerLogVerbosity(const std::string& verbosityLevel);
289
294 void SetSerializerLogVerbosity(const std::string& verbosityLevel);
295
297};
298
299VTK_ABI_NAMESPACE_END
300#endif
emscripten::val GetAllDependencies(vtkTypeUInt32 object)
Retrieves all dependencies of a VTK object.
bool SetSize(vtkTypeUInt32 object, int width, int height)
Sets the size of a VTK object.
bool UnRegisterBlob(const std::string &hash)
Unregisters a binary blob from the session.
bool UpdateObjectFromState(emscripten::val state)
Updates a VTK object from a given state.
bool Render(vtkTypeUInt32 object)
Renders a VTK object.
bool RegisterState(emscripten::val state)
Registers a state with the session.
emscripten::val GetBlob(const std::string &hash)
Retrieves a binary blob by its hash.
bool UnObserve(vtkTypeUInt32 object, unsigned long tag)
Removes an observer from a VTK object.
void PrintSceneManagerInformation()
Prints information about the scene manager.
void SetInvokerLogVerbosity(const std::string &verbosityLevel)
Sets the verbosity level for the invoker log.
std::size_t GetTotalBlobMemoryUsage()
Retrieves the total memory usage of all blobs.
~vtkRemoteSession()
Destructor for vtkRemoteSession cleans up the session.
void SetDeserializerLogVerbosity(const std::string &verbosityLevel)
Sets the verbosity level for the deserializer log.
bool StartEventLoop(vtkTypeUInt32 object)
Starts an event loop for a VTK object.
void Export(const std::string &fileName)
Exports states into fileName.states.json and blobs into fileName.blobs.json.
void PruneUnusedStates()
Removes unused states from the session.
std::size_t GetTotalVTKDataObjectMemoryUsage()
Retrieves the total memory usage of all VTK data objects.
vtkRemoteSession()
Constructor for vtkRemoteSession initializes the session.
bool ResetCamera(vtkTypeUInt32 object)
Resets the camera for a VTK object.
void UpdateObjectsFromStates()
Updates all VTK objects from their corresponding states.
bool Set(vtkTypeUInt32 object, emscripten::val properties)
Set properties of a VTKObject.
void Clear()
Clears all states, objects, and blobs from the session.
void UnSkipProperty(const std::string &className, const std::string &propertyName)
Unskips a previously skipped property.
emscripten::val Invoke(vtkTypeUInt32 object, const std::string &methodName, emscripten::val args)
Invokes a method on a VTK object.
unsigned long Observe(vtkTypeUInt32 object, const std::string &eventName, emscripten::val jsFunction)
Observes an event on a VTK object.
void PruneUnusedObjects()
Removes unused VTK objects from the session.
void Import(const std::string &stateFileName, const std::string &blobFileName)
Imports states and blobs from files.
void UpdateStatesFromObjects()
Updates all states from their corresponding VTK objects.
void SetSerializerLogVerbosity(const std::string &verbosityLevel)
Sets the verbosity level for the serializer log.
void UpdateStateFromObject(vtkTypeUInt32 object)
Updates the state from a given VTK object.
void SkipProperty(const std::string &className, const std::string &propertyName)
Skips a property during serialization or deserialization.
bool StopEventLoop(vtkTypeUInt32 object)
Stops an event loop for a VTK object.
emscripten::val Get(vtkTypeUInt32 object)
Get all properties of a VTKObject.
bool UnRegisterState(vtkTypeUInt32 object)
Unregisters a state associated with a VTK object handle.
bool BindRenderWindow(vtkTypeUInt32 object, const std::string canvasSelector)
Binds a render window to a VTK object.
void PruneUnusedBlobs()
Removes unused blobs from the session.
void SetObjectManagerLogVerbosity(const std::string &verbosityLevel)
Sets the verbosity level for the object manager log.
bool RegisterBlob(const std::string &hash, emscripten::val jsArray)
Registers a binary blob with the session.
struct vtkSessionImpl * vtkSession
struct vtkSessionImpl * vtkSession
Definition vtkSession.h:91