Name: H5Sencode
Signature:
herr_t H5Sencode(hid_t obj_id, unsigned char *buf, size_t *nalloc)
Purpose:
Encode a data space object description into a binary buffer.
Description:
Given the data space ID, H5Sencode converts a data space description into binary form in a buffer. Using this binary form in the buffer, a data space object can be reconstructed using H5Sdecode to return a new object handle(hid_t) for this data space.

A preliminary H5Sencode call can be made to find out the size of the buffer needed. This value is returned as nalloc. That value can then be assigned to nalloc for a second H5Sencode call, which will retrieve the actual encoded object.

If the library finds out nalloc is not big enough for the object, it simply returns the size of the buffer needed through nalloc without encoding the provided buffer.

The types of data space we address in this function are null, scalar, and simple space. For simple data space, the information of selection, for example, hyperslab selection, is also encoded and decoded. Complex data space has not been implemented in the library.

Parameters:
Returns:
Returns a non-negative value if successful; otherwise returns a negative value.
Fortran90 Interface: h5sencode_f
SUBROUTINE h5sencode_f(obj_id, buf, nalloc, hdferr)
  IMPLICIT NONE
  INTEGER(HID_T), INTENT(IN) :: obj_id ! Identifier of the object to be encoded
  CHARACTER(LEN=*), INTENT(OUT) :: buf ! Buffer of object to be encoded into
  INTEGER(SIZE_T), INTENT(INOUT) :: nalloc 
                                       ! Size of the allocated buffer
  INTEGER, INTENT(OUT) :: hdferr       ! Error code
                                       ! 0 on success and -1 on failure
END SUBROUTINE h5sencode_f