home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / dos / prg / todb101 / todb / lib / ptodb.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-27  |  2.1 KB  |  77 lines

  1. // ========================================================================
  2. //  TODB LIBRARY
  3. //    ptodb.h
  4. //
  5. //    Global type and parameters
  6. //
  7. //    Version: see TODB.H file
  8. //
  9. //    Copyright 1993 Christian Thérien
  10. //    All rights reserved
  11. // ========================================================================
  12.  
  13. #ifndef _PTODB_H
  14. #define _PTODB_H
  15.  
  16. // -- Parameters
  17.  
  18. // File block length
  19. // -----------------
  20. // A key cannot spill over a file block.  For this reason, the block length
  21. // value must respect these constraints:
  22. //
  23. // 1) For the first block in a key set thread
  24. //    block length = 2 * sizeof( BlockNbr ) + sizeof( ObjHeader )
  25. //             + X1 * sizeof( KeyType );
  26. //    X1 is the number of keys saved in the first block.
  27. //
  28. // 2) For the next block in a key set thread
  29. //    block length = sizeof( BlockNbr ) + sizeof( ObjHeader )
  30. //             + X2 * sizeof( KeyType );
  31. //    X2 is the number of keys saved in the next block.
  32. //
  33. // Where:
  34. //    sizeof( ObjHeader ) = sizeof( IdType ) + sizeof( KeyType );
  35. //
  36. // In general:
  37. //    X2 = X1 + 1 or
  38. //    X2 = X1 + 2
  39. //
  40. // Example:
  41. //    You need 120 keys by block, a key is four bytes long.
  42. //    sizeof( IdType ) is always = 2
  43. //    sizeof( KeyNbr ) = sizeof( KeyType ) = 4
  44. //    sizeof( ObjHeader ) = 2 + 4 = 6
  45. //    First block:
  46. //    2 * 4 + 6 + (X1 = 119) * 4 = 490
  47. //    Next block:
  48. //    4 + 6 + (X2 = 120) * 4 = 490
  49. //    Block length = 490
  50.  
  51. const int blocklength = 70;
  52.  
  53. // Key length
  54. // ----------
  55. // KeyType defines the type of the keys saved in the database.
  56. // We strongly recommend the use of unsigned type.
  57.  
  58. typedef unsigned int KeyType;
  59.  
  60. // Class and index identification
  61. // ------------------------------
  62. // IdType defines the type of class and index identification.
  63. // The value of sizeof( IdType ) must be two.  Depending on your
  64. // computer architecture, set the needed value for this type.
  65.  
  66. typedef int IdType;
  67.  
  68. // -- Global type
  69.  
  70. // KSPersistent Object address
  71. // ---------------------------
  72. // The type of KSPersistent object address is define by ObjAdr.
  73.  
  74. typedef long ObjAdr;
  75.  
  76. #endif // _PTODB_H
  77.