1 | /*************** TabVct H Declares Source Code File (.H) ***************/ |
2 | /* Name: TABVCT.H Version 3.4 */ |
3 | /* */ |
4 | /* (C) Copyright to the author Olivier BERTRAND 1999-2011 */ |
5 | /* */ |
6 | /* This file contains the TDBVCT class declares. */ |
7 | /***********************************************************************/ |
8 | #ifndef __TABVCT__ |
9 | #define __TABVCT__ |
10 | |
11 | #include "tabfix.h" |
12 | #if defined(UNIX) |
13 | //#include <string.h.SUNWCCh> |
14 | #endif |
15 | |
16 | typedef class TDBVCT *PTDBVCT; |
17 | typedef class VCTCOL *PVCTCOL; |
18 | |
19 | /***********************************************************************/ |
20 | /* VCT table. */ |
21 | /***********************************************************************/ |
22 | class DllExport VCTDEF : public DOSDEF { /* Logical table description */ |
23 | friend class TDBVCT; |
24 | friend class VCTFAM; |
25 | friend class VECFAM; |
26 | friend class VMPFAM; |
27 | public: |
28 | // Constructor |
29 | VCTDEF(void) {Split = false; Estimate = Header = 0;} |
30 | |
31 | // Implementation |
32 | virtual const char *GetType(void) {return "VCT" ;} |
33 | int GetEstimate(void) {return Estimate;} |
34 | |
35 | // Methods |
36 | virtual bool DefineAM(PGLOBAL g, LPCSTR am, int poff); |
37 | virtual PTDB GetTable(PGLOBAL g, MODE mode); |
38 | |
39 | protected: |
40 | int MakeFnPattern(char *fpat); |
41 | |
42 | // Members |
43 | bool Split; /* Columns in separate files */ |
44 | int Estimate; /* Estimated maximum size of table */ |
45 | int ; /* 0: no, 1: separate, 2: in data file */ |
46 | }; // end of VCTDEF |
47 | |
48 | /***********************************************************************/ |
49 | /* This is the DOS/UNIX Access Method class declaration for files */ |
50 | /* in blocked vector format. In each block containing "Elements" */ |
51 | /* records, values of each columns are consecutively stored (vector). */ |
52 | /***********************************************************************/ |
53 | class DllExport TDBVCT : public TDBFIX { |
54 | friend class VCTCOL; |
55 | friend class VCTFAM; |
56 | friend class VCMFAM; |
57 | friend class VECFAM; |
58 | friend class VMPFAM; |
59 | public: |
60 | // Constructors |
61 | TDBVCT(PVCTDEF tdp, PTXF txfp); |
62 | TDBVCT(PGLOBAL g, PTDBVCT tdbp); |
63 | |
64 | // Implementation |
65 | virtual AMT GetAmType(void) {return TYPE_AM_VCT;} |
66 | virtual PTDB Duplicate(PGLOBAL g) |
67 | {return (PTDB)new(g) TDBVCT(g, this);} |
68 | bool IsSplit(void) {return ((VCTDEF*)To_Def)->Split;} |
69 | |
70 | // Methods |
71 | virtual PTDB Clone(PTABS t); |
72 | virtual bool IsUsingTemp(PGLOBAL g); |
73 | |
74 | // Database routines |
75 | virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); |
76 | virtual bool OpenDB(PGLOBAL g); |
77 | virtual int ReadDB(PGLOBAL g); |
78 | virtual void CloseDB(PGLOBAL g); |
79 | |
80 | protected: |
81 | // Members |
82 | }; // end of class TDBVCT |
83 | |
84 | /***********************************************************************/ |
85 | /* Class VCTCOL: VCT access method column descriptor. */ |
86 | /* This A.M. is used for file having column wise organization. */ |
87 | /***********************************************************************/ |
88 | class DllExport VCTCOL : public DOSCOL { |
89 | friend class TDBVCT; |
90 | friend class VCTFAM; |
91 | friend class VCMFAM; |
92 | friend class VECFAM; |
93 | friend class VMPFAM; |
94 | friend class BGVFAM; |
95 | public: |
96 | // Constructors |
97 | VCTCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i); |
98 | VCTCOL(VCTCOL *colp, PTDB tdbp); // Constructor used in copy process |
99 | |
100 | // Implementation |
101 | virtual int GetAmType(void) {return TYPE_AM_VCT;} |
102 | |
103 | // Methods |
104 | virtual void ReadColumn(PGLOBAL g); |
105 | virtual void WriteColumn(PGLOBAL g); |
106 | virtual bool SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check); |
107 | virtual void SetOk(void); |
108 | |
109 | protected: |
110 | virtual void ReadBlock(PGLOBAL g); |
111 | virtual void WriteBlock(PGLOBAL g); |
112 | |
113 | VCTCOL(void) {} // Default constructor not to be used |
114 | |
115 | // Members |
116 | PVBLK Blk; // Block buffer |
117 | int Clen; // Internal length in table |
118 | int ColBlk; // Block pointed by column |
119 | int ColPos; // Last position read |
120 | int Modif; // Number of modified lines in block |
121 | }; // end of class VCTCOL |
122 | |
123 | #endif // __TABVCT__ |
124 | |
125 | |