Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle compound type subsetting for dataset read/writes #107

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/rest_vol.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,24 @@ typedef struct RV_type_info {
rv_hash_table_t *table;
} RV_type_info;

/* Copy of H5T_subset_t struct defn for compound subsetting */
typedef enum {
H5T_SUBSET_BADVALUE = -1, /* Invalid value */
H5T_SUBSET_FALSE = 0, /* Source and destination aren't subset of each other */
H5T_SUBSET_SRC, /* Source is the subset of dest and no conversion is needed */
H5T_SUBSET_DST, /* Dest is the subset of source and no conversion is needed */
H5T_SUBSET_CAP /* Must be the last value */
} RV_subset_t;

/* Information about members of a compound type for subsetting */
typedef struct RV_compound_info_t {
int nmembers; /* Number of offset/length pairs used */
int nalloc; /* Number of offset/length pairs allocated */
size_t *src_offsets;
size_t *dst_offsets;
size_t *lengths;
} RV_compound_info_t;

/* TODO - This is copied directly from the library */
#define TYPE_BITS 7
#define TYPE_MASK (((hid_t)1 << TYPE_BITS) - 1)
Expand Down Expand Up @@ -761,6 +779,22 @@ herr_t RV_tconv_init(hid_t src_type_id, size_t *src_type_size, hid_t dst_type_id
herr_t RV_convert_datatype_to_JSON(hid_t type_id, char **type_body, size_t *type_body_len, hbool_t nested,
server_api_version server_version);

/* Determine if a read from file to mem dtype is a compound subset read */
herr_t RV_get_compound_subset_info(hid_t src_type_id, hid_t dst_type_id, RV_subset_t *subset_info);

/* Helper to get information about members in dst that are omitted in src due to compound subsetting */
herr_t RV_get_omitted_compound_members(hid_t src_type_id, hid_t dst_type_id,
RV_compound_info_t *compound_info);

/* Helper function to handle compound type subsetting during reads */
herr_t RV_handle_compound_subset_read(hid_t src_type_id, hid_t dst_type_id, hid_t dst_space_id,
const void *src_buf, void *dst_buf);

/* Helper function to handle compound type subsetting during writes */
herr_t RV_handle_compound_subset_write(hid_t src_type_id, hid_t dst_type_id, hid_t src_space_id,
hid_t dst_space_id, RV_object_t *dset, const void *buf_in,
void *buf_out);

/* Helper function to escape control characters for JSON strings */
herr_t RV_JSON_escape_string(const char *in, char *out, size_t *out_size);

Expand Down
2 changes: 1 addition & 1 deletion src/rest_vol_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ RV_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_

/* Form the Datatype portion of the Attribute create request */
if (RV_convert_datatype_to_JSON(type_id, &datatype_body, &datatype_body_len, FALSE,
parent->domain->u.file.server_version) < 0)
parent->domain->u.file.server_info.version) < 0)
FUNC_GOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, NULL,
"can't convert attribute's datatype to JSON representation");

Expand Down
Loading