home *** CD-ROM | disk | FTP | other *** search
- // INDEXMGR.H - IndexMgr Class Header
-
- #ifndef INDEXMGR_H
- #define INDEXMGR_H
-
- #include "filemgr.h"
- #include "nodemgr.h"
-
- const idxRecSize = 1022;
-
- class IndexMgr : public FileMgr
- {
-
- private:
-
- int item_size; // Size of index item (excludes pointer)
- long head_ptr_pos; // Position in file of head of tree pointer
- long left_ptr_pos; // Leftmost node pointer position
- long head_node; // Head node
- long left_node; // Left node
- long parent[32]; // Parent nodes
- int depth; // Depth of current node
- int idx_created; // Set if index was created this go
- int is_unique; // True if unique index
- NodeMgr *node;
-
- virtual void read_data(void *block); // Virtual read function
- virtual void write_data(void *block); // Virtual write finction
-
- virtual void create_file(void) { create_idx(); }
-
- long find_rec(void *contents, long recno); // Tree walker function
- public:
-
- IndexMgr(const char *fname, int itsize, int unique);
- IndexMgr(const char *fname, int itsize, int unique, int file_des,
- int idxno, int create);
- ~IndexMgr(void);
- void create_idx(void);
-
- int get_fd(void) { return fd; }
- void set_fd(int file_des) { fd = file_des; }
- long find(void *contents);
- long retrieve(void);
- long next(int no_recs);
- long prev(int no_recs);
- void rew(void);
- int compare(void *contents);
- int insert(long recno, void *contents);
- int erase(void);
- void node_split(void);
- int created_idx(void) { return idx_created; }
- };
-
- #endif
-