home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / Apple Shared Library Manager / ASLM Examples / Example Tools / Sources / TInterruptSchedulerExample.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-19  |  1.6 KB  |  69 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        TInterruptSchedulerExample.h
  3.  
  4.     Contains:    Declaration of the TVBLOperation class which is scheduled by a vbl.
  5.                 All its process method does is bump up a count of the number of times
  6.                 it's been called.
  7.  
  8.     Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11.  
  12. #ifndef __TINTERRUPTSCHEDULEREXAMPLE1__
  13. #define __TINTERRUPTSCHEDULEREXAMPLE1__
  14.  
  15. #ifndef __MEMORY__
  16. #include <memory.h>
  17. #endif
  18.  
  19. #ifndef __RETRACE__
  20. #include <Retrace.h>
  21. #endif
  22.  
  23. #ifndef __TOOLUTILS__
  24. #include <ToolUtils.h>
  25. #endif
  26.  
  27. ///————————————————————————————————————————————————————————————————————————————————————
  28. ///    TVBLOperation
  29. ///————————————————————————————————————————————————————————————————————————————————————
  30.  
  31. class TVBLOperation : public TOperation {
  32.     public:
  33.                         TVBLOperation();    // Constructor
  34.         virtual            ~TVBLOperation();    // Destructor
  35.         virtual void    Process();            // Override
  36.                 int        GetCount();
  37.  
  38.     private:
  39.         int    fCount;                            // number of times called
  40. };
  41.  
  42. ///————————————————————————————————————————————————————————————————————————————————————
  43. ///    TVBLOperation IMPLEMENTATION
  44. ///————————————————————————————————————————————————————————————————————————————————————
  45.  
  46.     TVBLOperation::TVBLOperation()
  47.     {
  48.         fCount = 0;
  49.     }
  50.  
  51.     TVBLOperation::~TVBLOperation()
  52.     {
  53.     }
  54.  
  55.     int TVBLOperation::GetCount()
  56.     {
  57.         return fCount;
  58.     }
  59.  
  60.     // Ok, so this isn't exactly what you expected for a heavy duty process method.
  61.     // Normally if you were doing something so simple you wouldn't schedule an
  62.     // operation for it. Just make beleave fCount++ takes a long time
  63.     void TVBLOperation::Process()
  64.     {
  65.         fCount++;
  66.     }
  67.  
  68.  
  69. #endif