HDF5  1.12.0
H5Rpkg.h
Go to the documentation of this file.
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 /* Purpose: This file contains declarations which are visible
15  * only within the H5R package. Source files outside the
16  * H5R package should include H5Rprivate.h instead.
17  */
18 #if !(defined H5R_FRIEND || defined H5R_MODULE)
19 #error "Do not include this file outside the H5R package!"
20 #endif
21 
22 #ifndef _H5Rpkg_H
23 #define _H5Rpkg_H
24 
25 /* Get package's private header */
26 #include "H5Rprivate.h"
27 
28 /* Other private headers needed by this file */
29 #include "H5Fprivate.h" /* Files */
30 #include "H5Gprivate.h" /* Groups */
31 #include "H5Oprivate.h" /* Object headers */
32 #include "H5Sprivate.h" /* Dataspaces */
33 
34 
35 /**************************/
36 /* Package Private Macros */
37 /**************************/
38 
39 /* Encode flags */
40 #define H5R_IS_EXTERNAL 0x1 /* Set when encoding reference to external file */
41 
42 /* Macros for convenience */
43 #define H5R_REF_FILENAME(x) ((x)->info.obj.filename)
44 #define H5R_REF_ATTRNAME(x) ((x)->info.attr.name)
45 
46 /* Header size */
47 #define H5R_ENCODE_HEADER_SIZE (2 * H5_SIZEOF_UINT8_T)
48 
49 /****************************/
50 /* Package Private Typedefs */
51 /****************************/
52 
53 /* Object reference */
54 typedef struct H5R_ref_priv_obj_t {
55  H5O_token_t token; /* Object token */
56  char *filename; /* File name */
58 
59 /* Region reference */
60 typedef struct H5R_ref_priv_reg_t {
61  H5R_ref_priv_obj_t obj; /* Object reference */
62  H5S_t *space; /* Selection */
64 
65 /* Attribute reference */
66 typedef struct H5R_ref_priv_attr_t {
67  H5R_ref_priv_obj_t obj; /* Object reference */
68  char *name; /* Attribute name */
70 
71 /* Generic reference type (keep it cache aligned) */
72 typedef struct H5R_ref_priv_t {
73  union {
74  H5R_ref_priv_obj_t obj;/* Object reference */
75  H5R_ref_priv_reg_t reg;/* Region reference */
76  H5R_ref_priv_attr_t attr;/* Attribute Reference */
77  } info;
78  hid_t loc_id; /* Cached location identifier */
79  uint32_t encode_size; /* Cached encoding size */
80  int8_t type; /* Reference type */
81  uint8_t token_size; /* Cached token size */
82  hbool_t app_ref; /* App ref on loc_id */
84 
85 /*****************************/
86 /* Package Private Variables */
87 /*****************************/
88 
89 
90 /******************************/
91 /* Package Private Prototypes */
92 /******************************/
93 H5_DLL herr_t H5R__create_object(const H5O_token_t *obj_token, size_t token_size, H5R_ref_priv_t *ref);
94 H5_DLL herr_t H5R__create_region(const H5O_token_t *obj_token, size_t token_size, H5S_t *space, H5R_ref_priv_t *ref);
95 H5_DLL herr_t H5R__create_attr(const H5O_token_t *obj_token, size_t token_size, const char *attr_name, H5R_ref_priv_t *ref);
97 
98 H5_DLL herr_t H5R__set_loc_id(H5R_ref_priv_t *ref, hid_t id, hbool_t inc_ref, hbool_t app_ref);
101 
103 H5_DLL htri_t H5R__equal(const H5R_ref_priv_t *ref1, const H5R_ref_priv_t *ref2);
104 H5_DLL herr_t H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref);
105 
106 H5_DLL herr_t H5R__get_obj_token(const H5R_ref_priv_t *ref, H5O_token_t *obj_token, size_t *token_size);
107 H5_DLL herr_t H5R__set_obj_token(H5R_ref_priv_t *ref, const H5O_token_t *obj_token, size_t token_size);
108 H5_DLL herr_t H5R__get_region(const H5R_ref_priv_t *ref, H5S_t *space);
109 
110 H5_DLL ssize_t H5R__get_file_name(const H5R_ref_priv_t *ref, char *buf, size_t size);
111 H5_DLL ssize_t H5R__get_attr_name(const H5R_ref_priv_t *ref, char *buf, size_t size);
112 
113 H5_DLL herr_t H5R__encode(const char *filename, const H5R_ref_priv_t *ref, unsigned char *buf, size_t *nalloc, unsigned flags);
114 H5_DLL herr_t H5R__decode(const unsigned char *buf, size_t *nbytes, H5R_ref_priv_t *ref);
115 
116 /* Native HDF5 specific routines */
117 H5_DLL herr_t H5R__encode_heap(H5F_t *f, unsigned char *buf, size_t *nalloc, const unsigned char *data, size_t data_size);
118 H5_DLL herr_t H5R__decode_heap(H5F_t *f, const unsigned char *buf, size_t *nbytes, unsigned char **data_ptr, size_t *data_size);
119 H5_DLL herr_t H5R__free_heap(H5F_t *f, const unsigned char *buf, size_t nbytes);
120 
121 H5_DLL herr_t H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type, const unsigned char *buf, H5O_token_t *obj_token);
122 
123 H5_DLL herr_t H5R__encode_token_obj_compat(const H5O_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc);
124 H5_DLL herr_t H5R__decode_token_obj_compat(const unsigned char *buf, size_t *nbytes, H5O_token_t *obj_token, size_t token_size);
125 
126 H5_DLL herr_t H5R__encode_token_region_compat(H5F_t *f, const H5O_token_t *obj_token, size_t token_size, H5S_t *space, unsigned char *buf, size_t *nalloc);
127 H5_DLL herr_t H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, size_t *nbytes, H5O_token_t *obj_token, size_t token_size, H5S_t **space_ptr);
128 
129 #endif /* _H5Rpkg_H */
130 
H5R_ref_priv_t::info
union H5R_ref_priv_t::@41 info
ssize_t
int ssize_t
Definition: H5public.h:167
H5R_ref_priv_obj_t
Definition: H5Rpkg.h:54
H5R_ref_priv_reg_t::obj
H5R_ref_priv_obj_t obj
Definition: H5Rpkg.h:61
H5R__get_obj_token
H5_DLL herr_t H5R__get_obj_token(const H5R_ref_priv_t *ref, H5O_token_t *obj_token, size_t *token_size)
Definition: H5Rint.c:776
size
iblock size
Definition: H5EAcache.c:787
f
hdr f
Definition: H5EA.c:755
H5R_ref_priv_obj_t::token
H5O_token_t token
Definition: H5Rpkg.h:55
H5R__create_attr
H5_DLL herr_t H5R__create_attr(const H5O_token_t *obj_token, size_t token_size, const char *attr_name, H5R_ref_priv_t *ref)
Definition: H5Rint.c:364
H5R__decode_token_region_compat
H5_DLL herr_t H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, size_t *nbytes, H5O_token_t *obj_token, size_t token_size, H5S_t **space_ptr)
Definition: H5Rint.c:1763
H5R__create_object
H5_DLL herr_t H5R__create_object(const H5O_token_t *obj_token, size_t token_size, H5R_ref_priv_t *ref)
Definition: H5Rint.c:272
H5VL_object_t
Definition: H5VLprivate.h:39
H5Gprivate.h
H5Sprivate.h
uint32_t
uint32_t
Definition: H5overflow.txt:38
H5R__encode_heap
H5_DLL herr_t H5R__encode_heap(H5F_t *f, unsigned char *buf, size_t *nalloc, const unsigned char *data, size_t data_size)
Definition: H5Rint.c:1415
H5R__decode
H5_DLL herr_t H5R__decode(const unsigned char *buf, size_t *nbytes, H5R_ref_priv_t *ref)
Definition: H5Rint.c:1048
H5R_ref_priv_t::reg
H5R_ref_priv_reg_t reg
Definition: H5Rpkg.h:75
H5I_type_t
H5I_type_t
Definition: H5Ipublic.h:33
H5R__copy
H5_DLL herr_t H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref)
Definition: H5Rint.c:710
H5R_ref_priv_attr_t::obj
H5R_ref_priv_obj_t obj
Definition: H5Rpkg.h:67
H5R_ref_priv_reg_t
Definition: H5Rpkg.h:60
H5R__create_region
H5_DLL herr_t H5R__create_region(const H5O_token_t *obj_token, size_t token_size, H5S_t *space, H5R_ref_priv_t *ref)
Definition: H5Rint.c:313
H5R_ref_priv_t
struct H5R_ref_priv_t H5R_ref_priv_t
uint8_t
unsigned char uint8_t
Definition: H5private.h:429
H5R__encode_token_region_compat
H5_DLL herr_t H5R__encode_token_region_compat(H5F_t *f, const H5O_token_t *obj_token, size_t token_size, H5S_t *space, unsigned char *buf, size_t *nalloc)
Definition: H5Rint.c:1687
H5R__encode_token_obj_compat
H5_DLL herr_t H5R__encode_token_obj_compat(const H5O_token_t *obj_token, size_t token_size, unsigned char *buf, size_t *nalloc)
Definition: H5Rint.c:1620
H5R__get_attr_name
H5_DLL ssize_t H5R__get_attr_name(const H5R_ref_priv_t *ref, char *buf, size_t size)
Definition: H5Rint.c:912
H5R_ref_priv_t::token_size
uint8_t token_size
Definition: H5Rpkg.h:81
htri_t
int htri_t
Definition: H5public.h:160
H5R__equal
H5_DLL htri_t H5R__equal(const H5R_ref_priv_t *ref1, const H5R_ref_priv_t *ref2)
Definition: H5Rint.c:645
H5R_ref_priv_attr_t::name
char * name
Definition: H5Rpkg.h:68
int8_t
signed char int8_t
Definition: H5private.h:420
hid_t
int64_t hid_t
Definition: H5Ipublic.h:55
H5R__decode_token_compat
H5_DLL herr_t H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref_type, const unsigned char *buf, H5O_token_t *obj_token)
Definition: H5Rint.c:1548
H5R__get_loc_id
H5_DLL hid_t H5R__get_loc_id(const H5R_ref_priv_t *ref)
Definition: H5Rint.c:528
H5R_ref_priv_attr_t
Definition: H5Rpkg.h:66
H5R__set_obj_token
H5_DLL herr_t H5R__set_obj_token(H5R_ref_priv_t *ref, const H5O_token_t *obj_token, size_t token_size)
Definition: H5Rint.c:809
H5R__get_type
H5_DLL H5R_type_t H5R__get_type(const H5R_ref_priv_t *ref)
Definition: H5Rint.c:622
H5R__reopen_file
H5_DLL hid_t H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id)
Definition: H5Rint.c:552
H5R_ref_priv_t::attr
H5R_ref_priv_attr_t attr
Definition: H5Rpkg.h:76
H5Oprivate.h
H5R_ref_priv_t
Definition: H5Rpkg.h:72
H5S_t
Definition: H5Spkg.h:317
H5Fprivate.h
H5R_ref_priv_reg_t::space
H5S_t * space
Definition: H5Rpkg.h:62
H5Rprivate.h
H5R_ref_priv_t::loc_id
hid_t loc_id
Definition: H5Rpkg.h:78
H5R__decode_token_obj_compat
H5_DLL herr_t H5R__decode_token_obj_compat(const unsigned char *buf, size_t *nbytes, H5O_token_t *obj_token, size_t token_size)
Definition: H5Rint.c:1651
H5R_ref_priv_reg_t
struct H5R_ref_priv_reg_t H5R_ref_priv_reg_t
H5R_ref_priv_t::type
int8_t type
Definition: H5Rpkg.h:80
H5R__free_heap
H5_DLL herr_t H5R__free_heap(H5F_t *f, const unsigned char *buf, size_t nbytes)
Definition: H5Rint.c:1503
H5_DLL
#define H5_DLL
Definition: H5api_adpt.h:234
H5R_ref_priv_obj_t::filename
char * filename
Definition: H5Rpkg.h:56
H5R_ref_priv_t::encode_size
uint32_t encode_size
Definition: H5Rpkg.h:79
H5R_ref_priv_t::app_ref
hbool_t app_ref
Definition: H5Rpkg.h:82
H5R_ref_priv_obj_t
struct H5R_ref_priv_obj_t H5R_ref_priv_obj_t
H5R_type_t
H5R_type_t
Definition: H5Rpublic.h:48
H5R__encode
H5_DLL herr_t H5R__encode(const char *filename, const H5R_ref_priv_t *ref, unsigned char *buf, size_t *nalloc, unsigned flags)
Definition: H5Rint.c:950
H5R__set_loc_id
H5_DLL herr_t H5R__set_loc_id(H5R_ref_priv_t *ref, hid_t id, hbool_t inc_ref, hbool_t app_ref)
Definition: H5Rint.c:483
H5F_t
Definition: H5Fpkg.h:374
H5R__destroy
H5_DLL herr_t H5R__destroy(H5R_ref_priv_t *ref)
Definition: H5Rint.c:418
H5R_ref_priv_t::obj
H5R_ref_priv_obj_t obj
Definition: H5Rpkg.h:74
H5R__get_region
H5_DLL herr_t H5R__get_region(const H5R_ref_priv_t *ref, H5S_t *space)
Definition: H5Rint.c:841
herr_t
int herr_t
Definition: H5public.h:128
H5R_ref_priv_attr_t
struct H5R_ref_priv_attr_t H5R_ref_priv_attr_t
hbool_t
bool hbool_t
Definition: H5public.h:159
H5R__decode_heap
H5_DLL herr_t H5R__decode_heap(H5F_t *f, const unsigned char *buf, size_t *nbytes, unsigned char **data_ptr, size_t *data_size)
Definition: H5Rint.c:1456
H5R__get_file_name
H5_DLL ssize_t H5R__get_file_name(const H5R_ref_priv_t *ref, char *buf, size_t size)
Definition: H5Rint.c:871
H5O_token_t
Definition: H5public.h:339