home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / mslang / isam / include / indexmgr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-08  |  1.5 KB  |  56 lines

  1. // INDEXMGR.H - IndexMgr Class Header
  2.  
  3. #ifndef INDEXMGR_H
  4. #define INDEXMGR_H
  5.  
  6. #include "filemgr.h"
  7. #include "nodemgr.h"
  8.  
  9. const idxRecSize = 1022;
  10.  
  11. class IndexMgr : public FileMgr
  12.     {
  13.  
  14. private:
  15.  
  16.     int item_size; // Size of index item (excludes pointer)
  17.     long head_ptr_pos; // Position in file of head of tree pointer
  18.     long left_ptr_pos; // Leftmost node pointer position
  19.     long head_node; // Head node
  20.     long left_node; // Left node
  21.     long parent[32]; // Parent nodes
  22.     int depth; // Depth of current node
  23.     int idx_created; // Set if index was created this go
  24.     int is_unique; // True if unique index
  25.     NodeMgr *node;
  26.  
  27.     virtual void read_data(void *block); // Virtual read function
  28.     virtual void write_data(void *block); // Virtual write finction
  29.  
  30.     virtual void create_file(void) { create_idx(); }
  31.  
  32.     long find_rec(void *contents, long recno); // Tree walker function
  33. public:
  34.  
  35.     IndexMgr(const char *fname, int itsize, int unique);
  36.     IndexMgr(const char *fname, int itsize, int unique, int file_des,
  37.              int idxno, int create);
  38.     ~IndexMgr(void);
  39.     void create_idx(void);
  40.  
  41.     int get_fd(void) { return fd; }
  42.     void set_fd(int file_des) { fd = file_des; }
  43.     long find(void *contents);
  44.     long retrieve(void);
  45.     long next(int no_recs);
  46.     long prev(int no_recs);
  47.     void rew(void);
  48.     int compare(void *contents);
  49.     int insert(long recno, void *contents);
  50.     int erase(void);
  51.     void node_split(void);
  52.     int created_idx(void) { return idx_created; }
  53.     };
  54.  
  55. #endif
  56.