diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-08-22 16:59:56 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-08-22 16:59:56 (GMT) |
commit | cd11fcb14c7174e16dec8f39a566b5d47b9a877a (patch) | |
tree | ecd5ded78d9bb0145a592b005fe2da5cb4f9aabf /src | |
parent | 5236eb16ab23754ec171b0a17a4ca130508a8958 (diff) | |
download | hdf5-cd11fcb14c7174e16dec8f39a566b5d47b9a877a.zip hdf5-cd11fcb14c7174e16dec8f39a566b5d47b9a877a.tar.gz hdf5-cd11fcb14c7174e16dec8f39a566b5d47b9a877a.tar.bz2 |
[svn-r25544] - add a new version of H5Lis_registered.
- rename external log plugin test in examples.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5I.c | 2 | ||||
-rw-r--r-- | src/H5Iprivate.h | 2 | ||||
-rw-r--r-- | src/H5VL.c | 50 | ||||
-rw-r--r-- | src/H5VLpublic.h | 10 |
4 files changed, 58 insertions, 6 deletions
@@ -2489,7 +2489,7 @@ H5I__get_id_cb(void *_item, void UNUSED *_key, void *_udata) *------------------------------------------------------------------------- */ hid_t -H5I_get_id(void *object, H5I_type_t type) +H5I_get_id(const void *object, H5I_type_t type) { hid_t ret_value = FAIL; /* Return value */ H5I_id_type_t *type_ptr; /*ptr to the type */ diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h index a902be5..ef8b3d3 100644 --- a/src/H5Iprivate.h +++ b/src/H5Iprivate.h @@ -88,7 +88,7 @@ H5_DLL int H5I_dec_app_ref_always_close(hid_t id); H5_DLL herr_t H5I_dec_type_ref(H5I_type_t type); H5_DLL herr_t H5I_register_aux(hid_t id, void *aux_ptr); H5_DLL void *H5I_get_aux(hid_t id); -H5_DLL hid_t H5I_get_id(void *object, H5I_type_t type); +H5_DLL hid_t H5I_get_id(const void *object, H5I_type_t type); #endif /* _H5Iprivate_H */ @@ -51,6 +51,10 @@ static herr_t H5VL_free_cls(H5VL_class_t *cls); /*******************/ /* Local Variables */ /*******************/ +typedef struct { + const H5VL_class_t *vol_cls; + hid_t ret_id; +} H5VL_is_registered_ud_t; /* VOL ID class */ static const H5I_class_t H5I_VOL_CLS[1] = {{ @@ -289,6 +293,39 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL__is_registered_cb + * + * Purpose: Callback routine to search through registered VLs + * + * Return: Success: The first object in the type for which FUNC + * returns non-zero. NULL if FUNC returned zero + * for every object in the type. + * Failure: NULL + * + * Programmer: Quincey Koziol + * Friday, March 30, 2012 + * + *------------------------------------------------------------------------- + */ +static int +H5VL__is_registered_cb(void *obj, hid_t id, void *_op_data) +{ + H5VL_is_registered_ud_t *op_data = (H5VL_is_registered_ud_t *)_op_data; /* User data for callback */ + H5VL_class_t *cls = (H5VL_class_t *)obj; + int ret_value; /* Callback return value */ + + FUNC_ENTER_STATIC_NOERR + + if(cls->value == op_data->vol_cls->value) { + op_data->ret_id = id; + ret_value = H5_ITER_STOP; + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__is_registered_cb() */ + + +/*------------------------------------------------------------------------- * Function: H5VLis_registered * * Purpose: Tests whether a VOL class has been registered or not @@ -303,15 +340,22 @@ done: *------------------------------------------------------------------------- */ htri_t -H5VLis_registered(hid_t id) +H5VLis_registered(const H5VL_class_t *cls) { + H5VL_is_registered_ud_t op_data; htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE1("t", "i", id); + H5TRACE1("t", "*x", cls); + + op_data.ret_id = FAIL; + op_data.vol_cls = cls; /* Check arguments */ - if(NULL != H5I_object_verify(id, H5I_VOL)) + if(H5I_iterate(H5I_VOL, H5VL__is_registered_cb, &op_data, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "can't iterate over VOL ids") + + if(op_data.ret_id != FAIL) ret_value = TRUE; done: diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 73c5b6a..d0598d3 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -428,10 +428,18 @@ H5_DLL herr_t H5VLrequest_wait(void **req, H5VL_t *vol_plugin, H5ES_status_t *st /* Function prototypes */ H5_DLL hid_t H5VLregister(const H5VL_class_t *cls); H5_DLL herr_t H5VLunregister(hid_t plugin_id); -H5_DLL htri_t H5VLis_registered(hid_t id); +H5_DLL htri_t H5VLis_registered(const H5VL_class_t *cls); H5_DLL ssize_t H5VLget_plugin_name(hid_t id, char *name/*out*/, size_t size); H5_DLL hid_t H5VLobject_register(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls); H5_DLL herr_t H5VLget_object(hid_t obj_id, void **obj, H5VL_t **vol_plugin); +#if 0 + H5_DLL hid_t H5VLregister_by_name(const char *plugin_name); + H5_DLL herr_t H5VLinitialize(hid_t plugin_id, hid_t vipl_id); + H5_DLL herr_t H5VLterminate(hid_t plugin_id, hid_t vtpl_id); + H5_DLL hid_t H5VLget_plugin_id(H5VL_class_value_t or char *); + H5_DLL herr_t H5VLclose(hid_t plugin_id); + H5_DLL herr_t H5VLioctl(hid_t loc_id or vol_id, <class enum>, ...); +#endif #ifdef __cplusplus } |