File 'base/sequencer.cls' (part of 'Pool_Base')


Home | Packages | Files | Procedures | Classes | Keywords | External packages


Written by
Andreas Kupries
Description
Framework for building sequencers. Currently used by the smtp and pop3 implementations. See background for more information and <f net/pop3/*> and <f net/smtp/*> for examples of its usage.
Keywords
Sequencer, State machines, finite automatons

Class 'sequencer'

Options
timeout
Membervariables
after, error, lineMethod, nextMethod, state
Methods
Event, OnDone, OnLine, OnNext, Receive, Timeout, errorInfo, event, next, state, wait

-timeout
Timeout in milliseconds.

after
The handle of the timeout set via wait.
error
Error message placed into the sequencer by a derived class.
lineMethod
Name of the method to call upon receiving the 'line' event.
nextMethod
Name of the method to call upon receiving the 'next' event.
state
The current state of the sequencer. One of: error, timeout, eof, done, next or line. Equal to the last event executed by us.

Event (event arglist)

The real event handler. Execution is set up by event. Takes the same arguments.
Argument: eventName of event to raise. Allowed values are 'error', 'timeout', 'eof', 'line', 'next' and 'done'.
Argument: arglistArbitrary arguments given to the event. Only 'error' and 'line' actually use arguments (the first one only), all else ignore this information.

OnDone ()

Abstract method. Called by the framework if the FA is done with its work (= upon event 'done').

OnLine (line)

Called by the framework to proceed after receiving a 'line' event. The default implementation uses lineMethod to call the correct handler method.
Argument: lineContains the received information.

OnNext ()

Called by the framework to proceed to the next step in the sequence (upon event 'next'). The default implementation uses nextMethod to call the correct method.

Receive (channel)

Callback executed in case of data arriving at channel. May raise 'eof' and 'line' events in the sequencer. Will disable the timeout in this cases. In case of having received an incomplete line the system will just go to sleep again, to wait for more data.
Argument: channelName of channel the sequencer waited for.

Timeout (channel)

Callback executed in case of a timeout during the wait for input at channel. Removes the fileevent handler, then raises the 'timeout' event in the sequencer.
Argument: channelName of channel the sequencer waited for.

errorInfo ()

Returns: The error information of this sequencer.

event (event args)

Raises event in the given sequencer. Automatically the last command executed in the surounding context, i.e behaves as 'return'. The actual handling of the event is delayed by 'after' and done inside Event.
Notes: Raising 'done' executes 'OnDone' and then automatically destroys the sequencer
Argument: eventName of event to raise. Allowed values are 'error', 'timeout', 'eof', 'line', 'next' and 'done'.
Argument: argsArbitrary arguments given to the event. Only 'error' and 'line' actually use arguments (the first one only), all else ignore this information.

next (method)

Defines a method to be executed if the 'next' event was triggered. Removes any existing 'line' handler.
Argument: methodThe method to set as 'next' handler.

state ()

Returns: The state of this sequencer.

wait (channel method)

Convenience procedure to setup the sequencer to wait for input on a channel. After receiving a complete line the appropriate event will be raised. The wait will be able to time out if such information is part of the sequencer configuration. Removes any existing 'next' handler .
Argument: channelName of channel to wait on for input.
Argument: methodName of the method to execute after a line was received.


Generated by AutoDoc 2.1 at 02/20/1999, invoked by Andreas Kupries