home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1998 / MacHack 1998.toast / Sessions / Completions / Completions Source / Sequencer / TaskStep.h < prev   
Encoding:
Text File  |  1998-06-08  |  1.3 KB  |  59 lines  |  [TEXT/CWIE]

  1. // TaskStep.h
  2.  
  3. #ifndef TaskStep_h
  4. #define TaskStep_h
  5.  
  6. #ifndef Assert_h
  7. #include "Assert.h"
  8. #endif
  9.  
  10. class Task;
  11.  
  12. template < class Sequence >
  13. class TaskStep
  14.   {
  15.     friend class TaskSequencer<Sequence>;
  16.     
  17.      public:
  18.          typedef TaskStep<Sequence> (Sequence::*DeferredType)( bool dying, DeferredTaskTime );
  19.          typedef TaskStep<Sequence> (Sequence::*ApplicationType)( bool dying, ApplicationTime );
  20.  
  21.      private:
  22.          ::Task *task;
  23.          DeferredType deferred;
  24.          ApplicationType application;
  25.      
  26.          TaskStep()    : task( 0 ), deferred(0), application(0)        {}
  27.          
  28.      public:
  29.          TaskStep( ::Task *theTask, DeferredType method )
  30.            : task( theTask ),
  31.               deferred( method ),
  32.               application( 0 )
  33.            {}
  34.          
  35.          TaskStep( ::Task *theTask, ApplicationType method )
  36.            : task( theTask ),
  37.               deferred( 0 ),
  38.               application( method )
  39.            {}
  40.          
  41.          explicit TaskStep( ::Task *theTask )
  42.            : task( theTask ),
  43.               deferred( 0 ),
  44.               application( 0 )
  45.            {}
  46.          
  47.          ::Task *Task() const                                    { return task; }
  48.  
  49.          bool IsDeferred() const                                { return deferred != 0; }
  50.          bool IsApplication() const                            { return application != 0; }
  51.          
  52.          bool IsLast() const                                    { return !IsDeferred() && !IsApplication(); }
  53.  
  54.          DeferredType DeferredMethod() const                { return deferred; }
  55.          ApplicationType ApplicationMethod() const        { return application; }
  56.   };
  57.  
  58. #endif
  59.