h5cpp
0.6
A modern C++ wrapper for the HDF5 C library
|
namespace for node like objects and related functions
Classes | |
class | ChunkedDataset |
dataset with chunked layout More... | |
class | Dataset |
class | Group |
class | GroupView |
base class for group views More... | |
class | LinkTarget |
link target descriptor More... | |
class | Link |
an HDF5 link More... | |
class | LinkIterator |
class | LinkView |
class | Node |
class | NodeIterator |
bidirectional NodeIterator More... | |
class | NodeView |
class | RecursiveLinkIterator |
recursive Link iterator More... | |
class | RecursiveNodeIterator |
recursive node iterator More... | |
class | VirtualDataset |
virtual dataset class More... | |
Typedefs | |
using | Type = NodeType |
alias type to ensure compatibility with existing code More... | |
Enumerations | |
enum class | NodeType : std::underlying_type< H5O_type_t >::type { Unknown = H5O_TYPE_UNKNOWN , Group = H5O_TYPE_GROUP , Dataset = H5O_TYPE_DATASET , Datatype = H5O_TYPE_NAMED_DATATYPE } |
enumeration for node type More... | |
enum class | LinkType : std::underlying_type< H5L_type_t >::type { Hard = H5L_TYPE_HARD , Soft = H5L_TYPE_SOFT , External = H5L_TYPE_EXTERNAL , Error = H5L_TYPE_ERROR } |
link type enumeration More... | |
Functions | |
void | resize_by (const Dataset &dataset, size_t dimension_index, ssize_t delta) |
resize a dataset by a particular offset More... | |
void | copy (const Node &source, const Group &base, const Path &relative_path, const property::ObjectCopyList &ocpl=property::ObjectCopyList(), const property::LinkCreationList &lcpl=property::LinkCreationList()) |
copy node object More... | |
void | copy (const Node &source, const Group &destination, const property::ObjectCopyList &ocpl=property::ObjectCopyList(), const property::LinkCreationList &lcpl=property::LinkCreationList()) |
copy node object More... | |
void | move (const Node &source, const Group &base, const Path &relative_path, const property::LinkCreationList &lcpl=property::LinkCreationList(), const property::LinkAccessList &lapl=property::LinkAccessList()) |
move node object More... | |
void | move (const Node &source, const Group &destination, const property::LinkCreationList &lcpl=property::LinkCreationList(), const property::LinkAccessList &lapl=property::LinkAccessList()) |
move node object More... | |
void | remove (const Group &base, const Path &object_path, const property::LinkAccessList &lapl=property::LinkAccessList()) |
remove node from group More... | |
void | remove (const Node &object, const property::LinkAccessList &lapl=property::LinkAccessList()) |
remove node from group More... | |
void | link (const Node &target, const Group &link_base, const Path &link_path, const property::LinkCreationList &lcpl=property::LinkCreationList(), const property::LinkAccessList &lapl=property::LinkAccessList()) |
Create a soft or external link. More... | |
void | link (const Path &target_path, const Group &link_base, const Path &link_path, const property::LinkCreationList &lcpl=property::LinkCreationList(), const property::LinkAccessList &lapl=property::LinkAccessList()) |
Create a soft link. More... | |
void | link (const fs::path &target_file, const Path &target_path, const Group &link_base, const Path &link_path, const property::LinkCreationList &lcpl=property::LinkCreationList(), const property::LinkAccessList &lapl=property::LinkAccessList()) |
Create an external link. More... | |
Node | get_node (const Group &base, const Path &node_path, const property::LinkAccessList &lapl=property::LinkAccessList()) |
get node More... | |
Group | get_real_base (const Group &base, const Path &path, const property::LinkAccessList &lapl=property::LinkAccessList()) |
get real base of path More... | |
Group | get_group (const Group &base, const Path &path, const property::LinkAccessList &lapl=property::LinkAccessList()) |
get group More... | |
Dataset | get_dataset (const Group &base, const Path &path, const property::LinkAccessList &lapl=property::LinkAccessList()) |
get dataset More... | |
bool | is_group (const Node &node) |
predicate function returning true if node is a group More... | |
bool | is_dataset (const Node &node) |
predicate function returning true if a node is a dataset More... | |
bool | operator!= (const Link &lhs, const Link &rhs) |
std::ostream & | operator<< (std::ostream &stream, const Link &link) |
bool | operator== (const Node &lhs, const Node &rhs) |
bool | operator!= (const Node &lhs, const Node &rhs) |
std::ostream & | operator<< (std::ostream &stream, const NodeType &type) |
output stream operator for the NodeType enumeration More... | |
std::ostream & | operator<< (std::ostream &stream, const LinkType &type) |
output stream operator for the link type enumeration More... | |
using hdf5::node::Type = typedef NodeType |
This alias ensures, that existing code still using the old Type enumeration type is still working. Since NodeType and Type are equivalent from a structural point of view this should be no issue.
|
strong |
|
strong |
void hdf5::node::copy | ( | const Node & | source, |
const Group & | base, | ||
const Path & | relative_path, | ||
const property::ObjectCopyList & | ocpl = property::ObjectCopyList() , |
||
const property::LinkCreationList & | lcpl = property::LinkCreationList() |
||
) |
Copy source
object to a new relative_path
under base
Group. If an object of same name already exists an exception will be thrown.
The copy operation should also work across file boundaries. In all cases the source object as well as the destination group must exist.
source | object to be copied |
base | the destination base group where the new copy will be stored |
relative_path | the destination relative path under the base group |
ocpl | optional object copy property list |
lcpl | optional link creation property list |
std::runtime_error | in case of a failure |
void hdf5::node::copy | ( | const Node & | source, |
const Group & | destination, | ||
const property::ObjectCopyList & | ocpl = property::ObjectCopyList() , |
||
const property::LinkCreationList & | lcpl = property::LinkCreationList() |
||
) |
Copy source
object to a new location under destination
Group using the original object's name. For instance, if we have
then the copy will appear as /recorded/detectors/data. If an object of same name already exists an exception will be thrown.
The copy operation should also work across file boundaries. In all cases the source object as well as the destination group must exist.
source | object to be copied |
destination | the destination group where the new copy will be stored |
ocpl | optional object copy property list |
lcpl | optional link creation property list |
std::runtime_error | in case of a failure |
Dataset hdf5::node::get_dataset | ( | const Group & | base, |
const Path & | path, | ||
const property::LinkAccessList & | lapl = property::LinkAccessList() |
||
) |
A convenience function for get_node. Returns a Dataset instance if the node referenced by path
is a dataset, otherwise throws an exception. Use this function whenever you want to work with a Dataset temporarily.
For instance
std::runtime_error | in case of a failure |
base | base group |
path | path to dataset |
lapl | optional link access property list |
Group hdf5::node::get_group | ( | const Group & | base, |
const Path & | path, | ||
const property::LinkAccessList & | lapl = property::LinkAccessList() |
||
) |
A convenience function for get_node. Returns a Group instance if the node referenced by path
is a group, otherwise throws an exception. Use this function whenever you want to work with a Group temporarily.
For instance
std::runtime_error | in case of a failure |
base | base group |
path | path to group |
lapl | optional link access property list |
Node hdf5::node::get_node | ( | const Group & | base, |
const Path & | node_path, | ||
const property::LinkAccessList & | lapl = property::LinkAccessList() |
||
) |
Get a node from a base group.
std::runtime_error | in case of a failure |
base | reference to the base group |
node_path | reference to the path of the node |
lapl | optional link access property list |
Group hdf5::node::get_real_base | ( | const Group & | base, |
const Path & | path, | ||
const property::LinkAccessList & | lapl = property::LinkAccessList() |
||
) |
Helper function to facilitate a number of convenience functions in the wrapper. Gets the most proximate parent Group of path
. If path
is absolute, base
will only be used to obtain the root node of the file. If the parent node does not exist or is not a Group, an exception will be thrown.
std::runtime_error | in case of a failure |
base | base group for link |
path | path of desired node |
lapl | optional link access property list |
bool hdf5::node::is_dataset | ( | const Node & | node | ) |
This predicate function is used to filter dataset nodes. A typical application would be for instance
or whenever you want to partition a vector
std::runtime_error | in case of a failure |
node | reference to the node |
bool hdf5::node::is_group | ( | const Node & | node | ) |
This predicate function is used to filter group nodes. A typical application would be for instance
or whenever you want to partition a vector
std::runtime_error | in case of a failure |
node | reference to the node |
void hdf5::node::link | ( | const fs::path & | target_file, |
const Path & | target_path, | ||
const Group & | link_base, | ||
const Path & | link_path, | ||
const property::LinkCreationList & | lcpl = property::LinkCreationList() , |
||
const property::LinkAccessList & | lapl = property::LinkAccessList() |
||
) |
Create an external link to an object stored in a different file. The target object is determined by the target file and an absolute path within this file. The location of the link is given by a base group and a relative or absolute path. If link_path is a relative path the new link will be relative to link_base
. Otherwise link_base
is only used to determine the root group (and thus the file within which the link is placed).
std::runtime_error | in case of a failure |
target_file | the file where the link target is stored |
target_path | absolute path to the object which we want to reference in the target file |
link_base | base group for the link |
link_path | absolute or relative path to the new link |
lcpl | optional link creation property list |
lapl | optional link access property list |
target_path
must be an absolute path link_base
must be a valid HDF5 object void hdf5::node::link | ( | const Node & | target, |
const Group & | link_base, | ||
const Path & | link_path, | ||
const property::LinkCreationList & | lcpl = property::LinkCreationList() , |
||
const property::LinkAccessList & | lapl = property::LinkAccessList() |
||
) |
Create a link from link_path
under link_base
to object at target_path
under target_base
. A soft link will be created if link_base
and target_base
reside in the same file. Otherwise an external link is created.
The target for the link is determined by target_base
and target_path
. If the latter one is a relative path the target location is assumed relative to target_base
. If it is an absolute path, target_base
is used to retrieve the root group of the specific file.
target | the target node (could also be path here?) |
link_base | the base group for the link location |
link_path | path to the new link (either relative or absolute) |
lcpl | optional link creation property list |
lapl | optional link access property list |
void hdf5::node::link | ( | const Path & | target_path, |
const Group & | link_base, | ||
const Path & | link_path, | ||
const property::LinkCreationList & | lcpl = property::LinkCreationList() , |
||
const property::LinkAccessList & | lapl = property::LinkAccessList() |
||
) |
Create a link from link_path
under link_base
to object at target_path
. The object at target_path
need not already exist at this time.
If the target_path
is a relative path the target location is assumed relative to link_base
. If absolute, the path is assumed to be on the same file as link_base
.
target_path | the target node (could also be path here?) |
link_base | the base group for the link location |
link_path | path to the new link (either relative or absolute) |
lcpl | optional link creation property list |
lapl | optional link access property list |
void hdf5::node::move | ( | const Node & | source, |
const Group & | base, | ||
const Path & | relative_path, | ||
const property::LinkCreationList & | lcpl = property::LinkCreationList() , |
||
const property::LinkAccessList & | lapl = property::LinkAccessList() |
||
) |
Move source
object to a new relative_path
under base
Group. If an object of same name already exists an exception will be thrown. In all cases the source object as well as the destination group must exist.
source | object to be moved |
base | the destination base group where the object will be moved |
relative_path | the destination relative path under the base group |
lcpl | optional link creation property list |
lapl | optional link access property list |
std::runtime_error | in case of a failure |
void hdf5::node::move | ( | const Node & | source, |
const Group & | destination, | ||
const property::LinkCreationList & | lcpl = property::LinkCreationList() , |
||
const property::LinkAccessList & | lapl = property::LinkAccessList() |
||
) |
Move source
object to a new location under destination
Group using the original object's name. For instance, if we have
then the moved object will appear as /recorded/detectors/data. If an object of same name already exists an exception will be thrown. In all cases the source object as well as the destination group must exist.
source | object to be moved |
destination | the new group where the object should be located |
lcpl | optional link creation property list |
lapl | optional link access property list |
std::runtime_error | in case of a failure |
std::ostream& hdf5::node::operator<< | ( | std::ostream & | stream, |
const Link & | link | ||
) |
std::ostream& hdf5::node::operator<< | ( | std::ostream & | stream, |
const LinkType & | type | ||
) |
This operator writes a textual representation of the link type to the output stream.
stream | refernce to the output stream |
type | reference to the link type |
std::ostream& hdf5::node::operator<< | ( | std::ostream & | stream, |
const NodeType & | type | ||
) |
This operator writes a text representation of the node type to the output stream.
stream | reference to the output stream |
type | the actual type to write to the stream |
void hdf5::node::remove | ( | const Group & | base, |
const Path & | object_path, | ||
const property::LinkAccessList & | lapl = property::LinkAccessList() |
||
) |
Removes link at object_path
within the base
Group. If there are more references (links) to this particular object, they remain active. Additionally: removing an object entirely from an HDF5 file means removing all links to this object and thus rendering it inaccessible. No storage space in the file will be cleared. In order to reduce the size of the file h5repack
must be used which will simply not copy objects which cannot be referenced.
std::runtime_error | in case of a failure |
base | group relative to which the link or object resides |
object_path | path relative to base determining the link or object to remove |
lapl | optional link access property list |
void hdf5::node::remove | ( | const Node & | object, |
const property::LinkAccessList & | lapl = property::LinkAccessList() |
||
) |
Removes link to object
from parent Group via which it was accessed.
std::runtime_error | in case of a failure |
object | the object which to remove |
object
must be a valid HDF5 object instance lapl | optional link access property list |
void hdf5::node::resize_by | ( | const Dataset & | dataset, |
size_t | dimension_index, | ||
ssize_t | delta | ||
) |
Resizes a dataset along the dimension determined by dimension_index by delta elements. As delta is a signed integer one can either enlarge or shrink the dataset.
dataset | reference to the dataset to resize |
dimension_index | the index of the dimension to resize |
delta | the number of elements about which the dataset should be resized |
std::runtime_error | in case of any failure |