Defines | Functions

Useful extension of the HDF5 API.

Defines

#define H5Gclose(x)   _F5Gclose(x, __FILE__, __LINE__)

Functions

F5_API hid_t F5open (const char *filename, int socket)
F5_API int F5connect (const char *url)
F5_API int F5listen (const char *service)
F5_API void F5closesocket (int socket)
F5_API void F5socket_init ()
F5_API void F5socket_cleanup ()
F5_API hid_t F5append (const char *filename)
F5_API hid_t F5Gappend (hid_t loc_id, const char *name, size_t size_hint)
F5_API hid_t F5Aappend (hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t create_plist)
F5_API hid_t F5Dappend (hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t create_plist_id)
F5_API int F5Gopen (hid_t location, const char *name)
F5_API int F5Gexist (hid_t location, const char *name)
F5_API hid_t F5Gtry_to_open (hid_t location, const char *name)
F5_API hid_t F5Atry_to_open (hid_t location, const char *name)
F5_API int F5Dexist (hid_t location, const char *name)
F5_API hid_t F5Dtry_to_open (hid_t location, const char *name)
F5_API herr_t F5Xclose (hid_t obj_id)
F5_API int F5Asave_string (hid_t loc_id, const char *name, const char *buf)
F5_API char * F5Aget_string (hid_t loc_id, const char *name, char *buf, size_t len)
F5_API herr_t F5Asave_version (hid_t loc_id, int major, int minor, int release)
F5_API herr_t F5Aget_version (hid_t loc_id, int *major, int *minor, int *release)
F5_API long F5Aget_ints (hid_t loc_id, const char *name, int *data, hsize_t n)
F5_API int F5Asave_ints (hid_t loc_id, const char *name, const int data[], hsize_t n)
F5_API int F5Asave_integer (hid_t loc_id, const char *name, int data)
F5_API herr_t _F5Gclose (hid_t id, const char *filename, int lineno)

Detailed Description

These extensions are of general use, not only in conjunction with the fiber bundle concept, but they just happen to sit here in this library.


Function Documentation

F5_API herr_t _F5Gclose ( hid_t  id,
const char *  filename,
int  lineno 
)

Call H5Cclose with a debug message when F5_VERBOSITY is larger then 110

F5_API hid_t F5Aappend ( hid_t  loc_id,
const char *  name,
hid_t  type_id,
hid_t  space_id,
hid_t  create_plist 
)

Open some attribute if it exists, otherwise create one.

F5_API long F5Aget_ints ( hid_t  loc_id,
const char *  name,
int *  data,
hsize_t  n 
)

Get a number of integers from an attribute which is an integer array. The specified number n must match exactly with the number of elements.

Returns:
positive number of elements (n) if success, 0 if attribute not found, and the negative number of elements otherwise. Success can easily be tested by checking the return value to be larger than zero.
F5_API char* F5Aget_string ( hid_t  loc_id,
const char *  name,
char *  buf,
size_t  len 
)

Get a string attribute from the file. If buf is a NULL pointer, then the string is allocated dynamically and the caller needs to issue free() on the result. If the string could not be read, returns a NULL pointer.

F5_API herr_t F5Aget_version ( hid_t  loc_id,
int *  major,
int *  minor,
int *  release 
)

Get version number for given object.

Parameters:
loc_id Any HDF5 object that may carry attributes.
F5_API hid_t F5append ( const char *  filename  ) 

Open some file for appending data.

F5_API int F5Asave_integer ( hid_t  loc_id,
const char *  name,
int  data 
)

Save an integer to the file as an attribute, checking if it already existed, and if so, that it had the same value.

Returns:
non-zero in case of error
F5_API int F5Asave_ints ( hid_t  loc_id,
const char *  name,
const int  data[],
hsize_t  n 
)

Save an array of integers as an attribute.

Returns:
non-zero in case of error
F5_API int F5Asave_string ( hid_t  loc_id,
const char *  name,
const char *  buf 
)

Create a string attribute which is of the size of the given string and write it to the file.

F5_API hid_t F5Atry_to_open ( hid_t  location,
const char *  name 
)

Try to open an HDF5 attribute, silently return -1 if it does not exist.

F5_API void F5closesocket ( int  socket  ) 

A forwarding call to the platformspecific system call to close a socket.

F5_API int F5connect ( const char *  url  ) 

Open a socket connection to the specified host and port. The URL must be of the form:

        HDF5://myhost.com:6666/T=0.000000/
F5_API hid_t F5Dappend ( hid_t  loc_id,
const char *  name,
hid_t  type_id,
hid_t  space_id,
hid_t  create_plist_id 
)

Open some dataset if it exists, otherwise create one.

F5_API int F5Dexist ( hid_t  location,
const char *  name 
)

Check if a dataset exists.

F5_API hid_t F5Gappend ( hid_t  loc_id,
const char *  name,
size_t  size_hint 
)

Open some group if it exists, otherwise create one.

F5_API int F5Gexist ( hid_t  location,
const char *  name 
)

Check if a group exists.

F5_API int F5Gopen ( hid_t  location,
const char *  name 
)

Open a group

F5_API hid_t F5Gtry_to_open ( hid_t  location,
const char *  name 
)

Try to open an HDF5 group, silently return -1 if it does not exist.

F5_API hid_t F5open ( const char *  filename,
int  socket 
)

Open some URL for reading data (read-only). Note that this function may well invoke the streaming HDF5 driver when a valid socket descriptor is given. Such might well be created by a call to F5connect(). Note that the socket needs to be closed explicitely.

F5_API void F5socket_cleanup (  ) 

Calling windows socket cleanup on windows

F5_API void F5socket_init (  ) 

Calling windows socket init on windows

F5_API herr_t F5Xclose ( hid_t  obj_id  ) 

Close an object regardless of its type.

Use this function to close any HDF5-Object, if you do not know the type of the object. This is especially usefull after a call to H5Rdereference().

Remarks:
Normally you shouldn't use this function, because you should know the objects you are creating.
The function doesn't work for properties, supported are only the following types:
  • H5I_FILE
  • H5I_GROUP
  • H5I_DATATYPE
  • H5I_DATASPACE
  • H5I_DATASET
  • H5I_ATTR
Parameters:
ret_type_id A pointer to a storage to take the type of the given object. See H5Iget_type() for a list of types.
obj_id The ID of the object to be closed.
Returns:
Error Code of the closing function. (A non-negative value if successful; otherwise a negative value.)
Todo:
Better Error Value than "-1".
Note:
Could/should rename this to F5Dclose(), to denote it as a function to close F5 dataset ID's, which can be HDF5 groups or datasets.