ACT::basic_act Class Reference

Base class for specific ACT uses. More...

#include <ACT.hpp>

Inheritance diagram for ACT::basic_act:

ACT::autonomous_act ACT::simple_act ACT::Basic_Listening_Task< Listener, Monitor > ACT::Basic_Listening_Task< ACT::N_to_completion, ACT::N_to_completion_Monitor > ACT::Service< Aspect > ACT::Service< Supplied_Service_Aspect > IO::Behavior IO::Old_Device_Generator IO::read_action_base IO::Sink IO::Source IO::Stream_Consumer IO::write_action_base ACT::Basic_Listen_Monitor< Listener > ACT::Basic_Listen_Monitor< ACT::N_to_completion > ACT::no_action ACT::Pause_Demon ACT::single_action

List of all members.

Public Member Functions

ACT_State internal_state ()
bool ready () const
bool would_block () const
bool working () const
 Return is whether this action is in an unfinished state (either Ready or Waiting).
bool completed () const
bool bad () const
virtual ACT_State operator() (void)=0
virtual ACT_State operator() (wakeup_listener *)=0

Protected Member Functions

 basic_act ()
 Protected constructor for child classes.
ACT_State set_ready ()
 Protected setter for subclass implementation.
ACT_State set_would_block ()
 Protected setter for subclass implementation.
ACT_State set_completed ()
 Protected setter for subclass implementation.
ACT_State set_bad ()
 Protected setter for subclass implementation.
ACT_State set_state (ACT_State x)
 Protected arbitrary setter for subclasses that filter.


Detailed Description

Base class for specific ACT uses.

This class has no actions. That's a job for the subclasses. This class provides notation for the control state of a task.

States:

Theory Notes
As of this writing, there's no formalization of asynchronous computation tasks. The ordinary notion of the keyword "return" interlinks two different kinds of ideas:
The basic idea of an ACT splits the keyword "return" into two different kinds.

A question of nested control arises. A typical use (although not the only one) is to build an ACT by calling other ACT's. In this idiom, an ACT with a still-working sub-ACT is itself also still working. Thus the following code often appears: action() ; if ( action.working() ) return ; Furthermore, such code should have the property that when called again, its internal state leads the action to be called again.

Design Notes
There's no particular _a priori_ distinction between Completed and Bad states. The distinction between these two is whether an action has finished in a good or bad state. What _is_ common is that in either state, processing of this task has finished.
It's up to the specifier of a subclass to distinguish the meaning of "good" and "bad". We may formalize this as a "success condition", a predicate similar to a postcondition. The postcondition of operator() says that Completed actions satisfy the success condition and that Bad actions violate them. From a language point of view, a success condition would be (an analogue of) a template parameter. Such predicates are not part of most languages as of this writing.

Implementation Notes
The underlying state is private. Its assigners are protected for use only in subclasses. Its accessors are public, since they're involved in control flow.

Constructor & Destructor Documentation

ACT::basic_act::basic_act (  )  [inline, protected]

Protected constructor for child classes.


Member Function Documentation

ACT_State ACT::basic_act::set_ready (  )  [inline, protected]

Protected setter for subclass implementation.

ACT_State ACT::basic_act::set_would_block (  )  [inline, protected]

Protected setter for subclass implementation.

ACT_State ACT::basic_act::set_completed (  )  [inline, protected]

Protected setter for subclass implementation.

ACT_State ACT::basic_act::set_bad (  )  [inline, protected]

Protected setter for subclass implementation.

ACT_State ACT::basic_act::set_state ( ACT_State  x  )  [inline, protected]

Protected arbitrary setter for subclasses that filter.

ACT_State ACT::basic_act::internal_state (  )  [inline]

bool ACT::basic_act::ready (  )  const [inline]

bool ACT::basic_act::would_block (  )  const [inline]

bool ACT::basic_act::working (  )  const [inline]

Return is whether this action is in an unfinished state (either Ready or Waiting).

bool ACT::basic_act::completed (  )  const [inline]

bool ACT::basic_act::bad (  )  const [inline]

virtual ACT_State ACT::basic_act::operator() ( void   )  [pure virtual]

Implemented in ACT::simple_act, and ACT::autonomous_act.

virtual ACT_State ACT::basic_act::operator() ( wakeup_listener  )  [pure virtual]

Implemented in ACT::simple_act, and ACT::autonomous_act.


The documentation for this class was generated from the following file:
Generated on Thu Mar 6 18:25:09 2008 for Gnash by  doxygen 1.5.4