HDF5 NeXus writer API Reference
The following functions are part of the HDF5 NeXus writer API version 1.0.
Programming Hints:
To use any of these functions or subroutines, you must first include the relevant include file in your application.
The following line includes the HDF5 NeXus writer API package, H5NX, in C++ applications:
#include "h5nx.hpp"
The C++ Interfaces:
Initialization functions
|
Dataset functions
|
Group, link, attribute functions
|
Performance functions
|
- Name: H5nx
- Signature:
- H5nx ()
- Purpose:
- Creates a H5nx instance.
- Description:
- H5nx is the class constructor and creates an instance of the class. It takes no arguments and initializes private class variables.
-
Parameters:
-
Returns:
- No return value.
- Name: H5NXcreate_file
- Signature:
- int H5NXcreate_file ( const std::string& file_name )
- Purpose:
- Creates a NeXus file.
- Description:
H5NXcreate_file
creates a HDF5 file named file_name
and writes NeXus metadata to it, namely root group attributes conforming to the NeXus format specification.
-
Parameters:
const std::string& file_name |
IN: String containing the file name. |
-
Returns:
- Returns a non-negative value if successful; otherwise returns a negative value.
- Name: H5NXclose_file
- Signature:
- int H5NXclose_file ()
- Purpose:
- Closes the NeXus file.
- Description:
H5NXclose_file
closes the HDF5 file created with H5NXcreate_file
.
-
Parameters:
-
-
Returns:
- Returns a non-negative value if successful; otherwise returns a negative value.
- Name: H5NXmake_dataset_string
- Signature:
- int H5NXmake_dataset_string ( const std::string& group_path, const std::string& dataset_name, const std::string& data )
- Purpose:
- Creates and writes a string dataset.
- Description:
H5NXmake_dataset_string
creates a dataset named dataset_name
in the path group_path
, and writes the string data
to it.
-
Parameters:
const std::string& group_path |
IN: String containing the absolute group path. |
const std::string& dataset_name |
IN: String containing the dataset name. |
const std::string& data |
IN: String containing the data to write. |
-
Returns:
- Returns a non-negative value if successful; otherwise returns a negative value.
- Name: H5NXmake_dataset_scalar
- Signature:
- template < typename NumT > int H5NXmake_dataset_scalar ( const std::string& group_path, const std::string& dataset_name, const NumT& value )
- Purpose:
- Creates and writes a scalar numerical dataset.
- Description:
H5NXmake_dataset_scalar
creates a dataset named dataset_name
in the path group_path
, and writes the scalar value value
to it.
-
Parameters:
const std::string& group_path |
IN: String containing the absolute group path. |
const std::string& dataset_name |
IN: String containing the dataset name. |
const NumT& value |
IN: Numerical value containing the data to write. Defined value types are uint16_t, uint64_t, float and double. |
-
Returns:
- Returns a non-negative value if successful; otherwise returns a negative value.
- Name: H5NXmake_dataset_vector
- Signature:
- template < typename NumT > int H5NXmake_dataset_vector ( const std::string& group_path, const std::string& dataset_name, const std::vector< NumT >& vec, const std::vector< hsize_t >& dim_vec )
- Purpose:
- Creates and writes a vector numerical dataset.
- Description:
H5NXmake_dataset_vector
creates a dataset named dataset_name
in the path group_path
, and writes the vector vec
to it.
-
Parameters:
const std::string& group_path |
IN: String containing the absolute group path. |
const std::string& dataset_name |
IN: String containing the dataset name. |
const std::vector< NumT > vec |
IN: Vector containing the data to write. Defined value types are uint32_t, uint64_t, float and double. |
const std::vector< hsize_t > dim_vec |
IN: Dataset dimensions. |
-
Returns:
- Returns a non-negative value if successful; otherwise returns a negative value.
- Name: H5NXcreate_dataset_extend
- Signature:
- int H5NXcreate_dataset_extend ( const std::string& group_path, const std::string& dataset_name, int nxdatatype, hsize_t chunk_size )
- Purpose:
- Creates an extendable dataset.
- Description:
H5NXcreate_dataset_extend
creates a dataset named dataset_name
in the path group_path
.
-
Parameters:
const std::string& group_path |
IN: String containing the absolute group path. |
const std::string& dataset_name |
IN: String containing the dataset name. |
int nxdatatype |
IN: NeXus datatype. |
hsize_t chunk_size |
IN: Dataset chunk size. |
-
Returns:
- Returns a non-negative value if successful; otherwise returns a negative value.
- Name: H5NXappend_slab
- Signature:
- template < typename NumT > int H5NXappend_slab ( const std::string& dataset_path, const std::vector< NumT >& vec )
- Purpose:
- Appends a vector to a dataset.
- Description:
H5NXappend_slab
appends a vector vec
to the dataset dataset_path
.
-
Parameters:
const std::string& dataset_path |
IN: String containing the absolute dataset path. |
const std::vector< NumT > vec |
IN: Vector containing the data to write. Defined value types are uint32_t, uint64_t, float and double. |
-
Returns:
- Returns a non-negative value if successful; otherwise returns a negative value.
- Name: H5NXmake_group
- Signature:
- int H5NXmake_group ( const std::string& group_path, const std::string& class_name )
- Purpose:
- Creates a group.
- Description:
H5NXmake_group
creates a group named group_path
with the NeXus class class_name
.
-
Parameters:
const std::string& group_path |
IN: String containing the absolute group path. |
const std::string& class_name |
IN: NeXus class. |
-
Returns:
- Returns a non-negative value if successful; otherwise returns a negative value.
- Name: H5NXmake_link
- Signature:
- int H5NXmake_link ( const std::string& current_name, const std::string& destination_name )
- Purpose:
- Creates a HDF5 link.
- Description:
H5NXmake_link
creates a link named destination_name
from an existing name current_name
.
-
Parameters:
const std::string& current_name |
IN: Current name. |
const std::string& destination_name |
IN: New name. |
-
Returns:
- Returns a non-negative value if successful; otherwise returns a negative value.
- Name: H5NXmake_attribute_string
- Signature:
- int H5NXmake_attribute_string ( const std::string& dataset_path, const std::string& attr_name, const std::string& attr_value )
- Purpose:
- Creates and writes a string attribute.
- Description:
H5NXmake_attribute_string
creates an attribute named attr_name
in the dataset named dataset_path
and writes the string attr_value
to it.
-
Parameters:
const std::string& dataset_path |
IN: Absolute dataset name. |
const std::string& attr_name |
IN: Attribute name. |
const std::string& attr_value |
IN: Attribute value. |
-
Returns:
- Returns a non-negative value if successful; otherwise returns a negative value.
- Name: H5NXmake_attribute_scalar
- Signature:
- template < typename NumT > int H5NXmake_attribute_scalar ( const std::string& dataset_path, const std::string& attr_name, const NumT& value )
- Purpose:
- Creates and writes a scalar numerical attribute.
- Description:
H5NXmake_attribute_scalar
creates an attribute named attr_name
in the dataset named dataset_path
, and writes the scalar value value
to it.
-
Parameters:
const std::string& dataset_path |
IN: String containing the absolute dataset name. |
const std::string& attr_name |
IN: String containing the attribute name. |
const NumT& value |
IN: Numerical value containing the data to write. Defined value types are uint16_t and uint32_t. |
-
Returns:
- Returns a non-negative value if successful; otherwise returns a negative value.
- Name: H5NXflush
- Signature:
- int H5NXflush ()
- Purpose:
- Writes data to disk.
- Description:
H5NXflush
causes all buffers associated with a file to be immediately flushed to disk.
-
Parameters:
-
Returns:
- Returns a non-negative value if successful; otherwise returns a negative value.
- Name: H5NXset_cache_size
- Signature:
- void H5NXset_cache_size ( size_t size )
- Purpose:
- Set the chunk cache size.
- Description:
H5NXset_cache_size
sets the chunk cache size to size
.
-
Parameters:
size_t size |
IN: Size of chunk cache. |
-
Returns:
- Nothing.