H5Tprivate.h

00001 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00002  * Copyright by The HDF Group.                                               *
00003  * Copyright by the Board of Trustees of the University of Illinois.         *
00004  * All rights reserved.                                                      *
00005  *                                                                           *
00006  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
00007  * terms governing use, modification, and redistribution, is contained in    *
00008  * the files COPYING and Copyright.html.  COPYING can be found at the root   *
00009  * of the source code distribution tree; Copyright.html can be found at the  *
00010  * root level of an installed copy of the electronic HDF5 document set and   *
00011  * is linked from the top-level documents page.  It can also be found at     *
00012  * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
00013  * access to either file, you may request a copy from help@hdfgroup.org.     *
00014  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00015 
00016 /*
00017  * This file contains private information about the H5T module
00018  */
00019 #ifndef _H5Tprivate_H
00020 #define _H5Tprivate_H
00021 
00022 /* Get package's public header */
00023 #include "H5Tpublic.h"
00024 
00025 /* Other public headers needed by this file */
00026 #include "H5MMpublic.h"         /* Memory management                    */
00027 
00028 /* Private headers needed by this file */
00029 #include "H5private.h"          /* Generic Functions                    */
00030 #include "H5Gprivate.h"         /* Groups                               */
00031 #include "H5Rprivate.h"         /* References                           */
00032 
00033 /* Macro for size of temporary buffers to contain a single element */
00034 #define H5T_ELEM_BUF_SIZE       256
00035 
00036 /* If the module using this macro is allowed access to the private variables, access them directly */
00037 #ifdef H5T_PACKAGE
00038 #define H5T_GET_SIZE(T)                 ((T)->shared->size)
00039 #define H5T_GET_SHARED(T)               ((T)->shared)
00040 #define H5T_GET_MEMBER_OFFSET(T, I)     ((T)->u.compnd.memb[I].offset)
00041 #define H5T_GET_MEMBER_SIZE(T, I)       ((T)->u.compnd.memb[I].shared->size)
00042 #else /* H5T_PACKAGE */
00043 #define H5T_GET_SIZE(T)                 (H5T_get_size(T))
00044 #define H5T_GET_SHARED(T)               (H5T_get_shared(T))
00045 #define H5T_GET_MEMBER_OFFSET(T, I)     (H5T_get_member_offset((T), (I)))
00046 #define H5T_GET_MEMBER_SIZE(T, I)       (H5T_get_member_size((T), (I)))
00047 #endif /* H5T_PACKAGE */
00048 
00049 /* Forward references of package typedefs (declared in H5Tpkg.h) */
00050 typedef struct H5T_t H5T_t;
00051 typedef struct H5T_stats_t H5T_stats_t;
00052 typedef struct H5T_path_t H5T_path_t;
00053 
00054 /* How to copy a datatype */
00055 typedef enum H5T_copy_t {
00056     H5T_COPY_TRANSIENT,
00057     H5T_COPY_ALL,
00058     H5T_COPY_REOPEN
00059 } H5T_copy_t;
00060 
00061 /* Location of datatype information */
00062 typedef enum {
00063     H5T_LOC_BADLOC =   0,  /* invalid datatype location */
00064     H5T_LOC_MEMORY,        /* data stored in memory */
00065     H5T_LOC_DISK,          /* data stored on disk */
00066     H5T_LOC_MAXLOC         /* highest value (Invalid as true value) */
00067 } H5T_loc_t;
00068 
00069 /* VL allocation information */
00070 typedef struct {
00071     H5MM_allocate_t alloc_func; /* Allocation function */
00072     void *alloc_info;           /* Allocation information */
00073     H5MM_free_t free_func;      /* Free function */
00074     void *free_info;            /* Free information */
00075 } H5T_vlen_alloc_info_t;
00076 
00077 /* Structure for conversion callback property */
00078 typedef struct H5T_conv_cb_t {
00079     H5T_conv_except_func_t      func;
00080     void*                       user_data;
00081 } H5T_conv_cb_t;
00082 
00083 /* Values for the optimization of compound data reading and writing.  They indicate
00084  * whether the fields of the source and destination are subset of each other and
00085  * there is no conversion needed.
00086  */
00087 typedef enum {
00088     H5T_SUBSET_BADVALUE = -1,   /* Invalid value */
00089     H5T_SUBSET_FALSE = 0,       /* Source and destination aren't subset of each other */
00090     H5T_SUBSET_SRC,             /* Source is the subset of dest and no conversion is needed */
00091     H5T_SUBSET_DST,             /* Dest is the subset of source and no conversion is needed */
00092     H5T_SUBSET_CAP              /* Must be the last value */
00093 } H5T_subset_t;
00094 
00095 typedef struct H5T_subset_info_t {
00096     H5T_subset_t    subset;     /* See above */
00097     size_t          copy_size;  /* Size in bytes, to copy for each element */
00098 } H5T_subset_info_t;
00099 
00100 /* Forward declarations for prototype arguments */
00101 struct H5O_t;
00102 
00103 /* The native endianess of the platform */
00104 H5_DLLVAR H5T_order_t H5T_native_order_g;
00105 
00106 /* Private functions */
00107 H5_DLL herr_t H5TN_init_interface(void);
00108 H5_DLL herr_t H5T_init(void);
00109 H5_DLL H5T_t *H5T_copy(const H5T_t *old_dt, H5T_copy_t method);
00110 H5_DLL herr_t H5T_lock(H5T_t *dt, hbool_t immutable);
00111 H5_DLL herr_t H5T_close(H5T_t *dt);
00112 H5_DLL H5T_t *H5T_get_super(const H5T_t *dt);
00113 H5_DLL H5T_class_t H5T_get_class(const H5T_t *dt, htri_t internal);
00114 H5_DLL htri_t H5T_detect_class(const H5T_t *dt, H5T_class_t cls);
00115 H5_DLL size_t H5T_get_size(const H5T_t *dt);
00116 H5_DLL int    H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset);
00117 H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE * stream);
00118 H5_DLL struct H5O_loc_t *H5T_oloc(H5T_t *dt);
00119 H5_DLL H5G_name_t *H5T_nameof(H5T_t *dt);
00120 H5_DLL htri_t H5T_is_immutable(const H5T_t *dt);
00121 H5_DLL htri_t H5T_is_named(const H5T_t *dt);
00122 H5_DLL htri_t H5T_is_relocatable(const H5T_t *dt);
00123 H5_DLL H5T_path_t *H5T_path_find(const H5T_t *src, const H5T_t *dst,
00124     const char *name, H5T_conv_t func, hid_t dxpl_id, hbool_t is_api);
00125 H5_DLL hbool_t H5T_path_noop(const H5T_path_t *p);
00126 H5_DLL H5T_bkg_t H5T_path_bkg(const H5T_path_t *p);
00127 H5_DLL H5T_subset_info_t *H5T_path_compound_subset(const H5T_path_t *p);
00128 H5_DLL herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id,
00129     size_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg,
00130     hid_t dset_xfer_plist);
00131 H5_DLL herr_t H5T_vlen_reclaim(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *_op_data);
00132 H5_DLL herr_t H5T_vlen_get_alloc_info(hid_t dxpl_id, H5T_vlen_alloc_info_t **vl_alloc_info);
00133 H5_DLL htri_t H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc);
00134 H5_DLL htri_t H5T_is_sensible(const H5T_t *dt);
00135 H5_DLL uint32_t H5T_hash(H5F_t * file, const H5T_t *dt);
00136 H5_DLL herr_t H5T_set_latest_version(H5T_t *dt);
00137 H5_DLL htri_t H5T_is_variable_str(const H5T_t *dt);
00138 
00139 /* Reference specific functions */
00140 H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt);
00141 
00142 /* Operations on named datatypes */
00143 H5_DLL H5T_t *H5T_open(const H5G_loc_t *loc, hid_t dxpl_id);
00144 H5_DLL htri_t H5T_committed(const H5T_t *type);
00145 H5_DLL int H5T_link(const H5T_t *type, int adjust, hid_t dxpl_id);
00146 H5_DLL herr_t H5T_update_shared(H5T_t *type);
00147 
00148 /* Field functions (for both compound & enumerated types) */
00149 H5_DLL int H5T_get_nmembers(const H5T_t *dt);
00150 H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, unsigned membno, H5T_copy_t method);
00151 H5_DLL size_t H5T_get_member_offset(const H5T_t *dt, unsigned membno);
00152 
00153 /* Atomic functions */
00154 H5_DLL H5T_order_t H5T_get_order(const H5T_t *dt);
00155 H5_DLL size_t H5T_get_precision(const H5T_t *dt);
00156 H5_DLL int H5T_get_offset(const H5T_t *dt);
00157 
00158 /* Fixed-point functions */
00159 H5_DLL H5T_sign_t H5T_get_sign(H5T_t const *dt);
00160 
00161 #endif /* _H5Tprivate_H */
00162