home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / warphead.zip / H / IDLELIST.H < prev    next >
C/C++ Source or Header  |  1997-02-28  |  6KB  |  196 lines

  1. /* @(#)Z 1.2 com/src/ui/IdleList.h, odui, od96os2, odos29646d 96/11/15 15:28:05 (96/07/15 18:26:50) */
  2. /*====START_GENERATED_PROLOG======================================
  3.  */
  4. /*
  5.  *   COMPONENT_NAME: odui
  6.  *
  7.  *   CLASSES:   IdleInfo
  8.  *        IdleList
  9.  *        IdleListIterator
  10.  *
  11.  *   ORIGINS: 82,27
  12.  *
  13.  *
  14.  *   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  15.  *   All Rights Reserved
  16.  *   Licensed Materials - Property of IBM
  17.  *   US Government Users Restricted Rights - Use, duplication or
  18.  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  19.  *       
  20.  *   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  21.  *   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  22.  *   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  23.  *   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  24.  *   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  25.  *   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  26.  *   OR PERFORMANCE OF THIS SOFTWARE.
  27.  */
  28. /*====END_GENERATED_PROLOG========================================
  29.  */
  30. /*
  31.     File:        IdleList.h
  32.  
  33.     Contains:    Interface to IdleInfo, IdleList and IdleListIterator classes.
  34.  
  35.     Owned by:    Richard Rodseth
  36.  
  37.     Copyright:    ⌐ 1993 - 1995 by Apple Computer, Inc., all rights reserved.
  38.  
  39.     Change History (most recent first):
  40.  
  41.          <6>     5/25/95    jpa        List.h --> LinkList.h [1253324]
  42.          <5>      4/4/95    RR        1228161 Pass ev to SetIdleFreq
  43.          <4>     1/31/95    RR        # 1206909 Pass ev to
  44.                                     RemoveUnregisteredIdlers
  45.          <3>     9/30/94    RR        #1167950 Allow unregistering while idling
  46.          <2>     9/20/94    RR        Added ev parameter to AddIdle and
  47.                                     RemoveIdle. #1154046 Moved ref counting
  48.                                     into IdleList methods so that an
  49.                                     unregistered part is not released.
  50.          <1>     5/13/94    RR        first checked in
  51.          <5>     3/15/94    MB        Changes to support SCpp/ASLM builds,
  52.                                     #1150864.
  53.          <4>      2/9/94    NP        Tiger Team cleanup.
  54.          <3>     1/26/94    RR        Include ODTypes
  55.          <2>    12/20/93    RR        interface takes part/frame pairs rather
  56.                                     than frames
  57.          <1>    11/16/93    RR        first checked in
  58.  
  59.     To Do:
  60.     In Progress:
  61. */
  62.  
  63. #ifndef _IDLELIST_
  64. #define _IDLELIST_
  65.  
  66. #ifndef _ODTYPES_
  67. #include "ODTypes.h"
  68. #endif
  69.  
  70. #ifndef _PLFMDEF_
  71. #include "PlfmDef.h"
  72. #endif
  73.  
  74. #ifndef _LINKLIST_
  75. #include <LinkList.h>
  76. #endif
  77.  
  78. //==============================================================================
  79. // Theory of Operation
  80. //==============================================================================
  81.  
  82. //==============================================================================
  83. // Scalar Types
  84. //==============================================================================
  85.  
  86. typedef ODULong ODTicks; 
  87.  
  88. //=====================================================================================
  89. // Classes defined in this interface
  90. //=====================================================================================
  91.  
  92. class IdleInfo; 
  93. class IdleList;                
  94. class IdleListIterator;                
  95.  
  96. //=====================================================================================
  97. // Classes used by this interface
  98. //=====================================================================================
  99.  
  100. class ODFrame;
  101. class ODPart;
  102.  
  103. //=====================================================================================
  104. // Global Variables
  105. //=====================================================================================
  106.  
  107. //======================================================================================
  108. // Class IdleInfo
  109. //======================================================================================
  110.  
  111. class IdleInfo : public Link
  112. {
  113. public:
  114.     IdleInfo(ODPart* part, ODFrame* frame, ODIdleFrequency frequency);
  115.     virtual ~IdleInfo();
  116.  
  117.     ODBoolean NeedsIdle(ODTicks ticks);
  118.     ODTicks NextIdle(ODTicks ticks);
  119.     
  120.     ODPart* GetPart() { return fPart; }
  121.     ODFrame* GetFrame() { return fFrame; }
  122.     ODIdleFrequency GetIdleFrequency() { return fIdleFrequency; }
  123.     void SetIdleFrequency(ODIdleFrequency frequency) { fIdleFrequency = frequency; }
  124.     ODTicks GetLastIdle() { return fLastIdle; }
  125.     void SetLastIdle(ODTicks lastIdle) { fLastIdle = lastIdle; }
  126.     ODBoolean ShouldRemove() { return fRemove; }
  127.     void SetShouldRemove(ODBoolean shouldRemove) { fRemove = shouldRemove; }
  128.  
  129. private:    
  130.     ODPart*            fPart;
  131.     ODFrame*             fFrame;
  132.     ODIdleFrequency     fIdleFrequency;
  133.     ODSLong             fLastIdle;
  134.     ODBoolean        fRemove;
  135. };
  136.  
  137. //=====================================================================================
  138. // IdleList
  139. //=====================================================================================
  140.  
  141. class IdleList
  142. {
  143.     friend class IdleListIterator;
  144.     
  145. public:
  146.     IdleList();
  147.     virtual ~IdleList();
  148.     
  149.     void AddIdle(Environment* ev, ODPart* part, ODFrame* frame, ODIdleFrequency frequency); 
  150.     
  151.     void RemoveIdle(Environment* ev, ODPart* part, ODFrame* frame); 
  152.     
  153.     void SetIdleFrequency(Environment* ev, ODPart* part, ODFrame* frame, ODIdleFrequency frequency); 
  154.  
  155.     void RemoveUnregisteredIdlers(Environment* ev);
  156.     
  157. private:
  158.     LinkedList fImplementation;
  159. };
  160.  
  161. //=====================================================================================
  162. // IdleListIterator
  163. //=====================================================================================
  164.  
  165. class IdleListIterator
  166. {
  167. public:
  168.  
  169.     IdleListIterator(IdleList* idleList);
  170.     
  171.         // Constructor
  172.         
  173.     ODVMethod ~IdleListIterator();
  174.     
  175.         // Destructor
  176.     
  177.     ODMethod IdleInfo* First();
  178.     
  179.         // Returns the first element of the set
  180.         
  181.     ODMethod IdleInfo* Next();
  182.     
  183.         // Returns the next element in the set
  184.         
  185.     ODMethod ODBoolean IsNotComplete();
  186.     
  187.         // Returns TRUE as long as there are more elements in the set
  188.     
  189. private:
  190.     
  191.     LinkedListIterator fIterator;
  192.     
  193. };
  194.  
  195. #endif // _IDLELIST_
  196.