summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
Diffstat (limited to 'fortran')
-rw-r--r--fortran/src/H5Tf.c30
-rw-r--r--fortran/src/H5Tff.f9069
-rw-r--r--fortran/src/H5f90proto.h2
-rw-r--r--fortran/test/tH5T.f9024
4 files changed, 125 insertions, 0 deletions
diff --git a/fortran/src/H5Tf.c b/fortran/src/H5Tf.c
index cc4b279..8fbcbef 100644
--- a/fortran/src/H5Tf.c
+++ b/fortran/src/H5Tf.c
@@ -1633,3 +1633,33 @@ nh5tis_variable_str_c ( hid_t_f *type_id , int_f *flag )
if ( status < 0 ) ret_value = -1;
return ret_value;
}
+/*----------------------------------------------------------------------------
+ * Name: h5tget_member_class_c
+ * Purpose: Call H5Tget_member_class to detrmine ithe class of the compound
+ * datatype member
+ * Inputs: type_id - identifier of the dataspace
+ * member_no - member's index
+ * Outputs: class - member's class
+ * and negative on failure.
+ * Returns: 0 on success, -1 on failure
+ * Programmer: Elena Pourmal
+ * Wednesday, April 6, 2005
+ * Modifications:
+ *---------------------------------------------------------------------------*/
+
+int_f
+nh5tget_member_class_c ( hid_t_f *type_id , int_f *member_no, int_f *class )
+{
+ int ret_value = 0;
+ hid_t c_type_id;
+ unsigned c_member_no;
+ H5T_class_t c_class;
+
+ c_type_id = (hid_t)*type_id;
+ c_member_no = (unsigned)*member_no;
+ c_class = H5Tget_member_class(c_type_id, c_member_no);
+
+ if ( c_class == H5T_NO_CLASS ) ret_value = -1;
+ *class = (int_f)c_class;
+ return ret_value;
+}
diff --git a/fortran/src/H5Tff.f90 b/fortran/src/H5Tff.f90
index 336372d..ce7d3d2 100644
--- a/fortran/src/H5Tff.f90
+++ b/fortran/src/H5Tff.f90
@@ -3179,4 +3179,73 @@
END SUBROUTINE h5tis_variable_str_f
!----------------------------------------------------------------------
+! Name: h5tget_member_class_f
+!
+! Purpose: Returns datatype class of compound datatype member.
+!
+! Inputs:
+! type_id - - datartpe identifier
+! member_no - index of compound datatype member
+! Outputs:
+! class - class type for compound dadtype member
+! Can be one of the follwoing classes:
+! H5T_NO_CLASS_F (error)
+! H5T_INTEGER_F
+! H5T_FLOAT_F
+! H5T_TIME_F
+! H5T_STRING_F
+! H5T_BITFIELD_F
+! H5T_OPAQUE_F
+! H5T_COMPOUND_F
+! H5T_REFERENCE_F
+! H5T_ENUM_F
+! H5T_VLEN_F
+! H5T_ARRAY_F
+! hdferr: - error code
+! Success: 0
+! Failure: -1
+! Optional parameters:
+! NONE
+!
+! Programmer: Elena Pourmal
+! April 6, 2005
+!
+! Modifications:
+!
+! Comment:
+!----------------------------------------------------------------------
+
+ SUBROUTINE h5tget_member_class_f(type_id, member_no, class, hdferr)
+!
+!This definition is needed for Windows DLLs
+!DEC$if defined(BUILD_HDF5_DLL)
+!DEC$attributes dllexport :: h5tget_member_class_f
+!DEC$endif
+!
+
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN) :: type_id ! Datatype identifier
+ INTEGER, INTENT(IN) :: member_no ! Member number
+ INTEGER, INTENT(OUT) :: class ! Member class
+ INTEGER, INTENT(OUT) :: hdferr ! Error code
+
+! MS FORTRAN needs explicit interface for C functions called here.
+!
+ INTERFACE
+ INTEGER FUNCTION h5tget_member_class_c(type_id, member_no, class)
+ USE H5GLOBAL
+ !DEC$ IF DEFINED(HDF5F90_WINDOWS)
+ !MS$ATTRIBUTES C,reference,alias:'_H5TGET_MEMBER_CLASS_C'::h5tget_member_class_c
+ !DEC$ ENDIF
+ INTEGER(HID_T), INTENT(IN) :: type_id
+ INTEGER, INTENT(IN) :: member_no
+ INTEGER, INTENT(OUT) :: class
+ END FUNCTION h5tget_member_class_c
+ END INTERFACE
+
+ hdferr = h5tget_member_class_c(type_id, member_no, class)
+
+ END SUBROUTINE h5tget_member_class_f
+
+!----------------------------------------------------------------------
END MODULE H5T
diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h
index a882075..64196a4 100644
--- a/fortran/src/H5f90proto.h
+++ b/fortran/src/H5f90proto.h
@@ -301,6 +301,7 @@ H5_FCDLL int_f nh5aget_name_c(hid_t_f *attr_id, size_t_f *size, _fcd buf);
# define nh5tget_super_c FC_FUNC_(h5tget_super_c, H5TGET_SUPER_C)
# define nh5tvlen_create_c FC_FUNC_(h5tvlen_create_c, H5TVLEN_CREATE_C)
# define nh5tis_variable_str_c FC_FUNC_(h5tis_variable_str_c, H5TIS_VARIABLE_STR_C)
+# define nh5tget_member_class_c FC_FUNC_(h5tget_member_class_c, H5TGET_MEMBER_CLASS_C)
H5_FCDLL int_f nh5tcreate_c(int_f *class, size_t_f *size, hid_t_f *type_id);
@@ -358,6 +359,7 @@ H5_FCDLL int_f nh5tget_array_ndims_c ( hid_t_f *type_id , int_f * ndims);
H5_FCDLL int_f nh5tget_super_c ( hid_t_f *type_id , hid_t_f *base_type_id);
H5_FCDLL int_f nh5tvlen_create_c ( hid_t_f *type_id , hid_t_f *vltype_id);
H5_FCDLL int_f nh5tis_variable_str_c ( hid_t_f *type_id , int_f *flag );
+H5_FCDLL int_f nh5tget_member_class_c ( hid_t_f *type_id , int_f *member_no, int_f *class );
/*
* Functions from H5Pf.c
diff --git a/fortran/test/tH5T.f90 b/fortran/test/tH5T.f90
index f2dddb4..5056596 100644
--- a/fortran/test/tH5T.f90
+++ b/fortran/test/tH5T.f90
@@ -334,6 +334,12 @@
write(*,*) "Wrong member type returned for character member"
total_error = total_error + 1
endif
+ CALL h5tget_member_class_f(dtype_id, i-1, class, error)
+ CALL check("h5tget_member_class_f",error, total_error)
+ if (class .ne. H5T_STRING_F) then
+ write(*,*) "Wrong class returned for character member"
+ total_error = total_error + 1
+ endif
CASE("integer_field")
if(offset_out .ne. type_sizec) then
write(*,*) "Offset of the integer member is incorrect"
@@ -347,6 +353,12 @@
write(*,*) "Wrong member type returned for integer memebr"
total_error = total_error + 1
endif
+ CALL h5tget_member_class_f(dtype_id, i-1, class, error)
+ CALL check("h5tget_member_class_f",error, total_error)
+ if (class .ne. H5T_INTEGER_F) then
+ write(*,*) "Wrong class returned for INTEGER member"
+ total_error = total_error + 1
+ endif
CASE("double_field")
if(offset_out .ne. (type_sizec+type_sizei)) then
write(*,*) "Offset of the double precision member is incorrect"
@@ -360,6 +372,12 @@
write(*,*) "Wrong member type returned for double precision memebr"
total_error = total_error + 1
endif
+ CALL h5tget_member_class_f(dtype_id, i-1, class, error)
+ CALL check("h5tget_member_class_f",error, total_error)
+ if (class .ne. H5T_FLOAT_F) then
+ write(*,*) "Wrong class returned for double precision member"
+ total_error = total_error + 1
+ endif
CASE("real_field")
if(offset_out .ne. (type_sizec+type_sizei+type_sized)) then
write(*,*) "Offset of the real member is incorrect"
@@ -373,6 +391,12 @@
write(*,*) "Wrong member type returned for real memebr"
total_error = total_error + 1
endif
+ CALL h5tget_member_class_f(dtype_id, i-1, class, error)
+ CALL check("h5tget_member_class_f",error, total_error)
+ if (class .ne. H5T_FLOAT_F) then
+ write(*,*) "Wrong class returned for real member"
+ total_error = total_error + 1
+ endif
CASE DEFAULT
write(*,*) "Wrong member's name"
total_error = total_error + 1