VTK  9.5.20250715
Public Member Functions | Public Attributes | List of all members
vtkRemoteSession Class Reference

Provides a remote session interface wrapped around vtk.h for managing VTK objects and states in a WebAssembly environment. More...

#include <vtkRemoteSession.h>

Public Member Functions

 vtkRemoteSession ()
 Constructor for vtkRemoteSession initializes the session.
 
 ~vtkRemoteSession ()
 Destructor for vtkRemoteSession cleans up the session.
 
bool RegisterState (emscripten::val state)
 Registers a state with the session.
 
bool UnRegisterState (vtkTypeUInt32 object)
 Unregisters a state associated with a VTK object handle.
 
emscripten::val GetState (vtkTypeUInt32 object)
 Retrieves the state associated with a VTK object handle.
 
void Set (vtkTypeUInt32 object, emscripten::val properties)
 Set properties of a VTKObject.
 
emscripten::val Get (vtkTypeUInt32 object)
 Get all properties of a VTKObject.
 
void SkipProperty (const std::string &className, const std::string &propertyName)
 Skips a property during serialization or deserialization.
 
void UnSkipProperty (const std::string &className, const std::string &propertyName)
 Unskips a previously skipped property.
 
bool RegisterBlob (const std::string &hash, emscripten::val jsArray)
 Registers a binary blob with the session.
 
bool UnRegisterBlob (const std::string &hash)
 Unregisters a binary blob from the session.
 
emscripten::val GetBlob (const std::string &hash)
 Retrieves a binary blob by its hash.
 
emscripten::val Invoke (vtkTypeUInt32 object, const std::string &methodName, emscripten::val args)
 Invokes a method on a VTK object.
 
emscripten::val GetAllDependencies (vtkTypeUInt32 object)
 Retrieves all dependencies of a VTK object.
 
void UpdateObjectFromState (emscripten::val state)
 Updates a VTK object from a given state.
 
void UpdateStateFromObject (vtkTypeUInt32 object)
 Updates the state from a given VTK object.
 
bool SetSize (vtkTypeUInt32 object, int width, int height)
 Sets the size of a VTK object.
 
bool Render (vtkTypeUInt32 object)
 Renders a VTK object.
 
bool ResetCamera (vtkTypeUInt32 object)
 Resets the camera for a VTK object.
 
bool StartEventLoop (vtkTypeUInt32 object)
 Starts an event loop for a VTK object.
 
bool StopEventLoop (vtkTypeUInt32 object)
 Stops an event loop for a VTK object.
 
bool BindRenderWindow (vtkTypeUInt32 object, const std::string canvasSelector)
 Binds a render window to a VTK object.
 
unsigned long Observe (vtkTypeUInt32 object, const std::string &eventName, emscripten::val jsFunction)
 Observes an event on a VTK object.
 
bool UnObserve (vtkTypeUInt32 object, unsigned long tag)
 Removes an observer from a VTK object.
 
void Export (const std::string &fileName)
 Exports states into fileName.states.json and blobs into fileName.blobs.json.
 
void Import (const std::string &stateFileName, const std::string &blobFileName)
 Imports states and blobs from files.
 
void UpdateObjectsFromStates ()
 Updates all VTK objects from their corresponding states.
 
void UpdateStatesFromObjects ()
 Updates all states from their corresponding VTK objects.
 
void PruneUnusedBlobs ()
 Removes unused blobs from the session.
 
void PruneUnusedObjects ()
 Removes unused VTK objects from the session.
 
void PruneUnusedStates ()
 Removes unused states from the session.
 
void Clear ()
 Clears all states, objects, and blobs from the session.
 
std::size_t GetTotalBlobMemoryUsage ()
 Retrieves the total memory usage of all blobs.
 
std::size_t GetTotalVTKDataObjectMemoryUsage ()
 Retrieves the total memory usage of all VTK data objects.
 
void PrintSceneManagerInformation ()
 Prints information about the scene manager.
 
void SetDeserializerLogVerbosity (const std::string &verbosityLevel)
 Sets the verbosity level for the deserializer log.
 
void SetInvokerLogVerbosity (const std::string &verbosityLevel)
 Sets the verbosity level for the invoker log.
 
void SetObjectManagerLogVerbosity (const std::string &verbosityLevel)
 Sets the verbosity level for the object manager log.
 
void SetSerializerLogVerbosity (const std::string &verbosityLevel)
 Sets the verbosity level for the serializer log.
 

Public Attributes

vtkSession Session
 

Detailed Description

Provides a remote session interface wrapped around vtk.h for managing VTK objects and states in a WebAssembly environment.

The vtkRemoteSession class allows interaction with VTK objects and their states in a WebAssembly context. It provides methods for registering, unregistering, and retrieving states and blobs, as well as invoking methods on VTK objects. Additionally, it supports resizing windows, rendering scene, resetting camera, starting/stopping interactor event loops, and retrieving object dependencies. The class also includes utilities for pruning unused resources and importing/exporting states and blobs.

