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

  1. /* @(#)Z 1.4 com/src/cm/Refs.h, odstorage, od96os2, odos29646d 96/11/15 15:27:14 (96/10/29 09:19:07) */
  2. /*====START_GENERATED_PROLOG======================================
  3.  */
  4. /*
  5.  *   COMPONENT_NAME: odstorage
  6.  *
  7.  *   CLASSES: none
  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. /*
  30.     File:        Refs.h
  31.  
  32.     Contains:    Container Manager Object Reference Interfaces
  33.  
  34.     Written by:    Ira L. Ruben
  35.  
  36.     Owned by:    Ed Lai
  37.  
  38.     Copyright:    ⌐ 1992-1994 by Apple Computer, Inc., all rights reserved.
  39.  
  40.     Change History (most recent first):
  41.  
  42.          <2>     8/26/94    EL        #1181622 Ownership update.
  43.          <2>      5/9/94    MB        #1162181: Changes necessary to install MMM.
  44.          <1>      2/3/94    EL        first checked in
  45.  
  46.     To Do:
  47. */
  48.  
  49. /*---------------------------------------------------------------------------*
  50.  |                                                                           |
  51.  |                            <<<    Refs.h    >>>                           |
  52.  |                                                                           |
  53.  |               Container Manager Object Reference Interfaces               |
  54.  |                                                                           |
  55.  |                               Ira L. Ruben                                |
  56.  |                                 10/25/92                                  |
  57.  |                                                                           |
  58.  |                     Copyright Apple Computer, Inc. 1992-1994              |
  59.  |                           All rights reserved.                            |
  60.  |                                                                           |
  61.  *---------------------------------------------------------------------------*
  62.  
  63.  This file defines the routines needed by others to access object references maintained by
  64.  the API Reference operations defined in CMReferenceOps.c.  Object references are
  65.  "pointers" (i.e., object IDs) to other objects from a value (CMValue) that contains data
  66.  that refers to those objects.  The data is in the form of a CMReference "key".  The
  67.     CMRefOps.c    API routines manipulate those key/object (ID) associations.
  68.  
  69.  The associations are maintained in a list as value data for a uniquely typed value in a
  70.  private object "tied" to the value through a pointer (refDataObject) in the value header.
  71. */
  72.  
  73.  
  74. #ifndef __REFERENCES__
  75. #define __REFERENCES__
  76.  
  77. #ifndef __CMTYPES__
  78. #include "CMTypes.h"
  79. #endif
  80. #ifndef __CM_API_TYPES__
  81. #include "CMAPITyp.h"
  82. #endif
  83. #ifndef __LISTMGR__
  84. #include "ListMgr.h"
  85. #endif
  86. #ifndef __GLOBALNAMES__
  87. #include "GlbNames.h"   
  88. #endif
  89. #ifndef __CONTAINEROPS__
  90. #include "Containr.h"  
  91. #endif
  92. #ifndef __TOCENTRIES__
  93. #include "TOCEnts.h"   
  94. #endif
  95.  
  96. struct TOCValueHdr;
  97.                                                                     
  98.                                                                     CM_CFUNCTIONS
  99.  
  100. /* References are recorded in a value's recording object as a sequence of entries with    */
  101. /* the following layout...                                                                                                                            */
  102.  
  103. struct ReferenceData {                                                /* Layout of recording objects ref data:    */
  104.     CMReference        key;                                                    /*         reference key                                                */
  105.     CM_UCHAR objectID[sizeof(CMReference)];/*        associated referenced object ID            */
  106. };
  107. typedef struct ReferenceData ReferenceData;
  108.  
  109.  
  110. /* The actual reference list data is maintained as value data for the recoding object.    */
  111. /* To increase efficiency, the data is read into memory the first time it's accessed.        */
  112. /* From that point on, all updates to the actual data are "shadowed" in the in-memory        */
  113. /* list.  The updating can't be avoided (so updating, e.g., touches, etc. work                     */
  114. /* correctly). But at least the searches can be made to not be I/O bound! The following */
  115. /* describes the layout for the in-memory list.  There's a list header and the list         */
  116. /* entries themselves.  It's a doubly linked list so that the ListMgr.c routines can         */
  117. /* used and to make deletion easier.                                                                                                       */
  118.  
  119. struct RefDataShadowEntry {                                        /* Reference list data shadow entries:        */
  120.     ListLinks         refDataLinks;                                    /*        links to next/prev data(must be 1st)*/
  121.     CM_ULONG        key;                                                    /*        ref key (internalized CMReference)    */
  122.     CMObjectID         objectID;                                            /*        associated object ID                                */
  123. };
  124. typedef struct RefDataShadowEntry RefDataShadowEntry, *RefDataShadowEntryPtr;
  125.  
  126.  
  127. /* The list header is pointed to by the SAME value header field usually used to point     */
  128. /* to the recording object (refDataObject).  However, a union is used to use a more         */
  129. /* appropriate name (refShadowList).  We can always tell which is which because the            */
  130. /* refShadowList will only have meaning in the recording object's value itself which is    */
  131. /* uniquely typed (CM_StdObjID_ObjRefData).      If the field is not NULL, but not that        */
  132. /* type, then we know we have a pointer to the recording object because in all other         */
  133. /* values this field is NULL.  To aid in using these fields in a value header, the             */
  134. /* following macros are provided.                                                                                                                */
  135.  
  136. #define RefDataObject(v)        (((TOCValueHdrPtr)(v))->references.refDataObject)
  137. #define RefShadowList(v)        (((TOCValueHdrPtr)(v))->references.refShadowList)
  138.  
  139. #define HasRefDataObject(v)    (RefDataObject(v) != NULL && \
  140.                                                           ((TOCValueHdrPtr)(v))->typeID != CM_StdObjID_ObjRefData)
  141.  
  142. #if CMSHADOW_LIST
  143. #define HasRefShadowList(v)    (RefShadowList(v) != NULL && \
  144.                                                          ((TOCValueHdrPtr)(v))->typeID == CM_StdObjID_ObjRefData)
  145. #else
  146. #define HasRefShadowList(v)    0
  147. #endif
  148.  
  149.  
  150. #if CMSHADOW_LIST
  151.  
  152. void cmDeleteRefDataShadowList(struct TOCValueHdr *refDataValueHdr);
  153.     /*
  154.     This routine is called to delete the entire shadow list pointed to from the specified
  155.     recording object's value header.  It is used for clearing the list during error recovery
  156.     and value (header) deletions.
  157.     
  158.     Note, generally the caller should have done a HasRefShadowList(refDataValueHdr) prior to
  159.     calling this routine to make sure that the value header is indeed a recording object
  160.     value header.
  161.     */
  162.  
  163. #endif
  164.  
  165.                                                           CM_END_CFUNCTIONS
  166. #endif
  167.