Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Handle<T>

Shared handle to an observable

All copies of an instance of this class refer to the same observable by means of a relinkable smart pointer. When such pointer is relinked to another observable, the change will be propagated to all the copies.

Class T must inherit from Observable

Type parameters

Hierarchy

Implements

Index

Classes

Constructors

Properties

Methods

Constructors

constructor

  • new Handle(p?: T, registerAsObserver?: boolean): Handle
  • Constructors

    warning registerAsObserver is left as a backdoor in case the programmer cannot guarantee that the object pointed to will remain alive for the whole lifetime of the handle---namely, it should be set to false when the passed shared pointer does not own the pointee (this should only happen in a controlled environment, so that the programmer is aware of it). Failure to do so can very likely result in a program crash. If the programmer does want the handle to register as observer of such a shared pointer, it is his responsibility to ensure that the handle gets destroyed before the pointed object does.

    Parameters

    • Default value p: T = null
    • Default value registerAsObserver: boolean = true

    Returns Handle

Properties

Protected _link

_link: Link<T>

Methods

currentLink

  • currentLink(): T
  • dereferencing

    Returns T

empty

  • empty(): boolean
  • checks if the contained shared pointer points to anything

    Returns boolean

f

  • allows registration as observable

    Returns Link<T>