class
IScriptObjectWrapper
Provides interoperability between a native object and a script object.
This interface in particular is responsible for tracking their lifetimes:
- If the script object goes out of scope, the native object might be released if nothing else is referencing it.
- If the native object goes out of scope, this wrapper will be notified so it may either destroy the script object or safely fail method calls that try to use it in script.
It is expected each native class exported to script will implement its own version of the script object wrapper, which would provide
methods to create the script object, and allow the script object to call methods and access data on the native object.
Public
Constructors
IScriptObjectWrapper
IScriptObjectWrapper(IScriptExportable *nativeObject)
Methods
~IScriptObjectWrapper
virtual ~IScriptObjectWrapper() noexcept = default
GetNativeObject
IScriptExportable *GetNativeObject() const
Returns the native object that is linked to the script object managed by the wrapper.
NotifyNativeObjectDestroyed
virtual void NotifyNativeObjectDestroyed()
Notifies the wrapper that the native object it is managing is about to be destroyed.
NotifyScriptObjectDestroyed
virtual void NotifyScriptObjectDestroyed(bool isDestroyedDueToScriptReload)
Notifies the wrapper that the script object is about to be destroyed.
Protected
Fields
mNativeObject
IScriptExportable * mNativeObject