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 HDF5.  The full HDF5 copyright notice, including     *
7  * terms governing use, modification, and redistribution, is contained in    *
8  * the files COPYING and Copyright.html.  COPYING can be found at the root   *
9  * of the source code distribution tree; Copyright.html can be found at the  *
10  * root level of an installed copy of the electronic HDF5 document set and   *
11  * is linked from the top-level documents page.  It can also be found at     *
12  * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
13  * access to either file, you may request a copy from help@hdfgroup.org.     *
14  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /*-------------------------------------------------------------------------
17  *
18  * Created:             H5Gpublic.h
19  *                      Jul 11 1997
20  *                      Robb Matzke <matzke@llnl.gov>
21  *
22  * Purpose:             Public declarations for the H5G package
23  *
24  *-------------------------------------------------------------------------
25  */
26 
27 module hdf5.H5Gpublic;
28 
29 /* System headers needed by this file */
30 import hdf5.H5public;
31 import hdf5.H5Ipublic;
32 import hdf5.H5Lpublic;
33 import hdf5.H5Opublic;
34 import hdf5.H5Tpublic;
35 
36 /*****************/
37 /* Public Macros */
38 /*****************/
39 
40 extern(C):
41 
42 /*******************/
43 /* Public Typedefs */
44 /*******************/
45 
46 /* Types of link storage for groups */
47 enum H5G_storage_type_t {
48     H5G_STORAGE_TYPE_UNKNOWN = -1,	/* Unknown link storage type	*/
49     H5G_STORAGE_TYPE_SYMBOL_TABLE,      /* Links in group are stored with a "symbol table" */
50                                         /* (this is sometimes called "old-style" groups) */
51     H5G_STORAGE_TYPE_COMPACT,		/* Links are stored in object header */
52     H5G_STORAGE_TYPE_DENSE 		/* Links are stored in fractal heap & indexed with v2 B-tree */
53 }
54 
55 /* Information struct for group (for H5Gget_info/H5Gget_info_by_name/H5Gget_info_by_idx) */
56 struct H5G_info_t {
57     H5G_storage_type_t 	storage_type;	/* Type of storage for links in group */
58     hsize_t 	nlinks;		        /* Number of links in group */
59     int64_t     max_corder;             /* Current max. creation order value for group */
60     hbool_t     mounted;                /* Whether group has a file mounted on it */
61 }
62 
63 /********************/
64 /* Public Variables */
65 /********************/
66 
67 
68 /*********************/
69 /* Public Prototypes */
70 /*********************/
71 
72 version(Posix) {
73 hid_t H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id,
74     hid_t gcpl_id, hid_t gapl_id);
75 hid_t H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id);
76 hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id);
77 hid_t H5Gget_create_plist(hid_t group_id);
78 herr_t H5Gget_info(hid_t loc_id, H5G_info_t *ginfo);
79 herr_t H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *ginfo,
80     hid_t lapl_id);
81 herr_t H5Gget_info_by_idx(hid_t loc_id, const char *group_name,
82     H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5G_info_t *ginfo,
83     hid_t lapl_id);
84 herr_t H5Gclose(hid_t group_id);
85 }
86 
87 /++
88 /* Symbols defined for compatibility with previous versions of the HDF5 API.
89  *
90  * Use of these symbols is deprecated.
91  */
92 #ifndef H5_NO_DEPRECATED_SYMBOLS
93 
94 /* Macros */
95 
96 /* Link definitions */
97 #define H5G_SAME_LOC H5L_SAME_LOC
98 #define H5G_LINK_ERROR H5L_TYPE_ERROR
99 #define H5G_LINK_HARD H5L_TYPE_HARD
100 #define H5G_LINK_SOFT H5L_TYPE_SOFT
101 #define H5G_link_t H5L_type_t
102 
103 /* Macros for types of objects in a group (see H5G_obj_t definition) */
104 #define H5G_NTYPES	256		/* Max possible number of types	*/
105 #define H5G_NLIBTYPES	8		/* Number of internal types	*/
106 #define H5G_NUSERTYPES	(H5G_NTYPES - H5G_NLIBTYPES)
107 #define H5G_USERTYPE(X)	(8 + (X))	/* User defined types		*/
108 
109 
110 /* Typedefs */
111 
112 /*
113  * An object has a certain type. The first few numbers are reserved for use
114  * internally by HDF5. Users may add their own types with higher values.  The
115  * values are never stored in the file -- they only exist while an
116  * application is running.  An object may satisfy the `isa' function for more
117  * than one type.
118  */
119 typedef enum H5G_obj_t {
120     H5G_UNKNOWN = -1,		/* Unknown object type		*/
121     H5G_GROUP,		        /* Object is a group		*/
122     H5G_DATASET,		/* Object is a dataset		*/
123     H5G_TYPE,			/* Object is a named data type	*/
124     H5G_LINK,		        /* Object is a symbolic link	*/
125     H5G_UDLINK,		        /* Object is a user-defined link */
126     H5G_RESERVED_5,		/* Reserved for future use	*/
127     H5G_RESERVED_6,		/* Reserved for future use	*/
128     H5G_RESERVED_7		/* Reserved for future use	*/
129 } H5G_obj_t;
130 
131 /* Prototype for H5Giterate() operator */
132 typedef herr_t (*H5G_iterate_t)(hid_t group, const char *name, void *op_data);
133 
134 /* Information about an object */
135 typedef struct H5G_stat_t {
136     unsigned long 	fileno[2];	/*file number			*/
137     unsigned long 	objno[2];	/*object number			*/
138     unsigned 		nlink;		/*number of hard links to object*/
139     H5G_obj_t 		type;		/*basic object type		*/
140     time_t		mtime;		/*modification time		*/
141     size_t		linklen;	/*symbolic link value length	*/
142     H5O_stat_t          ohdr;           /* Object header information    */
143 } H5G_stat_t;
144 
145 
146 /* Function prototypes */
147 H5_DLL hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint);
148 H5_DLL hid_t H5Gopen1(hid_t loc_id, const char *name);
149 H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name,
150     const char *new_name);
151 H5_DLL herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
152     hid_t new_loc_id, const char *new_name);
153 H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name,
154     const char *dst_name);
155 H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
156     const char *dst_name);
157 H5_DLL herr_t H5Gunlink(hid_t loc_id, const char *name);
158 H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size,
159     char *buf/*out*/);
160 H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment);
161 H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize,
162     char *buf);
163 H5_DLL herr_t H5Giterate(hid_t loc_id, const char *name, int *idx,
164         H5G_iterate_t op, void *op_data);
165 H5_DLL herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs);
166 H5_DLL herr_t H5Gget_objinfo(hid_t loc_id, const char *name,
167     hbool_t follow_link, H5G_stat_t *statbuf/*out*/);
168 H5_DLL ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char* name,
169     size_t size);
170 H5_DLL H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx);
171 
172 #endif /* H5_NO_DEPRECATED_SYMBOLS */
173 
174 #ifdef __cplusplus
175 }
176 #endif
177 #endif /* _H5Gpublic_H */
178 +/
179