MISR Toolkit  1.5.1
vgint.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright by The HDF Group. *
3  * Copyright by the Board of Trustees of the University of Illinois. *
4  * All rights reserved. *
5  * *
6  * This file is part of HDF. The full HDF copyright notice, including *
7  * terms governing use, modification, and redistribution, is contained in *
8  * the COPYING file, which can be found at the root of the source code *
9  * distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. *
10  * If you do not have access to either file, you may request a copy from *
11  * help@hdfgroup.org. *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 /* $Id$ */
15 
16 /*****************************************************************************
17 *
18 * vgint.h
19 *
20 * Part of HDF VSet interface
21 *
22 * defines library private symbols and structures used in v*.c files
23 *
24 * NOTES:
25 * This include file depends on the basic HDF *.h files hdfi.h and hdf.h.
26 * An 'S' in the comment means that that data field is saved in the HDF file.
27 *
28 ******************************************************************************/
29 
30 #ifndef _VGINT_H
31 #define _VGINT_H
32 
33 #include "H4api_adpt.h"
34 
35 #include "hfile.h"
36 
37 /* Include file for Threaded, Balanced Binary Tree implementation */
38 #include "tbbt.h"
39 
40 /*
41  * typedefs for VGROUP, VDATA and VSUBGROUP
42  */
43 typedef struct vgroup_desc VGROUP;
44 typedef struct vdata_desc VDATA;
45 typedef VDATA VSUBGROUP;
46 
47 /*
48  * -----------------------------------------------------------------
49  * structures that are part of the VDATA structure
50  * -----------------------------------------------------------------
51  */
52 
53 typedef struct symdef_struct
54  {
55  char *name; /* symbol name */
56  int16 type; /* whether int, char, float etc */
57  uint16 isize; /* field size as stored in vdata */
58  uint16 order; /* order of field */
59  }
60 SYMDEF;
61 
62 typedef struct write_struct
63  {
64  intn n; /* S actual # fields in element */
65  uint16 ivsize; /* S size of element as stored in vdata */
66 
67  char name[VSFIELDMAX][FIELDNAMELENMAX + 1]; /* S name of each field */
68 
69  int16 len[VSFIELDMAX]; /* S length of each fieldname */
70  int16 type[VSFIELDMAX]; /* S field type */
71  uint16 off[VSFIELDMAX]; /* S field offset in element in vdata */
72  uint16 isize[VSFIELDMAX]; /* S internal (HDF) size [incl order] */
73  uint16 order[VSFIELDMAX]; /* S order of field */
74  uint16 esize[VSFIELDMAX]; /* external (local machine) size [incl order] */
75  }
77 
78 typedef struct dyn_write_struct
79  {
80  intn n; /* S actual # fields in element */
81  uint16 ivsize; /* S size of element as stored in vdata */
82  char **name; /* S name of each field */
83 #ifndef OLD_WAY
84  uint16 *bptr; /* Pointer to hold the beginning of the buffer */
85 #endif /* OLD_WAY */
86  int16 *type; /* S field type (into bptr buffer) */
87  uint16 *off; /* S field offset in element in vdata (into bptr buffer) */
88  uint16 *isize; /* S internal (HDF) size [incl order] (into bptr buffer) */
89  uint16 *order; /* S order of field (into bptr buffer) */
90  uint16 *esize; /* external (local machine) size [incl order] (into bptr buffer) */
91  }
93 
94 /* If there are too many attrs and performance becomes a problem,
95  the vs_attr_t list defined below can be replaced by an
96  array of attr lists, each list contains attrs for 1 field.
97  */
98 typedef struct dyn_vsattr_struct
99 {
100  int32 findex; /* which field this attr belongs to */
101  uint16 atag, aref; /* tag/ref pair of the attr */
102 } vs_attr_t;
103 
104 typedef struct dyn_vgattr_struct
105 {
106  uint16 atag, aref; /* tag/ref pair of the attr */
107 } vg_attr_t;
108 
109 typedef struct dyn_read_struct
110 {
111  intn n; /* # fields to read */
112  intn *item; /* index into vftable_struct */
113 } DYN_VREADLIST;
114 
115 /*
116  * -----------------------------------------------
117  * V G R O U P definition
118  * -----------------------------------------------
119  */
120 
122  {
123  uint16 otag, oref; /* tag-ref of this vgroup */
124  HFILEID f; /* HDF file id */
125  uint16 nvelt; /* S no of objects */
126  intn access; /* 'r' or 'w' */
127  uint16 *tag; /* S tag of objects */
128  uint16 *ref; /* S ref of objects */
129  char *vgname; /* S name of this vgroup */
130  char *vgclass; /* S class name of this vgroup */
131  intn marked; /* =1 if new info has been added to vgroup */
132  intn new_vg; /* =1 if this is a new Vgroup */
133  uint16 extag, exref; /* expansion tag-ref */
134  intn msize; /* max size of storage arrays */
135  uint32 flags; /* indicate which version of VG should
136  be written to the file */
137  int32 nattrs; /* number of attributes */
138  vg_attr_t *alist; /* index of new-style attributes, by Vsetattr */
139  int32 noldattrs; /* number of old-style attributes */
140  vg_attr_t *old_alist; /* refs of attributes - only used in memory to
141  prevent repeated code in making the list; see
142  Voldnattrs's header for details -BMR 2/4/2011 */
143  vg_attr_t *all_alist; /* combined list; previous approach, only keep
144  just in case we come back to that approach; will
145  remove it once we decide not to go back 2/16/11 */
146  int16 version, more; /* version and "more" field */
147  struct vgroup_desc *next; /* pointer to next node (for free list only) */
148  };
149 /* VGROUP */
150 
151 /*
152  * -----------------------------------------------
153  * V D A T A definition
154  * -----------------------------------------------
155  */
156 
158  {
159  uint16 otag, oref; /* tag,ref of this vdata */
160  HFILEID f; /* HDF file id */
161  intn access; /* 'r' or 'w' */
162  char vsname[VSNAMELENMAX + 1]; /* S name of this vdata */
163  char vsclass[VSNAMELENMAX + 1]; /* S class name of this vdata */
164  int16 interlace; /* S interlace as in file */
165  int32 nvertices; /* S #vertices in this vdata */
168  int16 nusym;
170  intn marked; /* =1 if new info has been added to vdata */
171  intn new_h_sz; /* =1 if VH size changed, due to new attrs etc. */
172  intn islinked; /* =1 if vdata is a linked-block in file */
173 
174  uint16 extag, exref; /* expansion tag-ref */
175  uint32 flags; /* bit 0 -- has attr
176  bit 1 -- "large field"
177  bit 2 -- "interlaced data is appendable"
178  bit 3-15 -- unused. */
179  intn nattrs;
180  vs_attr_t *alist; /* attribute list */
181  int16 version, more; /* version and "more" field */
182  int32 aid; /* access id - for LINKED blocks */
183  struct vs_instance_struct *instance; /* ptr to the intance struct for this VData */
184  struct vdata_desc *next; /* pointer to next node (for free list only) */
185  }; /* VDATA */
186 
187 /* .................................................................. */
188 /* Private data structures. Unlikely to be of interest to applications */
189 /*
190  * These are just typedefs. Actual vfile_ts are declared PRIVATE and
191  * are not accessible by applications. However, you may change VFILEMAX
192  * to allow however many files to be opened.
193  *
194  * These are memory-resident copies of the tag-refs of the vgroups
195  * and vdatas for each file that is opened.
196  *
197  */
198 
199 /* this is a memory copy of a vg tag/ref found in the file */
200 typedef struct vg_instance_struct
201  {
202  int32 key; /* key to look up with the B-tree routines */
203  /* needs to be first in the structure */
204  uintn ref; /* ref # of this vgroup in the file */
205  /* needs to be second in the structure */
206  intn nattach; /* # of current attachs to this vgroup */
207  int32 nentries; /* # of entries in that vgroup initially */
208  VGROUP *vg; /* points to the vg when it is attached */
209  struct vg_instance_struct *next; /* pointer to next node (for free list only) */
210  }
212 
213 /* this is a memory copy of a vs tag/ref found in the file */
214 typedef struct vs_instance_struct
215  {
216  int32 key; /* key to look up with the B-tree routines */
217  /* needs to be first in the structure */
218  uintn ref; /* ref # of this vdata in the file */
219  /* needs to be second in the structure */
220  intn nattach; /* # of current attachs to this vdata */
221  int32 nvertices; /* # of elements in that vdata initially */
222  VDATA *vs; /* points to the vdata when it is attached */
223  struct vs_instance_struct *next; /* pointer to next node (for free list only) */
224  }
226 
227 /* each vfile_t maintains 2 linked lists: one of vgs and one of vdatas
228  * that already exist or are just created for a given file. */
229 typedef struct vfiledir_struct
230  {
231  int32 f; /* HDF File ID */
232 
233  int32 vgtabn; /* # of vg entries in vgtab so far */
234  TBBT_TREE *vgtree; /* Root of VGroup B-Tree */
235 
236  int32 vstabn; /* # of vs entries in vstab so far */
237  TBBT_TREE *vstree; /* Root of VSet B-Tree */
238  intn access; /* the number of active pointers to this file's Vstuff */
239  }
240 vfile_t;
241 
242 /* .................................................................. */
243 
244 #if defined c_plusplus || defined __cplusplus
245 extern "C"
246 {
247 #endif /* c_plusplus || __cplusplus */
248 
249 /*
250  * Library private routines for the VSet layer
251  */
252  VDATA *VSIget_vdata_node(void);
253 
254  void VSIrelease_vdata_node(VDATA *v);
255 
256  intn VSIgetvdatas(int32 id, const char *vsclass, const uintn start_vd,
257  const uintn n_vds, uint16 *refarray);
258 
260 
262 
263  VGROUP *VIget_vgroup_node(void);
264 
265  void VIrelease_vgroup_node(VGROUP *v);
266 
268 
270 
271  HDFLIBAPI intn VPparse_shutdown(void);
272 
274 
276  (HFILEID f, uint16 vsid);
277 
279  (HFILEID f, uint16 vgid);
280 
282  (int32 vskey);
283 
284  HDFLIBAPI intn vpackvg
285  (VGROUP * vg, uint8 buf[], int32 * size);
286 
287  HDFLIBAPI int32 vinsertpair
288  (VGROUP * vg, uint16 tag, uint16 ref);
289 
290  HDFLIBAPI intn vpackvs
291  (VDATA * vs, uint8 buf[], int32 * size);
292 
294  (HFILEID f,uint16 ref);
295 
297  (HFILEID f,uint16 ref);
298 
300  (intn type);
301 
303  (char *ss);
304 
305 #if defined c_plusplus || defined __cplusplus
306 }
307 #endif /* c_plusplus || __cplusplus */
308 
309 #endif /* _VGINT_H */
VGROUP * vg
Definition: vgint.h:208
#define VSNAMELENMAX
Definition: hlimits.h:69
HDFFCLIBAPI intf * len
intn msize
Definition: vgint.h:134
HDFLIBAPI vsinstance_t * VSIget_vsinstance_node(void)
uint16 * off
Definition: vgint.h:87
uint16 order
Definition: vgint.h:58
int32 HFILEID
Definition: hdf.h:142
struct symdef_struct SYMDEF
intn access
Definition: vgint.h:161
int32 nattrs
Definition: vgint.h:137
SYMDEF * usym
Definition: vgint.h:169
HDFLIBAPI vsinstance_t * vsinst(HFILEID f, uint16 vsid)
HDFLIBAPI void trimendblanks(char *ss)
VDATA VSUBGROUP
Definition: vgint.h:45
char ** name
Definition: vgint.h:82
int16 nusym
Definition: vgint.h:168
void VIrelease_vgroup_node(VGROUP *v)
HDFFCLIBAPI _fcd vsclass
HDFFCLIBAPI intf intf intf intf * oref
HDFFCLIBAPI intf intf * refarray
HDFLIBAPI VGROUP * VPgetinfo(HFILEID f, uint16 ref)
VDATA * vs
Definition: vgint.h:222
intn n
Definition: vgint.h:64
uint32 flags
Definition: vgint.h:135
HFILEID f
Definition: vgint.h:160
HDFLIBAPI vfile_t * Get_vfile(HFILEID f)
Definition: tbbt.h:31
uint16 ivsize
Definition: vgint.h:65
#define FIELDNAMELENMAX
Definition: hlimits.h:67
vg_attr_t * old_alist
Definition: vgint.h:140
DYN_VWRITELIST wlist
Definition: vgint.h:166
uint16 * ref
Definition: vgint.h:128
uint16 * tag
Definition: vgint.h:127
struct vs_instance_struct * next
Definition: vgint.h:223
void VSIrelease_vdata_node(VDATA *v)
intn * item
Definition: vgint.h:112
struct vdata_desc * next
Definition: vgint.h:184
vg_attr_t * alist
Definition: vgint.h:138
HDFLIBAPI void VSIrelease_vsinstance_node(vsinstance_t *vs)
HDFLIBAPI DYN_VWRITELIST * vswritelist(int32 vskey)
HDFLIBAPI vginstance_t * vginst(HFILEID f, uint16 vgid)
vs_attr_t * alist
Definition: vgint.h:180
uint16 isize
Definition: vgint.h:57
intn access
Definition: vgint.h:126
uint16 atag
Definition: vgint.h:101
uint16 ivsize
Definition: vgint.h:81
int32 noldattrs
Definition: vgint.h:139
struct vs_instance_struct vsinstance_t
struct write_struct VWRITELIST
HDFFCLIBAPI intf intf * ref
uint16 otag
Definition: vgint.h:159
intn marked
Definition: vgint.h:131
uint32 flags
Definition: vgint.h:175
struct vg_instance_struct * next
Definition: vgint.h:209
VGROUP * VIget_vgroup_node(void)
int32 nvertices
Definition: vgint.h:165
uint16 * isize
Definition: vgint.h:88
#define VSFIELDMAX
Definition: hlimits.h:68
int32 vstabn
Definition: vgint.h:236
int32 findex
Definition: vgint.h:100
struct vfiledir_struct vfile_t
DYN_VREADLIST rlist
Definition: vgint.h:167
HDFLIBAPI int16 map_from_old_types(intn type)
uint16 * esize
Definition: vgint.h:90
HDFFCLIBAPI intf * size
int16 version
Definition: vgint.h:181
uint16 atag
Definition: vgint.h:106
struct dyn_write_struct DYN_VWRITELIST
struct vg_instance_struct vginstance_t
struct dyn_vgattr_struct vg_attr_t
HDFFCLIBAPI intf * tag
HDFLIBAPI void VIrelease_vginstance_node(vginstance_t *vg)
struct vs_instance_struct * instance
Definition: vgint.h:183
uint16 * bptr
Definition: vgint.h:84
intn islinked
Definition: vgint.h:172
char * name
Definition: vgint.h:55
HDFFCLIBAPI _fcd vsname
uint16 nvelt
Definition: vgint.h:125
int16 type
Definition: vgint.h:56
int32 nentries
Definition: vgint.h:207
TBBT_TREE * vstree
Definition: vgint.h:237
TBBT_TREE * vgtree
Definition: vgint.h:234
int16 version
Definition: vgint.h:146
HDFLIBAPI intn VPparse_shutdown(void)
VDATA * VSIget_vdata_node(void)
int32 aid
Definition: vgint.h:182
intn marked
Definition: vgint.h:170
HDFLIBAPI int32 vinsertpair(VGROUP *vg, uint16 tag, uint16 ref)
HDFLIBAPI intn vpackvg(VGROUP *vg, uint8 buf[], int32 *size)
char * vgname
Definition: vgint.h:129
HDFFCLIBAPI intf * vgid
uint16 * order
Definition: vgint.h:89
int16 interlace
Definition: vgint.h:164
intn new_h_sz
Definition: vgint.h:171
HDFLIBAPI VDATA * VSPgetinfo(HFILEID f, uint16 ref)
struct dyn_vsattr_struct vs_attr_t
struct vgroup_desc * next
Definition: vgint.h:147
uint16 otag
Definition: vgint.h:123
char * vgclass
Definition: vgint.h:130
#define HDFLIBAPI
Definition: H4api_adpt.h:195
intn new_vg
Definition: vgint.h:132
uint16 extag
Definition: vgint.h:174
HDFLIBAPI vginstance_t * VIget_vginstance_node(void)
intn VSIgetvdatas(int32 id, const char *vsclass, const uintn start_vd, const uintn n_vds, uint16 *refarray)
HFILEID f
Definition: vgint.h:124
intn access
Definition: vgint.h:238
uint16 extag
Definition: vgint.h:133
vg_attr_t * all_alist
Definition: vgint.h:143
int32 vgtabn
Definition: vgint.h:233
intn nattrs
Definition: vgint.h:179
HDFLIBAPI intn vpackvs(VDATA *vs, uint8 buf[], int32 *size)
HDFFCLIBAPI intf * buf
int32 nvertices
Definition: vgint.h:221
struct dyn_read_struct DYN_VREADLIST
int16 * type
Definition: vgint.h:86

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:53