home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre4.z / postgre4 / src / lib / H / access / istrat.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  3.2 KB  |  132 lines

  1. /*
  2.  * istrat.h --
  3.  *    POSTGRES index strategy definitions.
  4.  */
  5.  
  6. #ifndef    IStratIncluded        /* Include this file only once */
  7. #define IStratIncluded    1
  8.  
  9. /*
  10.  * Identification:
  11.  */
  12. #define ISTRAT_H    "$Header: /private/postgres/src/lib/H/access/RCS/istrat.h,v 1.12 1992/03/04 22:13:52 mer Exp $"
  13.  
  14. #include "tmp/postgres.h"
  15. #include "access/attnum.h"
  16. #include "access/skey.h"
  17.  
  18. typedef uint16    StrategyNumber;
  19.  
  20. #define InvalidStrategy    0
  21.  
  22. #ifndef    CorrectStrategies        /* XXX this should be removable */
  23. #define AMStrategies(foo)    12
  24. #else    /* !defined(CorrectStrategies) */
  25. #define AMStrategies(foo)    (foo)
  26. #endif    /* !defined(CorrectStrategies) */
  27.  
  28. typedef struct StrategyMapData {
  29.     ScanKeyEntryData    entry[1];    /* VARIABLE LENGTH ARRAY */
  30. } StrategyMapData;    /* VARIABLE LENGTH STRUCTURE */
  31.  
  32. typedef StrategyMapData    *StrategyMap;
  33.  
  34. typedef struct IndexStrategyData {
  35.     StrategyMapData    strategyMapData[1];    /* VARIABLE LENGTH ARRAY */
  36. } IndexStrategyData;    /* VARIABLE LENGTH STRUCTURE */
  37.  
  38. typedef IndexStrategyData    *IndexStrategy;
  39.  
  40. /*
  41.  * StrategyNumberIsValid --
  42.  *    True iff the strategy number is valid.
  43.  */
  44. #define StrategyNumberIsValid(strategyNumber) \
  45.     ((bool) ((strategyNumber) != InvalidStrategy))
  46.  
  47. /*
  48.  * StrategyNumberIsInBounds --
  49.  *    True iff strategy number is within given bounds.
  50.  *
  51.  * Note:
  52.  *    Assumes StrategyNumber is an unsigned type.
  53.  *    Assumes the bounded interval to be (0,max].
  54.  */
  55. #define StrategyNumberIsInBounds(strategyNumber, maxStrategyNumber) \
  56.     ((bool)(InvalidStrategy < (strategyNumber) && \
  57.         (strategyNumber) <= (maxStrategyNumber)))
  58.  
  59. /*
  60.  * StrategyMapIsValid --
  61.  *    True iff the index strategy mapping is valid.
  62.  */
  63. #define    StrategyMapIsValid(map) PointerIsValid(map)
  64.  
  65. /*
  66.  * IndexStrategyIsValid --
  67.  *    True iff the index strategy is valid.
  68.  */
  69. #define    IndexStrategyIsValid(s)    PointerIsValid(s)
  70.  
  71. /*
  72.  * StrategyMapGetScanKeyEntry --
  73.  *    Returns a scan key entry of a index strategy mapping member.
  74.  *
  75.  * Note:
  76.  *    Assumes that the index strategy mapping is valid.
  77.  *    Assumes that the index strategy number is valid.
  78.  *    Bounds checking should be done outside this routine.
  79.  */
  80. extern
  81. ScanKeyEntry
  82. StrategyMapGetScanKeyEntry ARGS((
  83.     StrategyMap    map,
  84.     StrategyNumber    strategyNumber
  85. ));
  86.  
  87. /*
  88.  * IndexStrategyGetStrategyMap --
  89.  *    Returns an index strategy mapping of an index strategy.
  90.  *
  91.  * Note:
  92.  *    Assumes that the index strategy is valid.
  93.  *    Assumes that the number of index strategies is valid.
  94.  *    Bounds checking should be done outside this routine.
  95.  */
  96. extern
  97. StrategyMap
  98. IndexStrategyGetStrategyMap ARGS((
  99.     IndexStrategy    indexStrategy,
  100.     StrategyNumber    maxStrategyNumber,
  101.     AttributeNumber    attributeNumber
  102. ));
  103.  
  104. /*
  105.  * AttributeNumberGetIndexStrategySize --
  106.  *    Computes the size of an index strategy.
  107.  */
  108. extern
  109. Size
  110. AttributeNumberGetIndexStrategySize ARGS((
  111.     AttributeNumber    maxAttributeNumber,
  112.     StrategyNumber    maxStrategyNumber
  113. ));
  114.  
  115. /*
  116.  * IndexSupportInitialize --
  117.  *    Initializes an index strategy and associated support procedures.
  118.  */
  119. extern
  120. void
  121. IndexSupportInitialize ARGS((
  122.     IndexStrategy    indexStrategy,
  123.     RegProcedure    *indexSupport,
  124.     ObjectId    indexObjectId,
  125.     ObjectId    accessMethodObjectId,
  126.     StrategyNumber    maxStrategyNumber,
  127.     StrategyNumber    maxSupportNumber,
  128.     AttributeNumber maxAttributeNumber
  129. ));
  130.  
  131. #endif    /* !defined(IStratIncluded) */
  132.