UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
dbnamedefs.h
1 /* dbnamedefs.h
2  started from Id: dbname.h,v 1.16 2003/02/14 16:20:08 vlad Exp */
3 /* $Id: dbnamedefs.h,v 1.1 2006/02/01 15:54:43 ibadm Exp $ */
4 #ifndef __dbnamedefs_h
5 #define __dbnamedefs_h
6 
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include <mix/Types.h>
13 #include <mix/General.h>
14 #include <ldb/dbdefs.h>
15 
16 
17 /*
18  * Compatibility with LDB v<4
19  */
20 
21 /* Main data types, used in dbtc API */
22 #define TV_INT INT_4
23 #define TV_LONG INT_8
24 #define TV_FLOAT REAL_8
25 #define TV_CHAR CHAR_1
26 #define TV_DBPTR DBTPTR
27 #define TV_NO_TYPE __NO_TYPE__
28 
29 /* Lengths */
30 #define DB_DMAX DB_IDENT_LEN
31 #define DB_TMAX DB_IDENT_LEN
32 #define DB_UMAX 8
33 
34 
35 /*
36  * Maximum length of pointed fields of name
37  */
38 #define DB_PREFIX_LEN 3
39 #define DB_TABLE_LEN DB_IDENT_LEN
40 #define DB_WELL_LEN DB_IDENT_LEN
41 #define DB_SP_LEN 4
42 #define DB_SP_VAL 9999
43 #define DB_MOD_LEN 4
44 #define DB_MOD_VAL 9999
45 #define DB_FILE_NAME_LEN (DB_PREFIX_LEN + 1 + \
46  DB_WELL_LEN + 1 + \
47  DB_SP_LEN + 1 + \
48  DB_TABLE_LEN + 1 + \
49  DB_MOD_LEN)
50 /* DB_FILE_NAME_LEN + 1 == DBTPTR_LEN --> see mix/Types.h */
51 
52 #define szDBprefix "VSP"
53 #define szDBseparator "."
54 #define cDBseparator '.'
55 
56 
67 typedef struct
68 {
69  int mask;
71  char table[DB_TABLE_LEN+1];
72  char well[DB_WELL_LEN+1];
73  int sp;
74  int mod;
76 } dbNameStruct;
77 
78 
85 typedef struct
86 {
87  dbNameStruct list; /* db name of root table */
88  int line; /* non-negative index of line in list;
89  -1 means "new line" in the list */
90 } dbItem;
91 
92 
94 #define DB_NEW_ITEM (-1)
95 
96 
97 
103 typedef struct
104 {
105  dbNameStruct name;
106  char project[PROJECT_LEN+1];
107 
108 } dbPointer;
109 
110 
111 /*************************************************************
112  * Flags and error codes
113  *************************************************************/
114 
115 /* Part of structured file name of data base */
116 #define DB_TABLE (1<<0)
117 #define DB_WELL (1<<1)
118 #define DB_SP (1<<2)
119 #define DB_MOD (1<<3)
120 #define DB_LIST (1<<4)
123 #define DB_PARSE_ERROR (1<<5)
124 
125 /* Typical masks */
126 #define DBM_LIST (DB_LIST|DB_TABLE)
127 #define DBM_WELL (DB_TABLE|DB_WELL|DB_MOD)
128 #define DBM_WELL_SP (DB_TABLE|DB_WELL|DB_SP|DB_MOD)
129 #define DBM_ALL (DB_LIST|DB_TABLE|DB_WELL|DB_SP|DB_MOD)
130 
131 /* Flags extraction from mask */
132 #define IsDBmod(x) (!!((x)&DB_MOD))
133 #define IsDBsp(x) (!!((x)&DB_SP))
134 #define IsDBwell(x) (!!((x)&DB_WELL))
135 #define IsDBtable(x) (!!((x)&DB_TABLE))
136 #define IsDBlist(x) (!!((x)&DB_LIST))
137 #define IsDBparseError(x) (!!((x)&DB_PARSE_ERROR))
138 #define IsDBempty(x) (!!((x)&DBM_WELL_SP))
139 
140 
144 typedef enum
145 {
146  DbMemory = 0,
147  DbReadOnlyFile,
148  DbReadWriteFile,
149  DbCreateFile,
151  DbAccessMask = 0x0f,
153  DbNoLock = (1 << 4),
154  DbNoHistory = (1 << 5),
156  DbSmallPreread = (1 << 6),
159  DbReadAtOnce = (1 << 7)
163 } DbAccess;
164 
166 #define DbAccessMode(x) ((DbAccess)((x)&DbAccessMask))
167 
169 #define DbAccessFlags(x) ((DbAccess)((x)&~DbAccessMask))
170 
172 #define DbAccessMix(m,f) ((DbAccess)(DbAccessMode(m)|(f)))
173 
174 
175 
176 /*************************************************************
177  *
178  * Operations on dbNameStruct
179  *
180  *************************************************************/
181 
193 int dbParseFileName (const char* szFileName,
194  dbNameStruct* dbNS);
195 
201 char* dbBuildFileName (const dbNameStruct* dbNS,
202  char szFileName[DB_FILE_NAME_LEN+1]);
203 
209 void dbCopyByMask (dbNameStruct* dbDst,
210  const dbNameStruct* dbSrc,
211  int mask);
212 
216 void dbNameCopy (dbNameStruct* dbDst, const dbNameStruct* dbSrc);
217 
218 
222 Compar dbNameCompare (const dbNameStruct* dbns1,
223  const dbNameStruct* dbns2);
224 
225 
226 #ifdef __cplusplus
227 };
228 #endif
229 
230 
231 #endif /* dbnamedefs.h */
int mod
Definition: dbnamedefs.h:74
Definition: dbnamedefs.h:67
int sp
Definition: dbnamedefs.h:73
Definition: dbnamedefs.h:103
int mask
Definition: dbnamedefs.h:69
Definition: dbnamedefs.h:85