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.H5Fpublic;
17 
18 /*
19  * This file contains public declarations for the H5F module.
20  */
21 
22 /++ HEADERS
23 /* Public header files needed by this file */
24 #include "H5ACpublic.h"
25 +/
26 import hdf5.H5public;
27 import hdf5.H5Ipublic;
28 
29 extern(C):
30 
31 /*
32  * These are the bits that can be passed to the `flags' argument of
33  * H5Fcreate() and H5Fopen(). Use the bit-wise OR operator (|) to combine
34  * them as needed.  As a side effect, they call H5check_version() to make sure
35  * that the application is compiled with a version of the hdf5 header files
36  * which are compatible with the library to which the application is linked.
37  * We're assuming that these constants are used rather early in the hdf5
38  * session.
39  *
40  */
41 enum H5F_ACC_RDONLY  = 0x0000u; /*absence of rdwr => rd-only */
42 enum H5F_ACC_RDWR    = 0x0001u; /*open for read and write    */
43 enum H5F_ACC_TRUNC   = 0x0002u; /*overwrite existing files   */
44 enum H5F_ACC_EXCL    = 0x0004u; /*fail if file already exists*/
45 enum H5F_ACC_DEBUG   = 0x0008u; /*print debug info	     */
46 enum H5F_ACC_CREAT   = 0x0010u; /*create non-existing files  */
47 
48 /* Value passed to H5Pset_elink_acc_flags to cause flags to be taken from the
49  * parent file. */
50 enum H5F_ACC_DEFAULT = 0xffffu; /*ignore setting on lapl     */
51 
52 /* Flags for H5Fget_obj_count() & H5Fget_obj_ids() calls */
53 enum H5F_OBJ_FILE    = 0x0001u; /* File objects */
54 enum H5F_OBJ_DATASET = 0x0002u; /* Dataset objects */
55 enum H5F_OBJ_GROUP   = 0x0004u; /* Group objects */
56 enum H5F_OBJ_DATATYPE= 0x0008u; /* Named datatype objects */
57 enum H5F_OBJ_ATTR    = 0x0010u; /* Attribute objects */
58 enum H5F_OBJ_ALL     = (H5F_OBJ_FILE|H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_DATATYPE|H5F_OBJ_ATTR);
59 enum H5F_OBJ_LOCAL   = 0x0020u; /* Restrict search to objects opened through current file ID */
60                                 /* (as opposed to objects opened through any file ID accessing this file) */
61 
62 
63 enum H5F_FAMILY_DEFAULT = cast(hsize_t) 0;
64 
65 /*
66  * Use this constant string as the MPI_Info key to set H5Fmpio debug flags.
67  * To turn on H5Fmpio debug flags, set the MPI_Info value with this key to
68  * have the value of a string consisting of the characters that turn on the
69  * desired flags.
70  */
71 enum H5F_MPIO_DEBUG_KEY = "H5F_mpio_debug_key";
72 
73 /* The difference between a single file and a set of mounted files */
74 enum H5F_scope_t {
75     H5F_SCOPE_LOCAL	= 0,	/*specified file handle only		*/
76     H5F_SCOPE_GLOBAL	= 1 	/*entire virtual file			*/
77 }
78 
79 /* Unlimited file size for H5Pset_external() */
80 enum H5F_UNLIMITED = (cast(hsize_t)(-1L));
81 
82 /* How does file close behave?
83  * H5F_CLOSE_DEFAULT - Use the degree pre-defined by underlining VFL
84  * H5F_CLOSE_WEAK    - file closes only after all opened objects are closed
85  * H5F_CLOSE_SEMI    - if no opened objects, file is close; otherwise, file
86 		       close fails
87  * H5F_CLOSE_STRONG  - if there are opened objects, close them first, then
88 		       close file
89  */
90 enum H5F_close_degree_t {
91     H5F_CLOSE_DEFAULT   = 0,
92     H5F_CLOSE_WEAK      = 1,
93     H5F_CLOSE_SEMI      = 2,
94     H5F_CLOSE_STRONG    = 3
95 }
96 
97 /* Current "global" information about file */
98 /* (just size info currently) */
99 struct H5F_info_t {
100     hsize_t		super_ext_size;	/* Superblock extension size */
101     struct {
102 	hsize_t		hdr_size;       /* Shared object header message header size */
103 	H5_ih_info_t	msgs_info;      /* Shared object header message index & heap size */
104     };
105 }
106 
107 /*
108  * Types of allocation requests. The values larger than H5FD_MEM_DEFAULT
109  * should not change other than adding new types to the end. These numbers
110  * might appear in files.
111  *
112  * Note: please change the log VFD flavors array if you change this
113  * enumeration.
114  */
115 enum H5F_mem_t {
116     H5FD_MEM_NOLIST     = -1,   /* Data should not appear in the free list.
117                                  * Must be negative.
118                                  */
119     H5FD_MEM_DEFAULT    = 0,    /* Value not yet set.  Can also be the
120                                  * datatype set in a larger allocation
121                                  * that will be suballocated by the library.
122                                  * Must be zero.
123                                  */
124     H5FD_MEM_SUPER      = 1,    /* Superblock data */
125     H5FD_MEM_BTREE      = 2,    /* B-tree data */
126     H5FD_MEM_DRAW       = 3,    /* Raw data (content of datasets, etc.) */
127     H5FD_MEM_GHEAP      = 4,    /* Global heap data */
128     H5FD_MEM_LHEAP      = 5,    /* Local heap data */
129     H5FD_MEM_OHDR       = 6,    /* Object header data */
130 
131     H5FD_MEM_NTYPES             /* Sentinel value - must be last */
132 }
133 
134 /* Library's file format versions */
135 enum H5F_libver_t {
136     H5F_LIBVER_EARLIEST,        /* Use the earliest possible format for storing objects */
137     H5F_LIBVER_LATEST           /* Use the latest possible format available for storing objects*/
138 }
139 
140 /* Define file format version for 1.8 to prepare for 1.10 release.  
141  * (Not used anywhere now)*/
142 // #define H5F_LIBVER_18 H5F_LIBVER_LATEST
143 
144 /* Functions in H5F.c */
145 version(Posix) {
146   htri_t H5Fis_hdf5(const char *filename);
147   hid_t  H5Fcreate(const char *filename, uint flags,
148                    hid_t create_plist, hid_t access_plist);
149   hid_t  H5Fopen(const char *filename, uint flags,
150                  hid_t access_plist);
151   hid_t  H5Freopen(hid_t file_id);
152   herr_t H5Fflush(hid_t object_id, H5F_scope_t _scope);
153   herr_t H5Fclose(hid_t file_id);
154   hid_t  H5Fget_create_plist(hid_t file_id);
155   hid_t  H5Fget_access_plist(hid_t file_id);
156   herr_t H5Fget_intent(hid_t file_id, uint * intent);
157   ssize_t H5Fget_obj_count(hid_t file_id, uint types);
158   ssize_t H5Fget_obj_ids(hid_t file_id, uint types, size_t max_objs, hid_t *obj_id_list);
159   herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle);
160   herr_t H5Fmount(hid_t loc, const char *name, hid_t child, hid_t plist);
161   herr_t H5Funmount(hid_t loc, const char *name);
162   hssize_t H5Fget_freespace(hid_t file_id);
163   herr_t H5Fget_filesize(hid_t file_id, hsize_t *size);
164   ssize_t H5Fget_file_image(hid_t file_id, void * buf_ptr, size_t buf_len);
165 /++
166   herr_t H5Fget_mdc_config(hid_t file_id,
167                            H5AC_cache_config_t * config_ptr);
168   herr_t H5Fset_mdc_config(hid_t file_id,
169                            H5AC_cache_config_t * config_ptr);
170 +/
171   herr_t H5Fget_mdc_hit_rate(hid_t file_id, double * hit_rate_ptr);
172   herr_t H5Fget_mdc_size(hid_t file_id,
173                          size_t * max_size_ptr,
174                          size_t * min_clean_size_ptr,
175                          size_t * cur_size_ptr,
176                          int * cur_num_entries_ptr);
177   herr_t H5Freset_mdc_hit_rate_stats(hid_t file_id);
178   ssize_t H5Fget_name(hid_t obj_id, char *name, size_t size);
179   herr_t H5Fget_info(hid_t obj_id, H5F_info_t *bh_info);
180   herr_t H5Fclear_elink_file_cache(hid_t file_id);
181   herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag);
182   herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag);
183 }