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

Implement type conversion for simple numeric types #72

Merged
merged 1 commit into from
Nov 14, 2023
Merged
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
6 changes: 4 additions & 2 deletions src/rest_vol.c
Original file line number Diff line number Diff line change
Expand Up @@ -3527,8 +3527,9 @@ RV_get_index_of_matching_handle(dataset_transfer_info *transfer_info, size_t cou

herr_t
RV_curl_multi_perform(CURL *curl_multi_handle, dataset_transfer_info *transfer_info, size_t count,
herr_t(success_callback)(hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
void *buf, struct response_buffer resp_buffer))
herr_t(success_callback)(hid_t mem_type_id, hid_t mem_space_id, hid_t file_type_id,
hid_t file_space_id, void *buf,
struct response_buffer resp_buffer))
{

herr_t ret_value = SUCCEED;
Expand Down Expand Up @@ -3659,6 +3660,7 @@ RV_curl_multi_perform(CURL *curl_multi_handle, dataset_transfer_info *transfer_i

if (success_callback(
transfer_info[handle_index].mem_type_id, transfer_info[handle_index].mem_space_id,
transfer_info[handle_index].file_type_id,
transfer_info[handle_index].file_space_id, transfer_info[handle_index].buf,
transfer_info[handle_index].resp_buffer) < 0)
FUNC_GOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL,
Expand Down
22 changes: 21 additions & 1 deletion src/rest_vol.h
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,13 @@ typedef struct dataset_transfer_info {
hid_t mem_type_id;
hid_t mem_space_id;
hid_t file_space_id;
hid_t file_type_id;
char *selection_body;

/* Fields for type conversion */
void *tconv_buf;
void *bkg_buf;

transfer_type_t transfer_type;

union {
Expand Down Expand Up @@ -643,6 +648,13 @@ typedef struct loc_info {
RV_object_t *domain;
} loc_info;

/* Enum to indicate if the supplied read buffer can be used as a type conversion or background buffer */
typedef enum {
RV_TCONV_REUSE_NONE, /* Cannot reuse buffer */
RV_TCONV_REUSE_TCONV, /* Use buffer as type conversion buffer */
RV_TCONV_REUSE_BKG /* Use buffer as background buffer */
} RV_tconv_reuse_t;

/****************************
* *
* Prototypes *
Expand Down Expand Up @@ -718,9 +730,17 @@ void RV_free_visited_link_hash_table_key(rv_hash_table_key_t value);
* and waits until all requests on it have finished before returning. */
herr_t RV_curl_multi_perform(CURL *curl_multi_ptr, dataset_transfer_info *transfer_info, size_t count,
herr_t(success_callback)(hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, void *buf,
hid_t file_type_id, hid_t file_space_id, void *buf,
struct response_buffer resp_buffer));

/* Dtermine if datatype conversion is necessary */
htri_t RV_need_tconv(hid_t src_type_id, hid_t dst_type_id);

/* Initialize variables and buffers used for type conversion */
herr_t RV_tconv_init(hid_t src_type_id, size_t *src_type_size, hid_t dst_type_id, size_t *dst_type_size,
size_t num_elem, hbool_t clear_tconv_buf, hbool_t dst_file, void **tconv_buf,
void **bkg_buf, RV_tconv_reuse_t *reuse, hbool_t *fill_bkg);

#define SERVER_VERSION_MATCHES_OR_EXCEEDS(version, major_needed, minor_needed, patch_needed) \
(version.major > major_needed) || (version.major == major_needed && version.minor > minor_needed) || \
(version.major == major_needed && version.minor == minor_needed && version.patch >= patch_needed)
Expand Down
Loading