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 * This file contains private information about the H5T module 18 */ 19 #ifndef _H5Tprivate_H 20 #define _H5Tprivate_H 21 22 /* Get package's public header */ 23 #include "H5Tpublic.h" 24 25 /* Other public headers needed by this file */ 26 #include "H5MMpublic.h" /* Memory management */ 27 28 /* Private headers needed by this file */ 29 #include "H5private.h" /* Generic Functions */ 30 #include "H5Gprivate.h" /* Groups */ 31 #include "H5Rprivate.h" /* References */ 32 33 /* Macro for size of temporary buffers to contain a single element */ 34 #define H5T_ELEM_BUF_SIZE 256 35 36 /* If the module using this macro is allowed access to the private variables, access them directly */ 37 #ifdef H5T_PACKAGE 38 #define H5T_GET_SIZE(T) ((T)->shared->size) 39 #define H5T_GET_SHARED(T) ((T)->shared) 40 #define H5T_GET_MEMBER_OFFSET(T, I) ((T)->u.compnd.memb[I].offset) 41 #define H5T_GET_MEMBER_SIZE(T, I) ((T)->u.compnd.memb[I].shared->size) 42 #else /* H5T_PACKAGE */ 43 #define H5T_GET_SIZE(T) (H5T_get_size(T)) 44 #define H5T_GET_SHARED(T) (H5T_get_shared(T)) 45 #define H5T_GET_MEMBER_OFFSET(T, I) (H5T_get_member_offset((T), (I))) 46 #define H5T_GET_MEMBER_SIZE(T, I) (H5T_get_member_size((T), (I))) 47 #endif /* H5T_PACKAGE */ 48 49 /* Forward references of package typedefs (declared in H5Tpkg.h) */ 50 typedef struct H5T_t H5T_t; 51 typedef struct H5T_stats_t H5T_stats_t; 52 typedef struct H5T_path_t H5T_path_t; 53 54 /* How to copy a datatype */ 55 typedef enum H5T_copy_t { 56 H5T_COPY_TRANSIENT, 57 H5T_COPY_ALL, 58 H5T_COPY_REOPEN 59 } H5T_copy_t; 60 61 /* Location of datatype information */ 62 typedef enum { 63 H5T_LOC_BADLOC = 0, /* invalid datatype location */ 64 H5T_LOC_MEMORY, /* data stored in memory */ 65 H5T_LOC_DISK, /* data stored on disk */ 66 H5T_LOC_MAXLOC /* highest value (Invalid as true value) */ 67 } H5T_loc_t; 68 69 /* VL allocation information */ 70 typedef struct { 71 H5MM_allocate_t alloc_func; /* Allocation function */ 72 void *alloc_info; /* Allocation information */ 73 H5MM_free_t free_func; /* Free function */ 74 void *free_info; /* Free information */ 75 } H5T_vlen_alloc_info_t; 76 77 /* Structure for conversion callback property */ 78 typedef struct H5T_conv_cb_t { 79 H5T_conv_except_func_t func; 80 void* user_data; 81 } H5T_conv_cb_t; 82 83 /* Values for the optimization of compound data reading and writing. They indicate 84 * whether the fields of the source and destination are subset of each other and 85 * there is no conversion needed. 86 */ 87 typedef enum { 88 H5T_SUBSET_BADVALUE = -1, /* Invalid value */ 89 H5T_SUBSET_FALSE = 0, /* Source and destination aren't subset of each other */ 90 H5T_SUBSET_SRC, /* Source is the subset of dest and no conversion is needed */ 91 H5T_SUBSET_DST, /* Dest is the subset of source and no conversion is needed */ 92 H5T_SUBSET_CAP /* Must be the last value */ 93 } H5T_subset_t; 94 95 typedef struct H5T_subset_info_t { 96 H5T_subset_t subset; /* See above */ 97 size_t copy_size; /* Size in bytes, to copy for each element */ 98 } H5T_subset_info_t; 99 100 /* Forward declarations for prototype arguments */ 101 struct H5O_t; 102 103 /* The native endianess of the platform */ 104 H5_DLLVAR H5T_order_t H5T_native_order_g; 105 106 /* Private functions */ 107 H5_DLL herr_t H5TN_init_interface(void); 108 H5_DLL herr_t H5T_init(void); 109 H5_DLL H5T_t *H5T_copy(H5T_t *old_dt, H5T_copy_t method); 110 H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable); 111 H5_DLL herr_t H5T_close(H5T_t *dt); 112 H5_DLL H5T_t *H5T_get_super(const H5T_t *dt); 113 H5_DLL H5T_class_t H5T_get_class(const H5T_t *dt, htri_t internal); 114 H5_DLL htri_t H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_api); 115 H5_DLL size_t H5T_get_size(const H5T_t *dt); 116 H5_DLL int H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset); 117 H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE * stream); 118 H5_DLL struct H5O_loc_t *H5T_oloc(H5T_t *dt); 119 H5_DLL H5G_name_t *H5T_nameof(H5T_t *dt); 120 H5_DLL htri_t H5T_is_immutable(const H5T_t *dt); 121 H5_DLL htri_t H5T_is_named(const H5T_t *dt); 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 htri_t H5T_is_variable_str(const H5T_t *dt); 140 141 /* Reference specific functions */ 142 H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt); 143 144 /* Operations on named datatypes */ 145 H5_DLL H5T_t *H5T_open(const H5G_loc_t *loc, hid_t dxpl_id); 146 H5_DLL htri_t H5T_committed(const H5T_t *type); 147 H5_DLL int H5T_link(const H5T_t *type, int adjust, hid_t dxpl_id); 148 H5_DLL herr_t H5T_update_shared(H5T_t *type); 149 150 /* Field functions (for both compound & enumerated types) */ 151 H5_DLL int H5T_get_nmembers(const H5T_t *dt); 152 H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, unsigned membno, H5T_copy_t method); 153 H5_DLL size_t H5T_get_member_offset(const H5T_t *dt, unsigned membno); 154 155 /* Atomic functions */ 156 H5_DLL H5T_order_t H5T_get_order(const H5T_t *dt); 157 H5_DLL size_t H5T_get_precision(const H5T_t *dt); 158 H5_DLL int H5T_get_offset(const H5T_t *dt); 159 160 /* Fixed-point functions */ 161 H5_DLL H5T_sign_t H5T_get_sign(H5T_t const *dt); 162 163 #endif /* _H5Tprivate_H */ 164 165