libpniio
Public Types | Public Member Functions | Private Types | Private Attributes
pni::io::nx::nxattribute_manager< OTYPE > Class Template Reference

attribute manager template More...

#include <nxattribute_manager.hpp>

Public Types

typedef nxattribute_manager
< OTYPE > 
manager_type
 self-reference to this manager type More...
 
typedef OTYPE::attribute_type attribute_type
 the attribute type More...
 
typedef attribute_type value_type
 alias to the attribute type More...
 
typedef
pni::core::container_iterator
< const manager_type
iterator
 iterator type More...
 
typedef OTYPE::imp_type imp_type
 implementation type for the parent object of the manager More...
 

Public Member Functions

 nxattribute_manager (imp_type &imp)
 constructor More...
 
template<typename T , typename CTYPE >
attribute_type create (const pni::core::string &n, const CTYPE &s, bool ov=false) const
 create an array attribute More...
 
template<typename T >
attribute_type create (const pni::core::string &n, bool ov=false) const
 create scalar attribute More...
 
attribute_type operator[] (const pni::core::string &n) const
 open an existing attribute by name More...
 
attribute_type operator[] (size_t i) const
 open an attribute by index More...
 
void remove (const pni::core::string &n) const
 delete an attribute More...
 
bool exists (const pni::core::string &n) const
 checks for attribute existance More...
 
size_t size () const
 get number of attributes More...
 
iterator begin () const
 iterator to frist attribute More...
 
iterator end () const
 iterator to last attribute More...
 

Private Types

typedef OTYPE::type_type type_imp
 implementation of the type traits More...
 

Private Attributes

imp_type_imp
 reference to the implementation of the parent More...
 

Detailed Description

template<typename OTYPE>
class pni::io::nx::nxattribute_manager< OTYPE >

Provides attribute functionality to other objects that are capable of holding attributes.

Template Parameters
OTYPEparent object type

Member Typedef Documentation

template<typename OTYPE>
typedef OTYPE::attribute_type pni::io::nx::nxattribute_manager< OTYPE >::attribute_type
template<typename OTYPE>
typedef OTYPE::imp_type pni::io::nx::nxattribute_manager< OTYPE >::imp_type
template<typename OTYPE>
typedef pni::core::container_iterator<const manager_type> pni::io::nx::nxattribute_manager< OTYPE >::iterator
template<typename OTYPE>
typedef nxattribute_manager<OTYPE> pni::io::nx::nxattribute_manager< OTYPE >::manager_type
template<typename OTYPE>
typedef OTYPE::type_type pni::io::nx::nxattribute_manager< OTYPE >::type_imp
private
template<typename OTYPE>
typedef attribute_type pni::io::nx::nxattribute_manager< OTYPE >::value_type

Constructor & Destructor Documentation

template<typename OTYPE>
pni::io::nx::nxattribute_manager< OTYPE >::nxattribute_manager ( imp_type imp)
inline
Parameters
impreference to the parent implementation

Member Function Documentation

template<typename OTYPE>
iterator pni::io::nx::nxattribute_manager< OTYPE >::begin ( ) const
inline

Return an iterator to the first attribute attached to the object.

Returns
iterator to first attribute
template<typename OTYPE>
template<typename T , typename CTYPE >
attribute_type pni::io::nx::nxattribute_manager< OTYPE >::create ( const pni::core::string &  n,
const CTYPE &  s,
bool  ov = false 
) const
inline

Template method creating a multidimensional attribute of type T and shape s. By default an exception will be thrown if an attribute of same name already exists. If ov=true an existing attribute will be overwritten

Exceptions
invalid_object_errorin case of an invalid parent
type_errorif data type is not supported
object_errorin case of errors
Parameters
nname of the attribute
sshape of the array
ovoverwrite flag
Returns
instance of nxattribute
template<typename OTYPE>
template<typename T >
attribute_type pni::io::nx::nxattribute_manager< OTYPE >::create ( const pni::core::string &  n,
bool  ov = false 
) const
inline

Template method creating a scalar atribute of type T. By default an exception is raised if an attribute of same name already exists. If ov=true the existing attribute will be overwritten and no exeption will be thrown.

Exceptions
invalid_object_errorin case of an invalid parent
type_errorif data type is not supported
object_errorin case of attribute related errors
Parameters
nname of the attribute
ovoverwrite flag
Returns
an instance of nxattribute
template<typename OTYPE>
iterator pni::io::nx::nxattribute_manager< OTYPE >::end ( ) const
inline

Return an iterator to the last attribute attached to the object.

Returns
iterator to last attribute
template<typename OTYPE>
bool pni::io::nx::nxattribute_manager< OTYPE >::exists ( const pni::core::string &  n) const
inline

Checks whether or not an attribute with a particular name exits. If it does true is returned otherwise false.

Exceptions
invalid_object_errorif parent is not valid
object_errorin case of any other error
Parameters
nname of the attribute
Returns
true if n exists otherwise false
template<typename OTYPE>
attribute_type pni::io::nx::nxattribute_manager< OTYPE >::operator[] ( const pni::core::string &  n) const
inline

Opens an existing attribute of name n and returns an instance of nxattribute<> to the callee. An exception will be thrown if the attribute does not exist.

Exceptions
invalid_object_errorif the parent is not valid
key_errorin case the requested attribute does not exist
object_errorin case of problems
Parameters
nname of the attribute
Returns
instance of nxattribute
template<typename OTYPE>
attribute_type pni::io::nx::nxattribute_manager< OTYPE >::operator[] ( size_t  i) const
inline

Opens an existing attribute by its index. If the index exceeds the total number of attributes attached to this object an exception will be thrown.

Exceptions
invalid_object_errorif the parent is not valid
index_errorif i exceeds the total number of attributes
object_errorin case of errors
Parameters
iindex of the attribute
Returns
instance of nxattribute
template<typename OTYPE>
void pni::io::nx::nxattribute_manager< OTYPE >::remove ( const pni::core::string &  n) const
inline

Deletes an attribute attached to this object.

Exceptions
invalid_object_errorif parent is not valid
key_errorif attribute does not exist
object_errorin case of any errors
Parameters
nname of the attribute
template<typename OTYPE>
size_t pni::io::nx::nxattribute_manager< OTYPE >::size ( ) const
inline

Returns the number of attributes attached to this object.

Exceptions
invalid_object_errorif parent is not valid
object_errorin case of any other error
Returns
number of attributes

Field Documentation

template<typename OTYPE>
imp_type& pni::io::nx::nxattribute_manager< OTYPE >::_imp
private

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