home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / cprog / btree.zip / BFH.HPP next >
C/C++ Source or Header  |  1992-02-16  |  2KB  |  67 lines

  1. //    C++ B+Tree
  2. //    (c) 1990,1991 Larry A. Walker
  3. //    This source is proprietary information which cannot be distributed 
  4. //    without written permission of Larry A. Walker
  5.  
  6. #ifndef BFH_H
  7. #define BFH_H
  8.             // Define one of these three:
  9. /*
  10. #define UNIX
  11. #define XENIX
  12. */
  13. #define MSDOS
  14.  
  15. /* The block file handler is the basic class for all database and 
  16. indexing operations */
  17.  
  18. #include "runerr.hpp"
  19.  
  20. #define warning(str)    \
  21.     proc_error( (int)WARNING, (int)__LINE__, (char *)__FILE__, (char *)str, (int)1 );
  22. #define fatal(str)    \
  23.     proc_error( (int)FATAL, (int)__LINE__, (char *)__FILE__, (char *)str, (int)1 );
  24.  
  25. class BFHClass : public RunError {
  26.  
  27.     int     file_fd;  
  28.     char *     fd_name;
  29.     struct     bfh_data bdata;
  30.     char *     empty_node ;
  31.     char *     other_data_hdr;
  32.     int     other_data_hdr_size;
  33.     long     current_pointer;
  34.     int     direction;
  35.  
  36.     public:
  37.  
  38.     BFHClass(){
  39.     };
  40.     
  41.     OpenBFH( char * , void * , int , int, int );
  42.  
  43.     ~BFHClass(){
  44.     };
  45.  
  46.     int BFHClose();
  47.     
  48.     int WriteBlock(char *, long); // write the block at the char pointer
  49.                       // to the indicated position
  50.     int ReadBlock(char *, long);  // read the block at the position to 
  51.                       // the pointer
  52.     long NewBlock();          // initialize a new block and return
  53.                       // its address
  54.     int FreeBlock(long);          // add a block to the free list
  55.                       //
  56.     long AddrBlock(long);          // return the address of the block at
  57.                       // position # int
  58.     int FullBlock(long);          // return yes 1 no 0 if block is presently
  59.                       // full
  60.     void get_info (struct bfh_data * ); // return 
  61.  
  62.     int GetBFHSize();          // What was the block size as created.
  63.  
  64.     int OpenState();
  65. };
  66. #endif BFH_H
  67.