home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / db02_src.zip / main.cc < prev    next >
C/C++ Source or Header  |  1993-11-05  |  2KB  |  93 lines

  1. /**************************************************************************
  2.  * Source Id :
  3.  *
  4.  * $Id: main.cc,v 1.3 1993/05/26 01:01:39 kevinl Exp $
  5.  *-------------------------------------------------------------------------
  6.  * Project Notes :
  7.  *
  8.  *  Diamond Base
  9.  *  ============
  10.  *      A solid database implementation, spurred on by the continuing
  11.  *  Metal (Lead) Base saga.
  12.  *
  13.  *  Project Team :
  14.  *        A. Davison
  15.  *        K. Lentin
  16.  *        D. Platt
  17.  *
  18.  *    Project Commenced : 05-02-1993
  19.  *
  20.  *-------------------------------------------------------------------------
  21.  *  Module Notes :
  22.  *
  23.  *  An initial main to do some testing with.
  24.  *
  25.  *
  26.  *  Original Author : Krazy Kev
  27.  *
  28.  *-------------------------------------------------------------------------
  29.  * Revision History:
  30.  *
  31.  * $Log: main.cc,v $
  32. // Revision 1.3  1993/05/26  01:01:39  kevinl
  33. // MALLOC_H_MISSING
  34. //
  35. // Revision 1.2  1993/03/29  08:20:09  darrenp
  36. // Added new malloc library support
  37. //
  38. // Revision 1.1  1993/02/10  07:57:31  darrenp
  39. // Initial revision
  40. //
  41.  **************************************************************************/
  42.  
  43. #include "myobj.h"
  44. #include <iostream.h>
  45. #ifdef BORLANDC
  46. #include <stdlib.h>
  47. #include <time.h>
  48. #endif
  49.  
  50. #ifndef MALLOC_H_MISSING
  51. #include <malloc.h>
  52. #endif
  53.  
  54. int
  55. main()
  56. {
  57. #ifdef BORLANDC
  58.     randomize();
  59. #else
  60.     srand(getpid() * getppid());
  61. #endif
  62.  
  63.     myObject obj;
  64.     bucket b(1, obj.getKeyLength(), 512, INNER, 0, 0, 0);
  65.     b.info();
  66.     for (int i = 0; i < 20; i++)
  67.     {
  68.         myObject insObj;
  69.         b.insert(insObj, i);
  70.     }
  71.     b.info();
  72.     b.dump();
  73.  
  74.     bucket b1(2, obj.getKeyLength(), 512, INNER, 0, b.getId(), 0);
  75.     b.header()->nextBucket = b1.getId();
  76.  
  77.     pKeyType outKey = b.allocTmpKey();
  78.     myObject insObj;
  79.     b.sploosh(&b1, 0, outKey, insObj, 99);
  80.  
  81.     cout << "Promote " << hex << *(long*)outKey << endl;
  82.  
  83.     cout << "Original Bucket:" << endl;
  84.  
  85.     b.info();
  86.     b.dump();
  87.  
  88.     cout << endl << "Splooshed Bucket:" << endl;
  89.     b1.info();
  90.     b1.dump();
  91.     return 0;
  92. }
  93.