h5cpp 0.7
A modern C++ wrapper for the HDF5 C library
Loading...
Searching...
No Matches
hdf5::node::Group Class Reference

#include <group.hpp>

Inheritance diagram for hdf5::node::Group:
Collaboration diagram for hdf5::node::Group:

Public Member Functions

 Group ()
 default constructor
 
 Group (const Group &group)
 copy constructor
 
 Group (const Node &node)
 constructor
 
 Group (const Group &parent, const Path &path, const property::LinkCreationList &lcpl=property::LinkCreationList(), const property::GroupCreationList &gcpl=property::GroupCreationList(), const property::GroupAccessList &gapl=property::GroupAccessList())
 constructor
 
virtual ~Group () override
 
Groupoperator= (const Group &group)
 copy assignment operator
 
void flush () const
 flush the group (since hdf5 1.10.0)
 
IteratorConfigiterator_config () noexcept
 get reference to the iterator configuration
 
const IteratorConfigiterator_config () const noexcept
 get reference to the interator configuration
 
bool exists (const std::string &name, const property::LinkAccessList &lapl=property::LinkAccessList()) const
 checks existence of a node
 
Group create_group (const std::string &name, const property::LinkCreationList &lcpl=property::LinkCreationList(), const property::GroupCreationList &gcpl=property::GroupCreationList(), const property::GroupAccessList &gapl=property::GroupAccessList()) const
 create a new group
 
Dataset create_dataset (const std::string &name, const datatype::Datatype &type, const dataspace::Dataspace &space, const property::DatasetCreationList &dcpl=property::DatasetCreationList(), const property::LinkCreationList &lcpl=property::LinkCreationList(), const property::DatasetAccessList &dapl=property::DatasetAccessList()) const
 create a new dataset
 
Node operator[] (const Path &path) const
 get node
 
void create_link (const Path &link_path, const fs::path &target_file, const Path &target_path, const property::LinkCreationList &lcpl=property::LinkCreationList(), const property::LinkAccessList &lapl=property::LinkAccessList())
 Create an external link.
 
void create_link (const Path &link_path, const Path &target_path, const property::LinkCreationList &lcpl=property::LinkCreationList(), const property::LinkAccessList &lapl=property::LinkAccessList())
 Create a soft link.
 
void create_link (const Path &link_path, const Node &target, const property::LinkCreationList &lcpl=property::LinkCreationList(), const property::LinkAccessList &lapl=property::LinkAccessList())
 Create a soft or external link.
 
void copy_here (const Path &link_path, const Node &target, const property::ObjectCopyList &ocpl=property::ObjectCopyList(), const property::LinkCreationList &lcpl=property::LinkCreationList())
 copy node object
 
void copy_here (const Node &target, const property::ObjectCopyList &ocpl=property::ObjectCopyList(), const property::LinkCreationList &lcpl=property::LinkCreationList())
 copy node object
 
void move_here (const Path &link_path, const Node &target, const property::LinkCreationList &lcpl=property::LinkCreationList(), const property::LinkAccessList &lapl=property::LinkAccessList())
 move node object
 
void move_here (const Node &target, const property::LinkCreationList &lcpl=property::LinkCreationList(), const property::LinkAccessList &lapl=property::LinkAccessList())
 move node object
 
void remove (const Path &path, const property::LinkAccessList &lapl=property::LinkAccessList())
 remove node from group
 
bool has_group (const Path &path, const property::LinkAccessList &lapl=property::LinkAccessList()) const noexcept
 reports if group has a link to a valid group at specified path
 
bool has_dataset (const Path &path, const property::LinkAccessList &lapl=property::LinkAccessList()) const noexcept
 reports if group has a link to a valid dataset at specified path
 
Group get_group (const Path &path, const property::LinkAccessList &lapl=property::LinkAccessList()) const
 get group
 
Dataset get_dataset (const Path &path, const property::LinkAccessList &lapl=property::LinkAccessList()) const
 get dataset
 
- Public Member Functions inherited from hdf5::node::Node
 Node (ObjectHandle &&handle, const Link &link)
 constructor
 
 Node ()
 default constructor
 
 Node (const Node &)
 copy constructor
 
Nodeoperator= (const Node &node)
 copy assignment
 
virtual ~Node ()
 destructor
 
NodeType type () const
 return the node type
 
ObjectId id () const
 get unique ID
 
 operator hid_t () const
 
bool is_valid () const
 true if an object is valid
 
void close ()
 close the node
 
const Linklink () const
 return link to object
 

Public Attributes

LinkView links
 
NodeView nodes
 
- Public Attributes inherited from hdf5::node::Node
attribute::AttributeManager attributes
 access to the attribute manager
 

Constructor & Destructor Documentation

◆ Group() [1/4]

hdf5::node::Group::Group ( )

Does nothing else than calling the default constructor of Node and leaves in valid HDF5 object.

◆ Group() [2/4]

hdf5::node::Group::Group ( const Group group)

◆ Group() [3/4]

hdf5::node::Group::Group ( const Node node)

Construct an instance of Group from a generic Node class.

Exceptions
std::runtime_errorin case of a failure

◆ Group() [4/4]

hdf5::node::Group::Group ( const Group parent,
const Path path,
const property::LinkCreationList lcpl = property::LinkCreationList(),
const property::GroupCreationList gcpl = property::GroupCreationList(),
const property::GroupAccessList gapl = property::GroupAccessList() 
)
Parameters
parentreference to the parent group of the new group
paththe path to the new group
lcplreference to the link creation property list
gcplreference to the group creation property list
gaplreference to the group access property list

◆ ~Group()

virtual hdf5::node::Group::~Group ( )
inlineoverridevirtual

Member Function Documentation

◆ copy_here() [1/2]

void hdf5::node::Group::copy_here ( const Node target,
const property::ObjectCopyList ocpl = property::ObjectCopyList(),
const property::LinkCreationList lcpl = property::LinkCreationList() 
)

Copy target object to a new location under this Group using the original object's name. 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.

Parameters
targetobject to be copied
ocploptional object copy property list
lcploptional link creation property list
Exceptions
std::runtime_errorin case of a failure

◆ copy_here() [2/2]

void hdf5::node::Group::copy_here ( const Path link_path,
const Node target,
const property::ObjectCopyList ocpl = property::ObjectCopyList(),
const property::LinkCreationList lcpl = property::LinkCreationList() 
)

Copy target object to a new link_path within this 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.

Parameters
link_paththe destination relative path under the this group
targetobject to be copied
ocploptional object copy property list
lcploptional link creation property list
Exceptions
std::runtime_errorin case of a failure

◆ create_dataset()

Dataset hdf5::node::Group::create_dataset ( const std::string &  name,
const datatype::Datatype type,
const dataspace::Dataspace space,
const property::DatasetCreationList dcpl = property::DatasetCreationList(),
const property::LinkCreationList lcpl = property::LinkCreationList(),
const property::DatasetAccessList dapl = property::DatasetAccessList() 
) const

◆ create_group()

Group hdf5::node::Group::create_group ( const std::string &  name,
const property::LinkCreationList lcpl = property::LinkCreationList(),
const property::GroupCreationList gcpl = property::GroupCreationList(),
const property::GroupAccessList gapl = property::GroupAccessList() 
) const

◆ create_link() [1/3]

void hdf5::node::Group::create_link ( const Path link_path,
const fs::path &  target_file,
const Path target_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. If link_path is a relative path the new link will be relative to the link_base group. Otherwise link_base is only used to determine the root group (and thus the file within which the link is placed).

Exceptions
std::runtime_errorin case of a failure
Parameters
link_pathabsolute or relative path to the new link
target_filethe file where the link target is stored
target_pathabsolute path to the object which we want to reference in the target file
lcploptional link creation property list
laploptional link access property list
Precondition
target_path must be an absolute path

◆ create_link() [2/3]

void hdf5::node::Group::create_link ( const Path link_path,
const Node target,
const property::LinkCreationList lcpl = property::LinkCreationList(),
const property::LinkAccessList lapl = property::LinkAccessList() 
)

Create a link from link_path to target object. A soft link will be created if group 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.

Parameters
link_pathpath to the new link (either relative or absolute)
targetthe target node
lcploptional link creation property list
laploptional link access property list

◆ create_link() [3/3]

void hdf5::node::Group::create_link ( const Path link_path,
const Path target_path,
const property::LinkCreationList lcpl = property::LinkCreationList(),
const property::LinkAccessList lapl = property::LinkAccessList() 
)

Create a soft link to an object stored in the same file. If link_path is a relative path the new link will be relative to the link_base group.

Exceptions
std::runtime_errorin case of a failure
Parameters
link_pathabsolute or relative path to the new link
target_pathabsolute path to the object which we want to reference in the target file
lcploptional link creation property list
laploptional link access property list
Precondition
target_path must be an absolute path

◆ exists()

bool hdf5::node::Group::exists ( const std::string &  name,
const property::LinkAccessList lapl = property::LinkAccessList() 
) const

The name must be a valid link and valid child name. This function checks whether a link of a particular name exists and can be resolved into an object.

◆ flush()

void hdf5::node::Group::flush ( ) const
Exceptions
std::runtime_errorin case of a failure)

◆ get_dataset()

Dataset hdf5::node::Group::get_dataset ( const Path path,
const property::LinkAccessList lapl = property::LinkAccessList() 
) const

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

Group root = file.root();
Dataspace space = root.get_dataset("run_01/sensors/temperature").dataspace();
dataspace::Dataspace dataspace() const
get dataspace of dataset
Definition group.hpp:51
Dataset get_dataset(const Path &path, const property::LinkAccessList &lapl=property::LinkAccessList()) const
get dataset
Exceptions
std::runtime_errorin case of a failure
Parameters
pathpath to dataset
laploptional link access property list
Returns
new Group instance
See also
get_node
get_dataset

◆ get_group()

Group hdf5::node::Group::get_group ( const Path path,
const property::LinkAccessList lapl = property::LinkAccessList() 
) const

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

Group root = file.root();
if(root.get_group("run_01/sensors").nodes.size()!=0)
{
}
size_t size() const
get number of links
Group get_group(const Path &path, const property::LinkAccessList &lapl=property::LinkAccessList()) const
get group
NodeView nodes
Definition group.hpp:54
Exceptions
std::runtime_errorin case of a failure
Parameters
pathpath to group
laploptional link access property list
Returns
new Group instance
See also
get_node
get_dataset

◆ has_dataset()

bool hdf5::node::Group::has_dataset ( const Path path,
const property::LinkAccessList lapl = property::LinkAccessList() 
) const
noexcept
Parameters
pathpath to dataset
laploptional link access property list
Returns
true if the group has a dataset, false otherwise

◆ has_group()

bool hdf5::node::Group::has_group ( const Path path,
const property::LinkAccessList lapl = property::LinkAccessList() 
) const
noexcept
Parameters
pathpath to group
laploptional link access property list
Returns
true if the group has a group, false otherwise

◆ iterator_config() [1/2]

const IteratorConfig & hdf5::node::Group::iterator_config ( ) const
inlinenoexcept

Return a const reference to the iterator configuration of the gruop.

Returns
reference to iterator configuration

◆ iterator_config() [2/2]

IteratorConfig & hdf5::node::Group::iterator_config ( )
inlinenoexcept

Return a non-const reference to the iterator configuration for the group.

Returns
reference to iterator configuration

◆ move_here() [1/2]

void hdf5::node::Group::move_here ( const Node target,
const property::LinkCreationList lcpl = property::LinkCreationList(),
const property::LinkAccessList lapl = property::LinkAccessList() 
)

Move target object to a new location under this Group using the original object's name. If an object of same name already exists an exception will be thrown.

Parameters
targetobject to be moved
lcploptional link creation property list
laploptional link access property list
Exceptions
std::runtime_errorin case of a failure

◆ move_here() [2/2]

void hdf5::node::Group::move_here ( const Path link_path,
const Node target,
const property::LinkCreationList lcpl = property::LinkCreationList(),
const property::LinkAccessList lapl = property::LinkAccessList() 
)

Move target object to a new link_path under this Group. If an object of same name already exists an exception will be thrown.

Parameters
link_paththe destination relative path under the this group
targetobject to be moved
lcploptional link creation property list
laploptional link access property list
Exceptions
std::runtime_errorin case of a failure
See also
copy for the naming convention

◆ operator=()

Group & hdf5::node::Group::operator= ( const Group group)

◆ operator[]()

Node hdf5::node::Group::operator[] ( const Path path) const

Retrieves node from group at specified path. Path can be relative or absolute.

Parameters
pathpath to node
Exceptions
std::runtime_errorin case of a failure
Returns
returns node if the link can be resolved

◆ remove()

void hdf5::node::Group::remove ( const Path path,
const property::LinkAccessList lapl = property::LinkAccessList() 
)

Remove link at path within this Group.

Exceptions
std::runtime_errorin case of a failure
Parameters
pathpath of object to remove
laploptional link access property list
See also
remove(const Node &base, const Path &object_path)

Member Data Documentation

◆ links

LinkView hdf5::node::Group::links

◆ nodes

NodeView hdf5::node::Group::nodes

The documentation for this class was generated from the following file: