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

  1. /* @(#)Z 1.3 com/src/ui/DispTabl.h, odui, od96os2, odos29646d 96/11/15 15:29:30 (96/07/15 18:26:10) */
  2. /*====START_GENERATED_PROLOG======================================
  3.  */
  4. /*
  5.  *   COMPONENT_NAME: odui
  6.  *
  7.  *   CLASSES:   DispatchTable
  8.  *
  9.  *   ORIGINS: 82,27
  10.  *
  11.  *
  12.  *   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  13.  *   All Rights Reserved
  14.  *   Licensed Materials - Property of IBM
  15.  *   US Government Users Restricted Rights - Use, duplication or
  16.  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17.  *       
  18.  *   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  19.  *   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  20.  *   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  21.  *   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  22.  *   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  23.  *   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  24.  *   OR PERFORMANCE OF THIS SOFTWARE.
  25.  */
  26. /*====END_GENERATED_PROLOG========================================
  27.  */
  28. /*
  29.     File:        DispTabl.h
  30.  
  31.     Contains:    Definition of class DispatchTable, which is private to the implementation of
  32.                 ODDispatcher.
  33.  
  34.     Owned by:    Richard Rodseth
  35.  
  36.     Copyright:    ⌐ 1992 - 1995 by Apple Computer, Inc., all rights reserved.
  37.  
  38.     Change History (most recent first):
  39.  
  40.          <2>      9/8/95    jpa        Use official error number range for private
  41.                                     error [1281354]
  42.          <1>     5/13/94    RR        first checked in
  43.          <9>      2/9/94    NP        Tiger Team cleanup.
  44.          <8>     1/15/94    RR        WinState.h->WinStat.h,
  45.                                     Dispatch.h->Disptch.h
  46.          <7>     12/2/93    RR        Use new eventType definition
  47.          <6>     8/20/93    RR        Fixed array indexing bug
  48.          <5>     8/18/93    RR        Added GetDispatchInfo/UpdateDispatchInfo
  49.          <4>     8/18/93    RR        Use DictionaryList class
  50.          <2>    8/17/93    RCR        Use OrderedCollection instead of linked list, for monitors
  51.          <1>    8/10/93    RCR        first checked in
  52.  
  53.     To Do:
  54.     In Progress:
  55.         
  56. */
  57.  
  58. #ifndef _DISPTABL_
  59. #define _DISPTABL_
  60.  
  61. #ifndef _ODTYPES_
  62. #include "ODTypes.h"
  63. #endif
  64.  
  65. //=====================================================================================
  66. // Theory of Operation
  67. //=====================================================================================
  68.  
  69. /*
  70.     See Disptch.h
  71.  
  72.     Contains an array of dispatch modules for the first 256 event codes. If there are 
  73.     any more, they go in an overflow linked list. A Windows implementation might  use 
  74.     a hash table instead, since there are so many more messages.
  75.  
  76. */
  77.  
  78. //=====================================================================================
  79. // Constants
  80. //=====================================================================================
  81.  
  82. const ODEventType kODLastEvent = 255; //    Index of last entry in the dispatch table
  83.  
  84. //=====================================================================================
  85. // Scalar Types
  86. //=====================================================================================
  87.  
  88. //=====================================================================================
  89. // Classes defined in this interface
  90. //=====================================================================================
  91.  
  92. class DispatchTable;
  93.  
  94. //=====================================================================================
  95. // Classes used by this interface
  96. //=====================================================================================
  97.  
  98. class DispatchInfo;
  99. class OrderedCollection;
  100. class DictionaryList;
  101. class ODDispatchModule;
  102.  
  103. //=====================================================================================
  104. // Global Variables
  105. //=====================================================================================
  106.  
  107. //=====================================================================================
  108. // Class DispatchTable
  109. //=====================================================================================
  110.  
  111. class DispatchTable
  112. {
  113. public:
  114.  
  115.     DispatchTable();
  116.     
  117.         // Constructor
  118.         
  119.     ~DispatchTable();
  120.     
  121.         // Destructor
  122.  
  123.     void AddMonitor(ODEventType eventType, 
  124.                     ODDispatchModule* dispatchModule);
  125.                     
  126.     void RemoveMonitor(ODEventType eventType,ODDispatchModule* dispatchModule);
  127.     
  128.     void AddDispatchModule(ODEventType eventType, 
  129.                            ODDispatchModule* dispatchModule);
  130.                            
  131.     void RemoveDispatchModule(ODEventType eventType);
  132.     
  133.     ODDispatchModule* GetDispatchModule(ODEventType eventType);
  134.  
  135.     OrderedCollection* GetMonitors(ODEventType eventType);
  136.     
  137. protected:
  138.  
  139.     DispatchInfo* GetDispatchInfo(ODEventType eventType);
  140.     void UpdateDispatchInfo(ODEventType eventType, DispatchInfo* info);
  141.     
  142. private:
  143.  
  144.     DispatchInfo* fDispatchInfo[kODLastEvent + 1]; // An array for the first 256 event types
  145.     DictionaryList* fOverflowDispatchInfo;              // A dictionary for those that don't 
  146.                                                   // fit in the array
  147.                                         
  148. };
  149.  
  150. #endif // _DISPTABL_
  151.