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 modulehdf5.H5Lpublic;
17 18 /*-------------------------------------------------------------------------
19 *
20 * Created: H5Lpublic.h
21 * Dec 1 2005
22 * James Laird
23 *
24 * Purpose: Public declarations for the H5L package (links)
25 *
26 *-------------------------------------------------------------------------
27 */28 29 /* Public headers needed by this file */30 publicimportcore.stdc.time;
31 32 importhdf5.H5public;
33 importhdf5.H5Ipublic;
34 importhdf5.H5Tpublic;
35 36 extern(C):
37 38 /*****************/39 /* Public Macros */40 /*****************/41 42 /* Maximum length of a link's name */43 /* (encoded in a 32-bit unsigned integer) */44 enumH5L_MAX_LINK_NAME_LEN = (cast(uint32_t)(-1)); /* (4GB - 1) */45 46 /* Macro to indicate operation occurs on same location */47 enumH5L_SAME_LOC = 0;
48 49 /* Current version of the H5L_class_t struct */50 enumH5L_LINK_CLASS_T_VERS = 0;
51 52 /*******************/53 /* Public Typedefs */54 /*******************/55 56 /* Link class types.
57 * Values less than 64 are reserved for the HDF5 library's internal use.
58 * Values 64 to 255 are for "user-defined" link class types; these types are
59 * defined by HDF5 but their behavior can be overridden by users.
60 * Users who want to create new classes of links should contact the HDF5
61 * development team at hdfhelp@ncsa.uiuc.edu .
62 * These values can never change because they appear in HDF5 files.
63 */64 enumH5L_type_t {
65 H5L_TYPE_ERROR = (-1), /* Invalid link type id */66 H5L_TYPE_HARD = 0, /* Hard link id */67 H5L_TYPE_SOFT = 1, /* Soft link id */68 H5L_TYPE_EXTERNAL = 64, /* External link id */69 H5L_TYPE_MAX = 255/* Maximum link type id */70 };
71 enumH5L_TYPE_BUILTIN_MAX = H5L_type_t.H5L_TYPE_SOFT; /* Maximum value link value for "built-in" link types */72 enumH5L_TYPE_UD_MIN = H5L_type_t.H5L_TYPE_EXTERNAL; /* Link ids at or above this value are "user-defined" link types. */73 74 /* Information struct for link (for H5Lget_info/H5Lget_info_by_idx) */75 structH5L_info_t {
76 H5L_type_ttype; /* Type of link */77 hbool_tcorder_valid; /* Indicate if creation order is valid */78 int64_tcorder; /* Creation order */79 H5T_cset_tcset; /* Character set of link name */80 unionu {
81 haddr_taddress; /* Address hard link points to */82 size_tval_size; /* Size of a soft link or UD link value */83 };
84 }
85 86 /* The H5L_class_t struct can be used to override the behavior of a
87 * "user-defined" link class. Users should populate the struct with callback
88 * functions defined below.
89 */90 /* Callback prototypes for user-defined links */91 /* Link creation callback */92 aliasH5L_create_func_t = herr_tfunction(constchar *link_name, hid_tloc_group,
93 constvoid *lnkdata, size_tlnkdata_size, hid_tlcpl_id);
94 95 /* Callback for when the link is moved */96 aliasH5L_move_func_t = herr_tfunction(constchar *new_name, hid_tnew_loc,
97 constvoid *lnkdata, size_tlnkdata_size);
98 99 /* Callback for when the link is copied */100 aliasH5L_copy_func_t = herr_tfunction(constchar *new_name, hid_tnew_loc,
101 constvoid *lnkdata, size_tlnkdata_size);
102 103 /* Callback during link traversal */104 aliasH5L_traverse_func_t = herr_tfunction(constchar *link_name, hid_tcur_group,
105 constvoid *lnkdata, size_tlnkdata_size, hid_tlapl_id);
106 107 /* Callback for when the link is deleted */108 aliasH5L_delete_func_t = herr_tfunction(constchar *link_name, hid_tfile,
109 constvoid *lnkdata, size_tlnkdata_size);
110 111 /* Callback for querying the link */112 /* Returns the size of the buffer needed */113 aliasH5L_query_func_t = ssize_tfunction(constchar *link_name, constvoid *lnkdata,
114 size_tlnkdata_size, void *buf/*out*/, size_tbuf_size);
115 116 /* User-defined link types */117 structH5L_class_t {
118 int_version; /* Version number of this struct */119 H5L_type_tid; /* Link type ID */120 constchar *comment; /* Comment for debugging */121 H5L_create_func_tcreate_func; /* Callback during link creation */122 H5L_move_func_tmove_func; /* Callback after moving link */123 H5L_copy_func_tcopy_func; /* Callback after copying link */124 H5L_traverse_func_ttrav_func; /* Callback during link traversal */125 H5L_delete_func_tdel_func; /* Callback for link deletion */126 H5L_query_func_tquery_func; /* Callback for queries */127 }
128 129 /* Prototype for H5Literate/H5Literate_by_name() operator */130 aliasH5L_iterate_t = herr_tfunction(hid_tgroup, constchar *name, constH5L_info_t *info,
131 void *op_data);
132 133 /* Callback for external link traversal */134 aliasH5L_elink_traverse_t = herr_tfunction(constchar *parent_file_name,
135 constchar *parent_group_name, constchar *child_file_name,
136 constchar *child_object_name, uint *acc_flags, hid_tfapl_id,
137 void *op_data);
138 139 140 /********************/141 /* Public Variables */142 /********************/143 144 version(Posix) {
145 146 /*********************/147 /* Public Prototypes */148 /*********************/149 herr_tH5Lmove(hid_tsrc_loc, constchar *src_name, hid_tdst_loc,
150 constchar *dst_name, hid_tlcpl_id, hid_tlapl_id);
151 herr_tH5Lcopy(hid_tsrc_loc, constchar *src_name, hid_tdst_loc,
152 constchar *dst_name, hid_tlcpl_id, hid_tlapl_id);
153 herr_tH5Lcreate_hard(hid_tcur_loc, constchar *cur_name,
154 hid_tdst_loc, constchar *dst_name, hid_tlcpl_id, hid_tlapl_id);
155 herr_tH5Lcreate_soft(constchar *link_target, hid_tlink_loc_id,
156 constchar *link_name, hid_tlcpl_id, hid_tlapl_id);
157 herr_tH5Ldelete(hid_tloc_id, constchar *name, hid_tlapl_id);
158 herr_tH5Ldelete_by_idx(hid_tloc_id, constchar *group_name,
159 H5_index_tidx_type, H5_iter_order_torder, hsize_tn, hid_tlapl_id);
160 herr_tH5Lget_val(hid_tloc_id, constchar *name, void *buf/*out*/,
161 size_tsize, hid_tlapl_id);
162 herr_tH5Lget_val_by_idx(hid_tloc_id, constchar *group_name,
163 H5_index_tidx_type, H5_iter_order_torder, hsize_tn,
164 void *buf/*out*/, size_tsize, hid_tlapl_id);
165 htri_tH5Lexists(hid_tloc_id, constchar *name, hid_tlapl_id);
166 herr_tH5Lget_info(hid_tloc_id, constchar *name,
167 H5L_info_t *linfo/*out*/, hid_tlapl_id);
168 herr_tH5Lget_info_by_idx(hid_tloc_id, constchar *group_name,
169 H5_index_tidx_type, H5_iter_order_torder, hsize_tn,
170 H5L_info_t *linfo/*out*/, hid_tlapl_id);
171 ssize_tH5Lget_name_by_idx(hid_tloc_id, constchar *group_name,
172 H5_index_tidx_type, H5_iter_order_torder, hsize_tn,
173 char *name/*out*/, size_tsize, hid_tlapl_id);
174 herr_tH5Literate(hid_tgrp_id, H5_index_tidx_type,
175 H5_iter_order_torder, hsize_t *idx, H5L_iterate_top, void *op_data);
176 herr_tH5Literate_by_name(hid_tloc_id, constchar *group_name,
177 H5_index_tidx_type, H5_iter_order_torder, hsize_t *idx,
178 H5L_iterate_top, void *op_data, hid_tlapl_id);
179 herr_tH5Lvisit(hid_tgrp_id, H5_index_tidx_type, H5_iter_order_torder,
180 H5L_iterate_top, void *op_data);
181 herr_tH5Lvisit_by_name(hid_tloc_id, constchar *group_name,
182 H5_index_tidx_type, H5_iter_order_torder, H5L_iterate_top,
183 void *op_data, hid_tlapl_id);
184 185 /* UD link functions */186 herr_tH5Lcreate_ud(hid_tlink_loc_id, constchar *link_name,
187 H5L_type_tlink_type, constvoid *udata, size_tudata_size, hid_tlcpl_id,
188 hid_tlapl_id);
189 herr_tH5Lregister(constH5L_class_t *cls);
190 herr_tH5Lunregister(H5L_type_tid);
191 htri_tH5Lis_registered(H5L_type_tid);
192 193 /* External link functions */194 herr_tH5Lunpack_elink_val(constvoid *ext_linkval/*in*/, size_tlink_size,
195 uint *flags, constchar **filename/*out*/, constchar **obj_path/*out*/);
196 herr_tH5Lcreate_external(constchar *file_name, constchar *obj_name,
197 hid_tlink_loc_id, constchar *link_name, hid_tlcpl_id, hid_tlapl_id);
198 }
199