|
h5cpp
0.4.1
A modern C++ wrapper for the HDF5 C library
|
path to a node object More...
#include <path.hpp>
Public Types | |
| using | value_type = std::string |
| using | iterator = std::list< value_type >::iterator |
| using | const_iterator = std::list< value_type >::const_iterator |
| using | reverse_iterator = std::list< value_type >::reverse_iterator |
| using | const_reverse_iterator = std::list< value_type >::const_reverse_iterator |
Public Member Functions | |
| Path () | |
| default constructor More... | |
| Path (const std::string &str) | |
| constructor More... | |
| Path (const char *str) | |
| Path (const_iterator first_element, const_iterator last_element) | |
| constructor from iterators More... | |
| Path (const Path &p)=default | |
| copy constructor More... | |
| operator std::string () const | |
| size_t | size () const noexcept |
| return number of path elements More... | |
| bool | absolute () const noexcept |
| returns true if a path is absolute More... | |
| void | absolute (bool value) noexcept |
| set a path to be absolute More... | |
| bool | is_root () const |
| true if the path refers to the root group More... | |
| bool | is_name () const |
| true if the path is a valid child name More... | |
| std::string | name () const |
| get object name from a path More... | |
| Path | parent () const |
| get parent path More... | |
| void | append (const Path &p) |
| append a path to this instance More... | |
| Path | relative_to (const Path &base) const |
| Path & | operator+= (const Path &other) |
| const_iterator | begin () const |
| get forward iterators More... | |
| const_iterator | end () const |
| get forward iterators More... | |
| const_reverse_iterator | rbegin () const |
| get reverse iterator More... | |
| const_reverse_iterator | rend () const |
| get reverse iterator More... | |
Friends | |
| bool | operator== (const Path &lhs, const Path &rhs) |
| checks two paths for equality More... | |
| Path | common_base (const Path &lhs, const Path &rhs) |
Every object within an HDF5 file can be addressed via a path. Such a path is a list of link names separated by a slash /. While HDF5s C-API uses a simple string to represent a path, the C++ wrapper provides a class for this purpose.
Though an HDF5 path look quit similar to an Unix filesystem path there is one major difference: .. has no special meaning. On a Unix filesystem .. would reference to the directory above the current one. In HDF5 .. simply means nothing. It would be even allowed to use .. as a name for a group, dataset or committed datatype.
| using hdf5::Path::const_iterator = std::list<value_type>::const_iterator |
| using hdf5::Path::const_reverse_iterator = std::list<value_type>::const_reverse_iterator |
| using hdf5::Path::iterator = std::list<value_type>::iterator |
| using hdf5::Path::reverse_iterator = std::list<value_type>::reverse_iterator |
| using hdf5::Path::value_type = std::string |
| hdf5::Path::Path | ( | ) |
After default construction is list of path elements is empty and the absolute path flag is set to false.
| hdf5::Path::Path | ( | const std::string & | str | ) |
Construct a path from a string. We use an explicit constructor here to avoid accidental conversions.
| hdf5::Path::Path | ( | const char * | str | ) |
| hdf5::Path::Path | ( | const_iterator | first_element, |
| const_iterator | last_element | ||
| ) |
|
default |
|
noexcept |
A path is considered absolute if its first element references the root node. This is indicated by a leading / of the path string.
|
noexcept |
Use this flag to set or unset the absolut flag.
| value | boolean value deciding whether a path is absolute or not |
| void hdf5::Path::append | ( | const Path & | p | ) |
Adding path p to this instance. Basically this
| const_iterator hdf5::Path::begin | ( | ) | const |
| const_iterator hdf5::Path::end | ( | ) | const |
| bool hdf5::Path::is_name | ( | ) | const |
A path is considered to be a valid child name if list of elements equals one and the absolute path flag is not set.
| bool hdf5::Path::is_root | ( | ) | const |
A path is considered to reference the root group if the list of elements is empty but the absolute path flag is set.
You can construct a root path with
or
though the former idiom shoud be prefered.
| std::string hdf5::Path::name | ( | ) | const |
|
inlineexplicit |
| Path hdf5::Path::parent | ( | ) | const |
This is basically the path with the last component stripped of. In the case that the path references the root group the parent is the root group again.
but
| const_reverse_iterator hdf5::Path::rbegin | ( | ) | const |
| const_reverse_iterator hdf5::Path::rend | ( | ) | const |
|
noexcept |
Returns the number of elements in the path. In the case that the path references the root group this method will return 0.
Two paths are considered equal if each of their elements is