diff options
author | Jordan Henderson <jhenderson@hdfgroup.org> | 2020-01-29 00:18:38 (GMT) |
---|---|---|
committer | Jordan Henderson <jhenderson@hdfgroup.org> | 2020-01-29 00:18:38 (GMT) |
commit | e41f671d2ff3c7bb797ea0246e6289b0bac5a0e5 (patch) | |
tree | 9b0af1ccf350a14b2165c1db1579b2434144aaf8 /fortran | |
parent | 71c050f837149a0c11e0936e661047c091deaa2f (diff) | |
download | hdf5-e41f671d2ff3c7bb797ea0246e6289b0bac5a0e5.zip hdf5-e41f671d2ff3c7bb797ea0246e6289b0bac5a0e5.tar.gz hdf5-e41f671d2ff3c7bb797ea0246e6289b0bac5a0e5.tar.bz2 |
Introduce new H5VL _by_value routines
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/src/H5VLff.F90 | 98 | ||||
-rw-r--r-- | fortran/src/hdf5_fortrandll.def.in | 4 | ||||
-rw-r--r-- | fortran/test/vol_connector.F90 | 44 |
3 files changed, 115 insertions, 31 deletions
diff --git a/fortran/src/H5VLff.F90 b/fortran/src/H5VLff.F90 index eea9dfe..32dd7d7 100644 --- a/fortran/src/H5VLff.F90 +++ b/fortran/src/H5VLff.F90 @@ -124,13 +124,14 @@ CONTAINS END SUBROUTINE H5VLregister_connector_by_value_f ! -!****s* H5VL/H5VLis_connector_registered_f +!****s* H5VL/H5VLis_connector_registered_by_name_f ! ! NAME -! H5VLis_connector_registered_f +! H5VLis_connector_registered_by_name_f ! ! PURPOSE -! Tests whether a VOL class has been registered or not. +! Tests whether a VOL class has been registered or not +! according to a specified connector name. ! ! INPUTS ! name - Connector name @@ -139,7 +140,7 @@ CONTAINS ! hdferr - Returns 0 if successful and -1 if fails ! SOURCE - SUBROUTINE H5VLis_connector_registered_f(name, registered, hdferr) + SUBROUTINE H5VLis_connector_registered_by_name_f(name, registered, hdferr) IMPLICIT NONE CHARACTER(LEN=*), INTENT(IN) :: name LOGICAL, INTENT(OUT) :: registered @@ -149,22 +150,63 @@ CONTAINS INTEGER(C_INT) :: registered_c INTERFACE - INTEGER(C_INT) FUNCTION H5VLis_connector_registered(name) BIND(C,NAME='H5VLis_connector_registered') + INTEGER(C_INT) FUNCTION H5VLis_connector_registered_by_name(name) BIND(C,NAME='H5VLis_connector_registered_by_name') IMPORT :: C_CHAR IMPORT :: C_INT CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name - END FUNCTION H5VLis_connector_registered + END FUNCTION H5VLis_connector_registered_by_name END INTERFACE c_name = TRIM(name)//C_NULL_CHAR - registered_c = H5VLis_connector_registered(c_name) + registered_c = H5VLis_connector_registered_by_name(c_name) hdferr = 0 registered = .FALSE. IF(registered_c .GT. 0) registered = .TRUE. IF(registered_c .LT. 0) hdferr = INT(registered_c) - END SUBROUTINE H5VLis_connector_registered_f + END SUBROUTINE H5VLis_connector_registered_by_name_f + +! +!****s* H5VL/H5VLis_connector_registered_by_value_f +! +! NAME +! H5VLis_connector_registered_by_value_f +! +! PURPOSE +! Tests whether a VOL class has been registered or not +! according to a specified connector value (ID). +! +! INPUTS +! value - Connector value +! OUTPUTS +! registered - state of VOL class registration +! hdferr - Returns 0 if successful and -1 if fails +! SOURCE + + SUBROUTINE H5VLis_connector_registered_by_value_f(value, registered, hdferr) + IMPLICIT NONE + INTEGER, INTENT(IN) :: value + LOGICAL, INTENT(OUT) :: registered + INTEGER, INTENT(OUT) :: hdferr +!***** + INTEGER(C_INT) :: registered_c + + INTERFACE + INTEGER(C_INT) FUNCTION H5VLis_connector_registered_by_value(value) BIND(C,NAME='H5VLis_connector_registered_by_value') + IMPORT :: C_INT + INTEGER(C_INT), VALUE :: value + END FUNCTION H5VLis_connector_registered_by_value + END INTERFACE + + registered_c = H5VLis_connector_registered_by_value(INT(value,C_INT)) + + hdferr = 0 + registered = .FALSE. + IF(registered_c .GT. 0) registered = .TRUE. + IF(registered_c .LT. 0) hdferr = INT(registered_c) + + END SUBROUTINE H5VLis_connector_registered_by_value_f ! !****s* H5VL/H5VLget_connector_id_f @@ -248,6 +290,46 @@ CONTAINS END SUBROUTINE H5VLget_connector_id_by_name_f +! +!****s* H5VL/H5VLget_connector_id_by_value_f +! +! NAME +! H5VLget_connector_id_by_value_f +! +! PURPOSE +! Retrieves the ID for a registered VOL connector. +! +! INPUTS +! value - Connector value +! OUTPUTS +! vol_id - Connector id +! hdferr - Returns 0 if successful and -1 if fails +! SOURCE + + SUBROUTINE H5VLget_connector_id_by_value_f(value, vol_id, hdferr) + IMPLICIT NONE + INTEGER, INTENT(IN) :: value + INTEGER(HID_T), INTENT(OUT) :: vol_id + INTEGER, INTENT(OUT) :: hdferr +!***** + INTERFACE + INTEGER(HID_T) FUNCTION H5VLget_connector_id_by_value(value) BIND(C,NAME='H5VLget_connector_id_by_value') + IMPORT :: C_INT + IMPORT :: HID_T + INTEGER(C_INT), VALUE :: value + END FUNCTION H5VLget_connector_id_by_value + END INTERFACE + + vol_id = H5VLget_connector_id_by_value(INT(value,C_INT)) + + hdferr = 0 + IF(vol_id.LT.0)THEN + hdferr = -1 + vol_id = H5I_INVALID_HID_F + ENDIF + + END SUBROUTINE H5VLget_connector_id_by_value_f + SUBROUTINE H5VLget_connector_name_f(obj_id, name, hdferr, name_len) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: obj_id diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index 7e8b611..c792232 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -458,9 +458,11 @@ H5T_mp_H5TENUM_INSERT_F03 ; H5VL H5VL_mp_H5VLREGISTER_CONNECTOR_BY_NAME_F H5VL_mp_H5VLREGISTER_CONNECTOR_BY_VALUE_F -H5VL_mp_H5VLIS_CONNECTOR_REGISTERED_F +H5VL_mp_H5VLIS_CONNECTOR_REGISTERED_BY_NAME_F +H5VL_mp_H5VLIS_CONNECTOR_REGISTERED_BY_VALUE_F H5VL_mp_H5VLGET_CONNECTOR_ID_F H5VL_mp_H5VLGET_CONNECTOR_ID_BY_NAME_F +H5VL_mp_H5VLGET_CONNECTOR_ID_BY_VALUE_F H5VL_mp_H5VLGET_CONNECTOR_NAME_F H5VL_mp_H5VLCLOSE_F H5VL_mp_H5VLUNREGISTER_CONNECTOR_F diff --git a/fortran/test/vol_connector.F90 b/fortran/test/vol_connector.F90 index cd05cb1..d346737 100644 --- a/fortran/test/vol_connector.F90 +++ b/fortran/test/vol_connector.F90 @@ -61,18 +61,18 @@ CONTAINS INTEGER(hid_t) :: file_id ! The null VOL connector should not be registered at the start of the test - CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) - CALL check("H5VLis_connector_registered_f",error,total_error) - CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) + CALL H5VLis_connector_registered_by_name_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) + CALL check("H5VLis_connector_registered_by_name_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_by_name_f", is_registered, .FALSE., total_error) ! Register the connector by name CALL H5VLregister_connector_by_name_f(NATIVE_VOL_CONNECTOR_NAME, vol_id, error) CALL check("H5VLregister_connector_by_name_f",error,total_error) ! The connector should be registered now - CALL H5VLis_connector_registered_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error) - CALL check("H5VLis_connector_registered_f",error,total_error) - CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error) + CALL H5VLis_connector_registered_by_name_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error) + CALL check("H5VLis_connector_registered_by_name_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_by_name_f", is_registered, .TRUE., total_error) CALL H5VLget_connector_id_by_name_f(NATIVE_VOL_CONNECTOR_NAME, vol_id_out, error) CALL check("H5VLget_connector_id_by_name_f",error,total_error) @@ -118,24 +118,24 @@ CONTAINS INTEGER, INTENT(INOUT) :: total_error INTEGER :: error = 0 - + LOGICAL :: is_registered = .FALSE. INTEGER(hid_t) :: vol_id = 0 ! The null VOL connector should not be registered at the start of the test - CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) - CALL check("H5VLis_connector_registered_f",error,total_error) - CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) + CALL H5VLis_connector_registered_by_name_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) + CALL check("H5VLis_connector_registered_by_name_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_by_name_f", is_registered, .FALSE., total_error) ! Register the connector by value CALL H5VLregister_connector_by_value_f(NATIVE_VOL_CONNECTOR_VALUE, vol_id, error) CALL check("H5VLregister_connector_by_value_f", error, total_error) ! The connector should be registered now - CALL H5VLis_connector_registered_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error) - CALL check("H5VLis_connector_registered_f",error,total_error) - CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error) + CALL H5VLis_connector_registered_by_name_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error) + CALL check("H5VLis_connector_registered_by_name_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_by_name_f", is_registered, .TRUE., total_error) END SUBROUTINE test_registration_by_value @@ -162,23 +162,23 @@ CONTAINS INTEGER(hid_t) :: fapl_id TYPE(C_PTR) :: f_ptr - CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) + CALL H5VLis_connector_registered_by_name_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) - CALL check("H5VLis_connector_registered_f",error,total_error) - CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) + CALL check("H5VLis_connector_registered_by_name_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_by_name_f", is_registered, .FALSE., total_error) ! The null VOL connector should not be registered at the start of the test - CALL H5VLis_connector_registered_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) - CALL check("H5VLis_connector_registered_f",error,total_error) - CALL VERIFY("H5VLis_connector_registered_f", is_registered, .FALSE., total_error) + CALL H5VLis_connector_registered_by_name_f( "FAKE_VOL_CONNECTOR_NAME", is_registered, error) + CALL check("H5VLis_connector_registered_by_name_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_by_name_f", is_registered, .FALSE., total_error) CALL H5VLregister_connector_by_name_f(NATIVE_VOL_CONNECTOR_NAME, vol_id, error) CALL check("H5VLregister_connector_by_name_f",error,total_error) ! The connector should be registered now - CALL H5VLis_connector_registered_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error) - CALL check("H5VLis_connector_registered_f",error,total_error) - CALL VERIFY("H5VLis_connector_registered_f", is_registered, .TRUE., total_error) + CALL H5VLis_connector_registered_by_name_f(NATIVE_VOL_CONNECTOR_NAME, is_registered, error) + CALL check("H5VLis_connector_registered_by_name_f",error,total_error) + CALL VERIFY("H5VLis_connector_registered_by_name_f", is_registered, .TRUE., total_error) ! Register the connector CALL H5Pcreate_f(H5P_FILE_ACCESS_F, fapl_id, error) |