1.23Message oriented model functions

Functions supporting Message Oriented Programming (MOP)

This is the list of functions working together to implement the message oriented model. Other than this functions, it is possible to use the VMSlot class for direct access to reflected virtual machine slots. On this regards, see the Message oriented model group.

Functions

assert

Creates a message assertion on a certain message slot.

assert( msg, data )
msg The message to be asserted.
data The value of the assertion.

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

broadcast

Sends a message to every callable item subscribed to a message.

broadcast( msg, [...] )
msg A message (string) to be broadcast.
... Zero or more data to be broadcaset.
Returntrue if msg is found, false if it doesn't exist.

Broadcast function implicitly searches for a Virtual Machine Message Slot (VMSlot) with the given msg name, and if it finds it, it emits a broadcast on that.

If the message is not found, the broadcast is silently dropped (no error is raised), but the function returns false.

As calling this function requires a scan in the virtual machine message slot table, in case of repeated operations it is preferable to explicitly search for a slot with getSlot, or to create it as an VMSlot instance. On the other hand, if the reference to a VMSlot is not needed, this function allows to broadcast on the slot without adding the overhead required by the creation of the VMSlot wrapper.

See also: VMSlot, getSlot.

consume

Consumes currently being broadcasted signal.

consume()

getAssert

Returns the given assertion, if it exists.

getAssert( msg, [default] )
msg The message slot on which the assertion is to be ckeched.
default If given, instead of raising in case the assertion is not found, return this item.
Raise
MessageError if the given message is not asserted.

getSlot

Retreives a MOP Message slot.

getSlot( msg, [make] )
msg The message slot that must be taken or created.
make If true (default) create the slot if it doesn't exist.
ReturnThe message slot coresponding with this name.

retract

Removes a previous assertion on a message.

retract( msg )
msg The message slot to be retracted.

subscribe

Registers a callback to a message slot.

subscribe( msg, handler, [prio] )
msg A string with the message name on which the item should be registered.
handler A callable item or instance providing callback support.
prio Set to true to insert this subscription in front of the subscription list.

unsubscribe

Unregisters a registered callback from a slot.

unsubscribe( msg, handler )
msg A string with the message name on which the item should be registered.
handler A callable item or instance providing callback support.
Raise
CodeError if the handler is not registered with this slot.
AccessError if the named message slot doesn't exist.
Made with http://www.falconpl.org