Key features include:

This class is designed to work with Emscripten through JavaScript bindings.

Note
This class is part of the WebAssembly module internals and is not exported for general use.
See also
vtkStandaloneSession

Definition at line 43 of file vtkRemoteSession.h.

Constructor & Destructor Documentation

◆ vtkRemoteSession()

vtkRemoteSession::vtkRemoteSession ( )

Constructor for vtkRemoteSession initializes the session.

◆ ~vtkRemoteSession()

vtkRemoteSession::~vtkRemoteSession ( )

Destructor for vtkRemoteSession cleans up the session.

Member Function Documentation

◆ RegisterState()

bool vtkRemoteSession::RegisterState ( emscripten::val  state)

Registers a state with the session.

Parameters
stateA JavaScript object representing the state to register.
Returns
True if the state was successfully registered, false otherwise.

◆ UnRegisterState()

bool vtkRemoteSession::UnRegisterState ( vtkTypeUInt32  object)

Unregisters a state associated with a VTK object handle.

Parameters
objectThe handle of the VTK object whose state is to be unregistered.
Returns
True if the state was successfully unregistered, false otherwise.

◆ GetState()

emscripten::val vtkRemoteSession::GetState ( vtkTypeUInt32  object)

Retrieves the state associated with a VTK object handle.

Parameters
objectThe handle of the VTK object.
Returns
A JavaScript object representing the state.

◆ Set()

void vtkRemoteSession::Set ( vtkTypeUInt32  object,
emscripten::val  properties 
)

Set properties of a VTKObject.

◆ Get()

emscripten::val vtkRemoteSession::Get ( vtkTypeUInt32  object)

Get all properties of a VTKObject.

◆ SkipProperty()

void vtkRemoteSession::SkipProperty ( const std::string &  className,
const std::string &  propertyName 
)

Skips a property during serialization or deserialization.

Parameters
classNameThe name of the class containing the property.
propertyNameThe name of the property to skip.

◆ UnSkipProperty()

void vtkRemoteSession::UnSkipProperty ( const std::string &  className,
const std::string &  propertyName 
)

Unskips a previously skipped property.

Parameters
classNameThe name of the class containing the property.
propertyNameThe name of the property to unskip.

◆ RegisterBlob()

bool vtkRemoteSession::RegisterBlob ( const std::string &  hash,
emscripten::val  jsArray 
)

Registers a binary blob with the session.

Parameters
hashA unique hash identifying the blob.
jsArrayA JavaScript array containing the blob data.
Returns
True if the blob was successfully registered, false otherwise.

◆ UnRegisterBlob()

bool vtkRemoteSession::UnRegisterBlob ( const std::string &  hash)

Unregisters a binary blob from the session.

Parameters
hashThe unique hash identifying the blob.
Returns
True if the blob was successfully unregistered, false otherwise.

◆ GetBlob()

emscripten::val vtkRemoteSession::GetBlob ( const std::string &  hash)

Retrieves a binary blob by its hash.

Parameters
hashThe unique hash identifying the blob.
Returns
A JavaScript array containing the blob data.

◆ Invoke()

emscripten::val vtkRemoteSession::Invoke ( vtkTypeUInt32  object,
const std::string &  methodName,
emscripten::val  args 
)

Invokes a method on a VTK object.

Parameters
objectThe handle of the VTK object.
methodNameThe name of the method to invoke.
argsA JavaScript object containing the method arguments.
Returns
A JavaScript object representing the result of the method invocation.

◆ GetAllDependencies()

emscripten::val vtkRemoteSession::GetAllDependencies ( vtkTypeUInt32  object)

Retrieves all dependencies of a VTK object.

Parameters
objectThe handle of the VTK object.
Returns
A JavaScript array representing the dependencies.

◆ UpdateObjectFromState()

void vtkRemoteSession::UpdateObjectFromState ( emscripten::val  state)

Updates a VTK object from a given state.

Parameters
stateA JavaScript object representing the state.

◆ UpdateStateFromObject()

void vtkRemoteSession::UpdateStateFromObject ( vtkTypeUInt32  object)

Updates the state from a given VTK object.

Parameters
objectThe handle of the VTK object.

◆ SetSize()

bool vtkRemoteSession::SetSize ( vtkTypeUInt32  object,
int  width,
int  height 
)

Sets the size of a VTK object.

Parameters
objectThe handle of the VTK object.
widthThe desired width.
heightThe desired height.
Returns
True if the size was successfully set, false otherwise.

◆ Render()

bool vtkRemoteSession::Render ( vtkTypeUInt32  object)

Renders a VTK object.

Parameters
objectThe handle of the VTK object.
Returns
True if the rendering was successful, false otherwise.

◆ ResetCamera()

