home *** CD-ROM | disk | FTP | other *** search
/ Resource for Source: C/C++ / Resource for Source - C-C++.iso / misc_src / cslib16b / include / csvbaxe.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-01  |  3.7 KB  |  119 lines

  1. /***********************************************************************
  2.  
  3.                                       CSDB Library, Version 1.6.b 
  4.                                          Released: March 2nd 1995 
  5.  
  6.        Header file of the VBAXE class.
  7.        Just like the VBASE class but for very large
  8.        databases.
  9.  
  10.                                            Copyright(c) 1994,1995 
  11.                                                            Combis 
  12.                                                   The Netherlands 
  13. ***********************************************************************/
  14.  
  15. #ifndef __CSVBAXE_H
  16. #define __CSVBAXE_H
  17.  
  18. #include "cstypes.h"
  19. #include "cstbase.h"
  20. #include "csvram.h"
  21.  
  22. ////////////////////////////////////////////////////////////////////////
  23.  
  24. class VBASEi:public TBASE
  25. {
  26.    virtual int class_ID(void)  { return CS_CLID_VBASEi; }
  27. };
  28.  
  29. ////////////////////////////////////////////////////////////////////////
  30.  
  31. class VBASEd:public VRAM
  32. {
  33.    virtual int class_ID(void)  { return CS_CLID_VBASEd; }
  34. };
  35.  
  36.  
  37. ////////////////////////////////////////////////////////////////////////
  38.  
  39.  
  40.  
  41. class VBAXE
  42. {
  43.  
  44.     typedef struct
  45.     {
  46.       VPOI p;
  47.       U16 len;
  48.     }vbi;
  49.  
  50.     VBASEi  in;
  51.     VBASEd  da;
  52.  
  53.  
  54.  
  55. ////////////////////////////////////////////////////////////////////////
  56. ////////////////////// PUBLIC FUNCTIONS ////////////////////////////////
  57. ////////////////////////////////////////////////////////////////////////
  58.  public:
  59.  
  60.  
  61. //////////////////////// Definition//////////////////////////////////////////
  62.    int    define(CSCHAR *name,U16 struclen);
  63.    int    relocate_when_shrunk(void)    { return da.relocate_when_shrunk();}
  64.    void relocate_when_shrunk(int ToF) { da.relocate_when_shrunk(ToF);     }
  65.  
  66. //////////////////////// Open & Close////////////////////////////////////////
  67.    int    open(CSCHAR *name,S16 kb_buf);
  68.    int    close(void);
  69.    int    save(void);
  70.  
  71. //////////////////////// Read & Writes records///////////////////////////////
  72.    void read_rec(U32 pos,void *ptr,U16    &length);
  73.    void read_rec(U32 pos,U16  maxlen,void *ptr,U16  &length);
  74.    void write_rec(U32 i,void *d,U16 len);
  75.  
  76. //////////////////////// Add Records/////////////////////////////////////////
  77.    U32    append_rec(void *p,U16 len);
  78.  
  79. //////////////////////// Number of Records///////////////////////////////////
  80.    U32    numvrec(void)         { return in.numrec(); }
  81.  
  82. //////////////////////// Data in Header Page/////////////////////////////////
  83.    int    data_2_header(void * ptr,U16 length)
  84.     { return in.data_2_header(ptr,length); }
  85.    int    header_2_data(void * ptr,U16 length)
  86.     { return in.header_2_data(ptr,length); }
  87.    U16    max_data_in_header(void)
  88.     { return in.max_data_in_header(); }
  89.  
  90. ////////////////////////// Deleting////////////////////////////////////////////
  91.    int    is_delet(U32 k)      { return in.is_delet(k); }
  92.    void delet(U32 k)         { in.delet(k);    }
  93.    void undelet(U32 k )      { in.undelet(k);    }
  94.  
  95. ////////////////////////// Record Length///////////////////////////////////////
  96.    U16    rec_len(U32 k)         { return ((vbi *)in.locate_rec(k))->len; }
  97.    U16    max_len(void)         { return da.max_len(); }
  98.  
  99. //////////////////////// Report Writing//////////////////////////////////////
  100.    U16    report(CSCHAR *name,S16 sub=1);
  101.    void report(FILE *fipo,S16 sub);
  102.  
  103. ////////////////////////// Miscellaneous///////////////////////////////////////
  104.  
  105.    int    background(void);
  106.    int    pack(void);
  107.    int    zap(void)           { return (da.zap() && in.zap()); }
  108.    int    empty(void)           { return (da.empty() && in.empty()); }
  109.    int    already_open(void)     { return in.already_open(); }
  110.    void info(void);
  111.  
  112.    virtual int class_ID(void)  { return CS_CLID_VBAXE; }
  113.    void  echo_IO(int TF)       { in.echo_IO(TF); da.echo_IO(TF); }
  114.  
  115.  
  116. };
  117.  
  118. #endif
  119.