Table of Contents

Interface ISessionObjects

Namespace
RDCore.SDK.Runtime.Abstract.Execution
Assembly
RDCore.SDK.dll

The object lifetime manager of an execution session: creates instances and tracks their roots and reference counts.

public interface ISessionObjects

Methods

AddRef(VBRuntimeObjectId, IBindingHandle)

Records a new reference (root) to an instance.

void AddRef(VBRuntimeObjectId instance, IBindingHandle handle)

Parameters

instance VBRuntimeObjectId
handle IBindingHandle

AttachEventHandlers(VBRuntimeObjectId, VBRuntimeObjectId, Symbol)

Records that variable, a WithEvents variable of subscriber, now holds source, so that the procedures of the subscriber's class that handle events of the variable handle those of the source (MS-VBAL §5.4.3.9).

void AttachEventHandlers(VBRuntimeObjectId source, VBRuntimeObjectId subscriber, Symbol variable)

Parameters

source VBRuntimeObjectId
subscriber VBRuntimeObjectId
variable Symbol

Remarks

A source's handlers are in the order their variables were assigned, so one that is already attached is moved to the end of that order: it is the last to handle an event raised from now on (MS-VBAL §5.4.2.20).

CreateObject()

Creates a new object instance and returns its identity.

VBRuntimeObjectId CreateObject()

Returns

VBRuntimeObjectId

DetachEventHandlers(VBRuntimeObjectId, VBRuntimeObjectId, Symbol)

Records that variable of subscriber no longer holds source: its handlers no longer handle the source's events.

void DetachEventHandlers(VBRuntimeObjectId source, VBRuntimeObjectId subscriber, Symbol variable)

Parameters

source VBRuntimeObjectId
subscriber VBRuntimeObjectId
variable Symbol

DetachSubscriber(VBRuntimeObjectId)

Detaches every handler of subscriber, from every source: it is being destroyed, and nothing of it can handle an event any more.

void DetachSubscriber(VBRuntimeObjectId subscriber)

Parameters

subscriber VBRuntimeObjectId

EventSubscribers(VBRuntimeObjectId)

The subscriptions that handle the events of source, in the order they were attached.

IReadOnlyList<EventSubscription> EventSubscribers(VBRuntimeObjectId source)

Parameters

source VBRuntimeObjectId

Returns

IReadOnlyList<EventSubscription>

IsHeldBy(VBRuntimeObjectId, IBindingHandle)

Whether handle is one of the roots currently holding a reference to an instance.

bool IsHeldBy(VBRuntimeObjectId instance, IBindingHandle handle)

Parameters

instance VBRuntimeObjectId
handle IBindingHandle

Returns

bool

RefCount(VBRuntimeObjectId)

The number of references currently held to an instance; 0 for one that is not live.

int RefCount(VBRuntimeObjectId instance)

Parameters

instance VBRuntimeObjectId

Returns

int

RemoveRef(VBRuntimeObjectId, IBindingHandle)

Drops a reference to an instance and returns the remaining reference count.

int RemoveRef(VBRuntimeObjectId instance, IBindingHandle handle)

Parameters

instance VBRuntimeObjectId
handle IBindingHandle

Returns

int

TryBeginTerminate(VBRuntimeObjectId)

Records that Terminate is about to run for an instance (MS-VBAL §5.3.1.10: at most once during an object's lifetime, however often it becomes a candidate for destruction).

bool TryBeginTerminate(VBRuntimeObjectId instance)

Parameters

instance VBRuntimeObjectId

Returns

bool

true the first time it is asked of a live instance; otherwise false.

TryRemoveObject(VBRuntimeObjectId)

Removes an instance whose reference count has reached zero.

bool TryRemoveObject(VBRuntimeObjectId instance)

Parameters

instance VBRuntimeObjectId

Returns

bool