bool vtkRemoteSession::ResetCamera ( vtkTypeUInt32  object)

Resets the camera for a VTK object.

Parameters
objectThe handle of the VTK object.
Returns
True if the camera was successfully reset, false otherwise.

◆ StartEventLoop()

bool vtkRemoteSession::StartEventLoop ( vtkTypeUInt32  object)

Starts an event loop for a VTK object.

Parameters
objectThe handle of the VTK object.
Returns
True if the event loop was successfully started, false otherwise.

◆ StopEventLoop()

bool vtkRemoteSession::StopEventLoop ( vtkTypeUInt32  object)

Stops an event loop for a VTK object.

Parameters
objectThe handle of the VTK object.
Returns
True if the event loop was successfully stopped, false otherwise.

◆ BindRenderWindow()

bool vtkRemoteSession::BindRenderWindow ( vtkTypeUInt32  object,
const std::string  canvasSelector 
)

Binds a render window to a VTK object.

Parameters
objectThe handle of the VTK object.
canvasSelectorThe CSS selector for the canvas element.
Returns
True if the render window was successfully bound, false otherwise.

◆ Observe()

unsigned long vtkRemoteSession::Observe ( vtkTypeUInt32  object,
const std::string &  eventName,
emscripten::val  jsFunction 
)

Observes an event on a VTK object.

Parameters
objectThe handle of the VTK object.
eventNameThe name of the event to observe.
jsFunctionA JavaScript function to call when the event occurs.
Returns
A unique tag identifying the observer.

◆ UnObserve()

bool vtkRemoteSession::UnObserve ( vtkTypeUInt32  object,
unsigned long  tag 
)

Removes an observer from a VTK object.

Parameters
objectThe handle of the VTK object.
tagThe unique tag identifying the observer.
Returns
True if the observer was successfully removed, false otherwise.

◆ Export()

void vtkRemoteSession::Export ( const std::string &  fileName)

Exports states into fileName.states.json and blobs into fileName.blobs.json.

Parameters
fileNameThe name of the file.

◆ Import()

void vtkRemoteSession::Import ( const std::string &  stateFileName,
const std::string &  blobFileName 
)

Imports states and blobs from files.

Parameters
stateFileNameThe name of the file containing the states.
blobFileNameThe name of the file containing the blobs.

◆ UpdateObjectsFromStates()

void vtkRemoteSession::UpdateObjectsFromStates ( )

Updates all VTK objects from their corresponding states.

◆ UpdateStatesFromObjects()

void vtkRemoteSession::UpdateStatesFromObjects ( )

Updates all states from their corresponding VTK objects.

◆ PruneUnusedBlobs()

void vtkRemoteSession::PruneUnusedBlobs ( )

Removes unused blobs from the session.

◆ PruneUnusedObjects()

void vtkRemoteSession::PruneUnusedObjects ( )

Removes unused VTK objects from the session.

◆ PruneUnusedStates()

void vtkRemoteSession::PruneUnusedStates ( )

Removes unused states from the session.

◆ Clear()

void vtkRemoteSession::Clear ( )

Clears all states, objects, and blobs from the session.

◆ GetTotalBlobMemoryUsage()

std::size_t vtkRemoteSession::GetTotalBlobMemoryUsage ( )

Retrieves the total memory usage of all blobs.

Returns
The total memory usage in bytes.

◆ GetTotalVTKDataObjectMemoryUsage()

std::size_t vtkRemoteSession::GetTotalVTKDataObjectMemoryUsage ( )

Retrieves the total memory usage of all VTK data objects.

Returns
The total memory usage in bytes.

◆ PrintSceneManagerInformation()

void vtkRemoteSession::PrintSceneManagerInformation ( )

Prints information about the scene manager.

◆ SetDeserializerLogVerbosity()

void vtkRemoteSession::SetDeserializerLogVerbosity ( const std::string &  verbosityLevel)

Sets the verbosity level for the deserializer log.

Parameters
verbosityLevelThe desired verbosity level.

◆ SetInvokerLogVerbosity()

void vtkRemoteSession::SetInvokerLogVerbosity ( const std::string &  verbosityLevel)

Sets the verbosity level for the invoker log.

Parameters
verbosityLevelThe desired verbosity level.

◆ SetObjectManagerLogVerbosity()

void vtkRemoteSession::SetObjectManagerLogVerbosity ( const std::string &  verbosityLevel)

Sets the verbosity level for the object manager log.

Parameters
verbosityLevelThe desired verbosity level.

◆ SetSerializerLogVerbosity()

void vtkRemoteSession::SetSerializerLogVerbosity ( const std::string &  verbosityLevel)

Sets the verbosity level for the serializer log.

Parameters
verbosityLevelThe desired verbosity level.

Member Data Documentation

◆ Session

vtkSession vtkRemoteSession::Session

Definition at line 300 of file vtkRemoteSession.h.


The documentation for this class was generated from the following file: