libpniio
|
Nexus path class. More...
#include <nxpath.hpp>
Public Types | |
typedef std::pair < pni::core::string, pni::core::string > | element_type |
object element (groupname:class) More... | |
typedef std::list< element_type > | elements_type |
a list of subsequent objects More... | |
typedef elements_type::iterator | iterator |
iterator over elements More... | |
typedef elements_type::const_iterator | const_iterator |
const iterator over elements More... | |
Public Member Functions | |
nxpath () | |
default constructor More... | |
nxpath (const pni::core::string &file, const elements_type &groups, const pni::core::string &attr) | |
constructor More... | |
bool | has_filename () const noexcept |
true if has filename More... | |
bool | has_attribute () const noexcept |
true if has attribute More... | |
pni::core::string | filename () const noexcept |
return the filename More... | |
void | filename (const pni::core::string &f) |
set the filename More... | |
pni::core::string | attribute () const noexcept |
return the attribute name More... | |
void | attribute (const pni::core::string &a) |
set the attribute name More... | |
void | push_back (const element_type &o) |
append element More... | |
void | push_front (const element_type &o) |
prepend element More... | |
void | pop_front () |
last element from path More... | |
void | pop_back () |
remove first element from path More... | |
element_type | front () const |
get last element More... | |
element_type | back () const |
get first element More... | |
size_t | size () const |
return number of group entries More... | |
iterator | begin () |
get iterator to first element More... | |
iterator | end () |
get iterator to last+1 element More... | |
const_iterator | begin () const |
get const iterator to first element More... | |
const_iterator | end () const |
get const iterator to last+1 element More... | |
Static Public Member Functions | |
static nxpath | from_string (const pni::core::string &input) |
create path from string More... | |
static pni::core::string | to_string (const nxpath &p) |
create string from path More... | |
Private Attributes | |
pni::core::string | _file_name |
name of the file More... | |
pni::core::string | _attribute_name |
name of an attribute More... | |
elements_type | _elements |
list of groups More... | |
This class represents a full Nexus path. Such a path describes the position of an object within a Nexus file. In general the path has a form like this
More specific this can be written as
Usage
A path can either be absolute or relative to a particular object. However, a path with a filename part is always absolute (for obvious reasons).
typedef elements_type::const_iterator pni::io::nx::nxpath::const_iterator |
typedef std::pair<pni::core::string,pni::core::string> pni::io::nx::nxpath::element_type |
typedef std::list<element_type> pni::io::nx::nxpath::elements_type |
typedef elements_type::iterator pni::io::nx::nxpath::iterator |
pni::io::nx::nxpath::nxpath | ( | ) |
|
explicit |
file | name of the file |
groups | a list of elements for the object path |
attr | the optional name of an attribute |
|
noexcept |
void pni::io::nx::nxpath::attribute | ( | const pni::core::string & | a | ) |
nxpath::element_type pni::io::nx::nxpath::back | ( | ) | const |
Return the first element of the Nexus path
nxpath::iterator pni::io::nx::nxpath::begin | ( | ) |
nxpath::const_iterator pni::io::nx::nxpath::begin | ( | ) | const |
nxpath::iterator pni::io::nx::nxpath::end | ( | ) |
nxpath::const_iterator pni::io::nx::nxpath::end | ( | ) | const |
|
noexcept |
void pni::io::nx::nxpath::filename | ( | const pni::core::string & | f | ) |
|
static |
This method creates a path from a string passed to it.
parser_error | in case of parsing problems |
input | string with path representation |
|
inline |
Return the last element of the Nexus path.
|
noexcept |
Returns true if the path contains an attribute name.
|
noexcept |
Returns true if the path contains a file name.
void pni::io::nx::nxpath::pop_back | ( | ) |
void pni::io::nx::nxpath::pop_front | ( | ) |
void pni::io::nx::nxpath::push_back | ( | const element_type & | o | ) |
Append a new element to the end of the Nexus path.
value_error | if one tries to push_back a root group to a non-empty path |
o | element to append |
void pni::io::nx::nxpath::push_front | ( | const element_type & | o | ) |
Append an element to the beginning of the Nexus path.
o | element to append |
size_t pni::io::nx::nxpath::size | ( | ) | const |
|
static |
Returns the string representation of a path.
p | reference to path instance |
|
private |
|
private |
|
private |