h5cpp  0.6.1
A modern C++ wrapper for the HDF5 C library
hdf5::attribute::AttributeManager Class Reference

provides STL interface for attributes More...

#include <attribute_manager.hpp>

Public Member Functions

 AttributeManager ()=delete
 
 AttributeManager (node::Node &node)
 constructor More...
 
 AttributeManager (const AttributeManager &manager)=default
 copy constructor More...
 
Attribute operator[] (size_t index) const
 get attribute by index More...
 
Attribute operator[] (const std::string &name) const
 get attribute by name More...
 
size_t size () const
 get number of attributes More...
 
void remove (const std::string &name) const
 remove attribute by name More...
 
void remove (size_t index) const
 remove attribute by index More...
 
bool exists (const std::string &name) const
 check existence More...
 
void rename (const std::string &old_name, const std::string &new_name) const
 rename an attribute More...
 
Attribute create (const std::string &name, const datatype::Datatype &datatype, const dataspace::Dataspace &dataspace, const property::AttributeCreationList &acpl=property::AttributeCreationList()) const
 create an attribute More...
 
template<typename T >
Attribute create (const std::string &name, const property::AttributeCreationList &acpl=property::AttributeCreationList()) const
 create scalar attribute More...
 
template<typename T >
Attribute create (const std::string &name, const Dimensions &shape, const property::AttributeCreationList &acpl=property::AttributeCreationList()) const
 create a multidimensional attribute More...
 
template<typename T >
Attribute create_from (const std::string &name, const T &value)
 create a new attribute of a given value More...
 
IteratorConfigiterator_config () noexcept
 get iterator configuration More...
 
const IteratorConfigiterator_config () const noexcept
 
const node::Nodenode () const noexcept
 get parent node More...
 
AttributeIterator begin () const
 get iterator to first attribute More...
 
AttributeIterator end () const
 get iterator to last+1 attribute More...
 

Detailed Description

The AttributeManager class provides an STL compliant interface to access attribute attached to a Node.

Constructor & Destructor Documentation

◆ AttributeManager() [1/3]

hdf5::attribute::AttributeManager::AttributeManager ( )
delete

◆ AttributeManager() [2/3]

hdf5::attribute::AttributeManager::AttributeManager ( node::Node node)

Creates a new instance of AttributeManager which must be attached to a Node instance.

Exceptions
std::runtime_errorin case of a failure
Parameters
nodereference to the parent node of the manager

◆ AttributeManager() [3/3]

hdf5::attribute::AttributeManager::AttributeManager ( const AttributeManager manager)
default

Use the compiler provided default implementation here.

Member Function Documentation

◆ begin()

AttributeIterator hdf5::attribute::AttributeManager::begin ( ) const

◆ create() [1/3]

Attribute hdf5::attribute::AttributeManager::create ( const std::string &  name,
const datatype::Datatype datatype,
const dataspace::Dataspace dataspace,
const property::AttributeCreationList acpl = property::AttributeCreationList() 
) const

This is the most generic method to create attributes. See the template method below for more simple construction.

◆ create() [2/3]

template<typename T >
Attribute hdf5::attribute::AttributeManager::create ( const std::string &  name,
const Dimensions shape,
const property::AttributeCreationList acpl = property::AttributeCreationList() 
) const

Create a multidimensional attribute of given name and shape. The datatype is derived from the template parameter.

Exceptions
std::runtime_errorin case of a failure
Template Parameters
Telement data type
Parameters
namethe name for the attribute
shapethe number of elements along each dimension
acplattribute creation property list
Returns
instance of the newly created attribute

◆ create() [3/3]

template<typename T >
Attribute hdf5::attribute::AttributeManager::create ( const std::string &  name,
const property::AttributeCreationList acpl = property::AttributeCreationList() 
) const

Create a scalar attribute of given name. The datatype is determined from the templat parameter.

Exceptions
std::runtime_errorin case of an error
Template Parameters
Telement data type of the attribute
Parameters
namethe name of the attribute
acplattribute creation property list
Returns
instance of the newly created attribute

◆ create_from()

template<typename T >
Attribute hdf5::attribute::AttributeManager::create_from ( const std::string &  name,
const T &  value 
)

This is a convenience method to create a new attribute with a given value. Technically this is a create() including a subsequent call to write.

Node n = ....;
n.attributes.create_from("date","12-03-2017");
Exceptions
std::runtime_errorin case of a failure
Parameters
namethe name of the attribute
valuereference to the new value
Returns
new instance of Attribute

◆ end()

AttributeIterator hdf5::attribute::AttributeManager::end ( ) const

◆ exists()

bool hdf5::attribute::AttributeManager::exists ( const std::string &  name) const

Returns true if an attribute of given name exists. Otherwise false is returned.

◆ iterator_config() [1/2]

const IteratorConfig& hdf5::attribute::AttributeManager::iterator_config ( ) const
noexcept

◆ iterator_config() [2/2]

IteratorConfig& hdf5::attribute::AttributeManager::iterator_config ( )
noexcept

Use this method to get a reference to the iterator configuration for the attributes of a node.

Returns
reference to iterator configuration

◆ node()

const node::Node& hdf5::attribute::AttributeManager::node ( ) const
noexcept

Return a reference to the parent node of the manager instance.

◆ operator[]() [1/2]

Attribute hdf5::attribute::AttributeManager::operator[] ( const std::string &  name) const

◆ operator[]() [2/2]

Attribute hdf5::attribute::AttributeManager::operator[] ( size_t  index) const

◆ remove() [1/2]

void hdf5::attribute::AttributeManager::remove ( const std::string &  name) const

◆ remove() [2/2]

void hdf5::attribute::AttributeManager::remove ( size_t  index) const
Exceptions
std::runtime_errorin case of a failure
Precondition
index must be < size()

◆ rename()

void hdf5::attribute::AttributeManager::rename ( const std::string &  old_name,
const std::string &  new_name 
) const
Exceptions
std::runtime_errorin case of a failure
Parameters
old_nameold name of the attribute
new_namenew name of the attribute

◆ size()

size_t hdf5::attribute::AttributeManager::size ( ) const

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