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 module hdf5.H5Opublic;
17 
18 /*-------------------------------------------------------------------------
19  *
20  * Created:             H5Opublic.h
21  *                      Aug  5 1997
22  *                      Robb Matzke <matzke@llnl.gov>
23  *
24  * Purpose:             Public declarations for the H5O (object header)
25  *                      package.
26  *
27  *-------------------------------------------------------------------------
28  */
29 
30 /* Public headers needed by this file */
31 public import core.stdc.stdint;
32 
33 import hdf5.H5public;
34 import hdf5.H5Ipublic;
35 import hdf5.H5Lpublic;
36 
37 extern(C):
38 
39 /*****************/
40 /* Public Macros */
41 /*****************/
42 
43 /* Flags for object copy (H5Ocopy) */
44 enum H5O_COPY_SHALLOW_HIERARCHY_FLAG = (0x0001u);   /* Copy only immediate members */
45 enum H5O_COPY_EXPAND_SOFT_LINK_FLAG  = (0x0002u);   /* Expand soft links into new objects */
46 enum H5O_COPY_EXPAND_EXT_LINK_FLAG   = (0x0004u);   /* Expand external links into new objects */
47 enum H5O_COPY_EXPAND_REFERENCE_FLAG  = (0x0008u);   /* Copy objects that are pointed by references */
48 enum H5O_COPY_WITHOUT_ATTR_FLAG      = (0x0010u);   /* Copy object without copying attributes */
49 enum H5O_COPY_PRESERVE_NULL_FLAG     = (0x0020u);   /* Copy NULL messages (empty space) */
50 enum H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG = (0x0040u);   /* Merge committed datatypes in dest file */
51 enum H5O_COPY_ALL                    =(0x007Fu);   /* All object copying flags (for internal checking) */
52 
53 /* Flags for shared message indexes.
54  * Pass these flags in using the mesg_type_flags parameter in
55  * H5P_set_shared_mesg_index.
56  * (Developers: These flags correspond to object header message type IDs,
57  * but we need to assign each kind of message to a different bit so that
58  * one index can hold multiple types.)
59  */
60 enum H5O_SHMESG_NONE_FLAG    = 0x0000;          /* No shared messages */
61 enum H5O_SHMESG_SDSPACE_FLAG = (cast(uint)1 << 0x0001); /* Simple Dataspace Message.  */
62 enum H5O_SHMESG_DTYPE_FLAG   = (cast(uint)1 << 0x0003); /* Datatype Message.  */
63 enum H5O_SHMESG_FILL_FLAG    = (cast(uint)1 << 0x0005); /* Fill Value Message. */
64 enum H5O_SHMESG_PLINE_FLAG   = (cast(uint)1 << 0x000b); /* Filter pipeline message.  */
65 enum H5O_SHMESG_ATTR_FLAG    = (cast(uint)1 << 0x000c); /* Attribute Message.  */
66 enum H5O_SHMESG_ALL_FLAG     = (H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG | H5O_SHMESG_FILL_FLAG | H5O_SHMESG_PLINE_FLAG | H5O_SHMESG_ATTR_FLAG);
67 
68 /* Object header status flag definitions */
69 enum H5O_HDR_CHUNK0_SIZE             = 0x03;    /* 2-bit field indicating # of bytes to store the size of chunk 0's data */
70 enum H5O_HDR_ATTR_CRT_ORDER_TRACKED  = 0x04;    /* Attribute creation order is tracked */
71 enum H5O_HDR_ATTR_CRT_ORDER_INDEXED  = 0x08;    /* Attribute creation order has index */
72 enum H5O_HDR_ATTR_STORE_PHASE_CHANGE = 0x10;    /* Non-default attribute storage phase change values stored */
73 enum H5O_HDR_STORE_TIMES             = 0x20;    /* Store access, modification, change & birth times for object */
74 enum H5O_HDR_ALL_FLAGS = (H5O_HDR_CHUNK0_SIZE | H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | H5O_HDR_ATTR_STORE_PHASE_CHANGE | H5O_HDR_STORE_TIMES);
75 
76 /* Maximum shared message values.  Number of indexes is 8 to allow room to add
77  * new types of messages.
78  */
79 enum H5O_SHMESG_MAX_NINDEXES = 8;
80 enum H5O_SHMESG_MAX_LIST_SIZE = 5000;
81 
82 /*******************/
83 /* Public Typedefs */
84 /*******************/
85 
86 /* Types of objects in file */
87 enum H5O_type_t {
88     H5O_TYPE_UNKNOWN = -1,	/* Unknown object type		*/
89     H5O_TYPE_GROUP,	        /* Object is a group		*/
90     H5O_TYPE_DATASET,		/* Object is a dataset		*/
91     H5O_TYPE_NAMED_DATATYPE, 	/* Object is a named data type	*/
92     H5O_TYPE_NTYPES             /* Number of different object types (must be last!) */
93 }
94 
95 /* Information struct for object header metadata (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) */
96 struct H5O_hdr_info_t {
97     uint _version;		/* Version number of header format in file */
98     uint nmesgs;		/* Number of object header messages */
99     uint nchunks;		/* Number of object header chunks */
100     uint flags;             /* Object header status flags */
101     struct space {
102         hsize_t total;		/* Total space for storing object header in file */
103         hsize_t meta;		/* Space within header for object header metadata information */
104         hsize_t mesg;		/* Space within header for actual message information */
105         hsize_t free;		/* Free space within object header */
106     }
107     struct mesg {
108         uint64_t present;	/* Flags to indicate presence of message type in header */
109         uint64_t _shared;	/* Flags to indicate message type is shared in header */
110     }
111 }
112 
113 /* Information struct for object (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) */
114 struct H5O_info_t {
115     uint 	fileno;		/* File number that object is located in */
116     haddr_t 		addr;		/* Object address in file	*/
117     H5O_type_t 		type;		/* Basic object type (group, dataset, etc.) */
118     uint 		rc;		/* Reference count of object    */
119     time_t		atime;		/* Access time			*/
120     time_t		mtime;		/* Modification time		*/
121     time_t		ctime;		/* Change time			*/
122     time_t		btime;		/* Birth time			*/
123     hsize_t 		num_attrs;	/* # of attributes attached to object */
124     H5O_hdr_info_t      hdr;            /* Object header information */
125     /* Extra metadata storage for obj & attributes */
126     struct meta_size {
127         H5_ih_info_t   obj;             /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
128         H5_ih_info_t   attr;            /* v2 B-tree & heap for attributes */
129     }
130 }
131 
132 /* Typedef for message creation indexes */
133 alias H5O_msg_crt_idx_t = uint32_t;
134 
135 /* Prototype for H5Ovisit/H5Ovisit_by_name() operator */
136 alias H5O_iterate_t = herr_t function(hid_t obj, const char *name, const H5O_info_t *info,
137     void *op_data);
138 
139 enum H5O_mcdt_search_ret_t {
140     H5O_MCDT_SEARCH_ERROR = -1,	/* Abort H5Ocopy */
141     H5O_MCDT_SEARCH_CONT,	/* Continue the global search of all committed datatypes in the destination file */
142     H5O_MCDT_SEARCH_STOP	/* Stop the search, but continue copying.  The committed datatype will be copied but not merged. */
143 };
144 
145 /* Callback to invoke when completing the search for a matching committed datatype from the committed dtype list */
146 alias H5O_mcdt_search_cb_t = H5O_mcdt_search_ret_t function(void *op_data);
147 
148 /********************/
149 /* Public Variables */
150 /********************/
151 
152 version(Posix) {
153 /*********************/
154 /* Public Prototypes */
155 /*********************/
156 hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id);
157 hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr);
158 hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name,
159     H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id);
160 htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id);
161 herr_t H5Oget_info(hid_t loc_id, H5O_info_t *oinfo);
162 herr_t H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo,
163     hid_t lapl_id);
164 herr_t H5Oget_info_by_idx(hid_t loc_id, const char *group_name,
165     H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo,
166     hid_t lapl_id);
167 herr_t H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name,
168     hid_t lcpl_id, hid_t lapl_id);
169 herr_t H5Oincr_refcount(hid_t object_id);
170 herr_t H5Odecr_refcount(hid_t object_id);
171 herr_t H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
172     const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id);
173 herr_t H5Oset_comment(hid_t obj_id, const char *comment);
174 herr_t H5Oset_comment_by_name(hid_t loc_id, const char *name,
175     const char *comment, hid_t lapl_id);
176 ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize);
177 ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name,
178     char *comment, size_t bufsize, hid_t lapl_id);
179 herr_t H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
180     H5O_iterate_t op, void *op_data);
181 herr_t H5Ovisit_by_name(hid_t loc_id, const char *obj_name,
182     H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op,
183     void *op_data, hid_t lapl_id);
184 herr_t H5Oclose(hid_t object_id);
185 }
186 
187 /++ DEPRECATED
188 /* Symbols defined for compatibility with previous versions of the HDF5 API.
189  *
190  * Use of these symbols is deprecated.
191  */
192 #ifndef H5_NO_DEPRECATED_SYMBOLS
193 
194 /* Macros */
195 
196 /* Typedefs */
197 
198 /* A struct that's part of the H5G_stat_t routine (deprecated) */
199 typedef struct H5O_stat_t {
200     hsize_t size;               /* Total size of object header in file */
201     hsize_t free;               /* Free space within object header */
202     unsigned nmesgs;            /* Number of object header messages */
203     unsigned nchunks;           /* Number of object header chunks */
204 } H5O_stat_t;
205 
206 /* Function prototypes */
207 
208 #endif /* H5_NO_DEPRECATED_SYMBOLS */
209 +/
210