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 COPYING file, which can be found at the root of the source code * 9 * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * 10 * If you do not have access to either file, you may request a copy from * 11 * help@hdfgroup.org. * 12 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 13 14 /* 15 * This file contains private information about the H5T module 16 */ 17 #ifndef _H5Tprivate_H 18 #define _H5Tprivate_H 19 20 /* Get package's public header */ 21 #include "H5Tpublic.h" 22 23 /* Other public headers needed by this file */ 24 #include "H5MMpublic.h" /* Memory management */ 25 26 /* Private headers needed by this file */ 27 #include "H5private.h" /* Generic Functions */ 28 #include "H5Gprivate.h" /* Groups */ 29 #include "H5Rprivate.h" /* References */ 30 31 /* Macro for size of temporary buffers to contain a single element */ 32 #define H5T_ELEM_BUF_SIZE 256 33 34 /* If the module using this macro is allowed access to the private variables, access them directly */ 35 #ifdef H5T_MODULE 36 #define H5T_GET_SIZE(T) ((T)->shared->size) 37 #define H5T_GET_SHARED(T) ((T)->shared) 38 #define H5T_GET_MEMBER_OFFSET(T, I) ((T)->u.compnd.memb[I].offset) 39 #define H5T_GET_MEMBER_SIZE(T, I) ((T)->u.compnd.memb[I].shared->size) 40 #else /* H5T_MODULE */ 41 #define H5T_GET_SIZE(T) (H5T_get_size(T)) 42 #define H5T_GET_SHARED(T) (H5T_get_shared(T)) 43 #define H5T_GET_MEMBER_OFFSET(T, I) (H5T_get_member_offset((T), (I))) 44 #define H5T_GET_MEMBER_SIZE(T, I) (H5T_get_member_size((T), (I))) 45 #endif /* H5T_MODULE */ 46 47 /* Forward references of package typedefs (declared in H5Tpkg.h) */ 48 typedef struct H5T_t H5T_t; 49 typedef struct H5T_stats_t H5T_stats_t; 50 typedef struct H5T_path_t H5T_path_t; 51 52 /* How to copy a datatype */ 53 typedef enum H5T_copy_t { 54 H5T_COPY_TRANSIENT, 55 H5T_COPY_ALL, 56 H5T_COPY_REOPEN 57 } H5T_copy_t; 58 59 /* Location of datatype information */ 60 typedef enum { 61 H5T_LOC_BADLOC = 0, /* invalid datatype location */ 62 H5T_LOC_MEMORY, /* data stored in memory */ 63 H5T_LOC_DISK, /* data stored on disk */ 64 H5T_LOC_MAXLOC /* highest value (Invalid as true value) */ 65 } H5T_loc_t; 66 67 /* VL allocation information */ 68 typedef struct { 69 H5MM_allocate_t alloc_func; /* Allocation function */ 70 void *alloc_info; /* Allocation information */ 71 H5MM_free_t free_func; /* Free function */ 72 void *free_info; /* Free information */ 73 } H5T_vlen_alloc_info_t; 74 75 /* Structure for conversion callback property */ 76 typedef struct H5T_conv_cb_t { 77 H5T_conv_except_func_t func; 78 void* user_data; 79 } H5T_conv_cb_t; 80 81 /* Values for the optimization of compound data reading and writing. They indicate 82 * whether the fields of the source and destination are subset of each other and 83 * there is no conversion needed. 84 */ 85 typedef enum { 86 H5T_SUBSET_BADVALUE = -1, /* Invalid value */ 87 H5T_SUBSET_FALSE = 0, /* Source and destination aren't subset of each other */ 88 H5T_SUBSET_SRC, /* Source is the subset of dest and no conversion is needed */ 89 H5T_SUBSET_DST, /* Dest is the subset of source and no conversion is needed */ 90 H5T_SUBSET_CAP /* Must be the last value */ 91 } H5T_subset_t; 92 93 typedef struct H5T_subset_info_t { 94 H5T_subset_t subset; /* See above */ 95 size_t copy_size; /* Size in bytes, to copy for each element */ 96 } H5T_subset_info_t; 97 98 /* Forward declarations for prototype arguments */ 99 struct H5O_t; 100 101 /* The native endianess of the platform */ 102 H5_DLLVAR H5T_order_t H5T_native_order_g; 103 104 /* Private functions */ 105 H5_DLL herr_t H5T_init(void); 106 H5_DLL H5T_t *H5T_copy(H5T_t *old_dt, H5T_copy_t method); 107 H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable); 108 H5_DLL herr_t H5T_close(H5T_t *dt); 109 H5_DLL H5T_t *H5T_get_super(const H5T_t *dt); 110 H5_DLL H5T_class_t H5T_get_class(const H5T_t *dt, htri_t internal); 111 H5_DLL htri_t H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_api); 112 H5_DLL size_t H5T_get_size(const H5T_t *dt); 113 H5_DLL int H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset); 114 H5_DLL herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc); 115 H5_DLL H5T_t *H5T_decode(const unsigned char *buf); 116 H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE * stream); 117 H5_DLL struct H5O_loc_t *H5T_oloc(H5T_t *dt); 118 H5_DLL H5G_name_t *H5T_nameof(H5T_t *dt); 119 H5_DLL htri_t H5T_is_immutable(const H5T_t *dt); 120 H5_DLL htri_t H5T_is_named(const H5T_t *dt); 121 H5_DLL herr_t H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f); 122 H5_DLL htri_t H5T_is_relocatable(const H5T_t *dt); 123 H5_DLL H5T_path_t *H5T_path_find(const H5T_t *src, const H5T_t *dst, 124 const char *name, H5T_conv_t func, hid_t dxpl_id, hbool_t is_api); 125 H5_DLL hbool_t H5T_path_noop(const H5T_path_t *p); 126 H5_DLL H5T_bkg_t H5T_path_bkg(const H5T_path_t *p); 127 H5_DLL H5T_subset_info_t *H5T_path_compound_subset(const H5T_path_t *p); 128 H5_DLL herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, 129 size_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, 130 hid_t dset_xfer_plist); 131 H5_DLL herr_t H5T_vlen_reclaim(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *_op_data); 132 H5_DLL herr_t H5T_vlen_reclaim_elmt(void *elem, H5T_t *dt, hid_t dxpl_id); 133 H5_DLL herr_t H5T_vlen_get_alloc_info(hid_t dxpl_id, H5T_vlen_alloc_info_t **vl_alloc_info); 134 H5_DLL htri_t H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc); 135 H5_DLL htri_t H5T_is_sensible(const H5T_t *dt); 136 H5_DLL uint32_t H5T_hash(H5F_t * file, const H5T_t *dt); 137 H5_DLL herr_t H5T_set_latest_version(H5T_t *dt); 138 H5_DLL herr_t H5T_patch_file(H5T_t *dt, H5F_t *f); 139 H5_DLL herr_t H5T_patch_vlen_file(H5T_t *dt, H5F_t *f); 140 H5_DLL htri_t H5T_is_variable_str(const H5T_t *dt); 141 142 /* Reference specific functions */ 143 H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt); 144 145 /* Operations on named datatypes */ 146 H5_DLL H5T_t *H5T_open(const H5G_loc_t *loc, hid_t dxpl_id); 147 H5_DLL htri_t H5T_committed(const H5T_t *type); 148 H5_DLL int H5T_link(const H5T_t *type, int adjust, hid_t dxpl_id); 149 H5_DLL herr_t H5T_update_shared(H5T_t *type); 150 151 /* Field functions (for both compound & enumerated types) */ 152 H5_DLL int H5T_get_nmembers(const H5T_t *dt); 153 H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, unsigned membno, H5T_copy_t method); 154 H5_DLL size_t H5T_get_member_offset(const H5T_t *dt, unsigned membno); 155 156 /* Atomic functions */ 157 H5_DLL H5T_order_t H5T_get_order(const H5T_t *dt); 158 H5_DLL size_t H5T_get_precision(const H5T_t *dt); 159 H5_DLL int H5T_get_offset(const H5T_t *dt); 160 161 /* Fixed-point functions */ 162 H5_DLL H5T_sign_t H5T_get_sign(H5T_t const *dt); 163 164 #endif /* _H5Tprivate_H */ 165 166