Class VMSlot

VM Interface for message oriented programming operations.

class VMSlot( name )

more...

Summary

initVM Interface for message oriented programming operations.
assert()Creates a message assertion on this certain message slot.
broadcast()Performs broadcast on this slot.
first()Gets an iterator to the first subscriber.
getAssert()Gets the item asserted for this slot.
last()Gets an iterator to the last subscriber.
name()Returns the name of this slot
prepend()Registers a callback handler that will be called before the others.
retract()Removes a previous assertion on a message.
subscribe()Registers a callback handler on this slot.
unsubscribe()Unregisters a callback handler from this slot.

Detailed description

VM Interface for message oriented programming operations.

The VMSlot instance is a direct interface to the messaging facility of the VM creating it. It is implicitly created by the getSlot function, but it can be directly created by the user.

If a slot with the given name didn't previously exist, a new message slot is created in the virtual machine, otherwise the already existing slot is wrapped in the returned instance.

   // create a message slot
   x = VMSlot( "message" )
   x.subscribe( handler )
   ...
   y = VMSlot( "message" )
   y.broadcast( "value" )  // handler is called.

Same happens if the VMSlot is created via getSlot, or implicitly referenced via subscribe function. Slots are considered unique by name, so that comparisons on slots are performed on their names.

Init Block

VM Interface for message oriented programming operations.

init VMSlot( name )

nameThe name of the mesasge managed by this VMSlot.

The VMSlot instance is a direct interface to the messaging facility of the VM creating it. It is implicitly created by the getSlot function, but it can be directly created by the user.

If a slot with the given name didn't previously exist, a new message slot is created in the virtual machine, otherwise the already existing slot is wrapped in the returned instance.

   // create a message slot
   x = VMSlot( "message" )
   x.subscribe( handler )
   ...
   y = VMSlot( "message" )
   y.broadcast( "value" )  // handler is called.

Same happens if the VMSlot is created via getSlot, or implicitly referenced via subscribe function. Slots are considered unique by name, so that comparisons on slots are performed on their names.

Methods

assert()

Creates a message assertion on this certain message slot.

VMSlot.assert( data )

dataThe value of the assertion.

If there are already subscribed callbacks for this message a broadcast on them is performed now.

broadcast()

Performs broadcast on this slot.

VMSlot.broadcast( ... )

...Extra parameters to be sent to listeners.

first()

Gets an iterator to the first subscriber.

VMSlot.first( )

Returns:An iterator to the first subscriber of this message slot.

getAssert()

Gets the item asserted for this slot.

VMSlot.getAssert( [default] )

defaultIf given, instead of raising in case the essartion is not found, return this item.
Raises:
MessageErrorif the item has not an assertion and a default is not given.

last()

Gets an iterator to the last subscriber.

VMSlot.last( )

Returns:An iterator to the last subscriber of this message slot.

name()

Returns the name of this slot

VMSlot.name( )

Returns:The name of the event bind to this slot (as a string).

prepend()

Registers a callback handler that will be called before the others.

VMSlot.prepend( handler )

handlerThe callable that must be unregistered.

retract()

Removes a previous assertion on a message.

VMSlot.retract( )

subscribe()

Registers a callback handler on this slot.

VMSlot.subscribe( handler, [prio] )

handlerA callable item or instance providing callback support.
prioSet to true to have this handler called before the previous ones.

unsubscribe()

Unregisters a callback handler from this slot.

VMSlot.unsubscribe( handler )

handlerThe callable that must be unregistered.
Raises:
CodeError if the handler is not registered with this slot.

Made with faldoc 2.1.0