Function set "Message oriented model functions"

Functions supporting Message Oriented Programming (MOP)

more...

Summary

assert()Creates a message assertion on a certain message slot.
broadcast()Sends a message to every callable item subscribed to a message.
consume()Consumes currently being broadcasted signal.
getAssert()Returns the given assertion, if it exists.
getSlot()Retreives a MOP Message slot.
retract()Removes a previous assertion on a message.
subscribe()Registers a callback to a message slot.
unsubscribe()Unregisters a registered callback from a slot.

Detailed description

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.

Members

assert()

Creates a message assertion on a certain message slot.

assert( msg, data )

msgThe message to be asserted.
dataThe 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, [...] )

msgA message (string) to be broadcast.
...Zero or more data to be broadcaset.
Returns: true 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.

consume()

Consumes currently being broadcasted signal.

consume

getAssert()

Returns the given assertion, if it exists.

getAssert( msg, [default] )

msgThe message slot on which the assertion is to be ckeched.
defaultIf given, instead of raising in case the assertion is not found, return this item.
Raises:
MessageErrorif the given message is not asserted.

getSlot()

Retreives a MOP Message slot.

getSlot( msg, [make] )

msgThe message slot that must be taken or created.
makeIf true (default) create the slot if it doesn't exist.
Returns:The message slot coresponding with this name.

retract()

Removes a previous assertion on a message.

retract( msg )

msgThe message slot to be retracted.

subscribe()

Registers a callback to a message slot.

subscribe( msg, handler, [prio] )

msgA string with the message name on which the item should be registered.
handlerA callable item or instance providing callback support.
prioSet to true to insert this subscription in front of the subscription list.

unsubscribe()

Unregisters a registered callback from a slot.

unsubscribe( msg, handler )

msgA string with the message name on which the item should be registered.
handlerA callable item or instance providing callback support.
Raises:
CodeError if the handler is not registered with this slot.
AccessErrorif the named message slot doesn't exist.

Made with faldoc 2.1.0