libpniio
|
attribute object More...
#include <nxattribute.hpp>
Public Types | |
typedef nximp_map< IMPID > ::attribute_imp | implementation_type |
implementation type of the attribute More... | |
typedef nximp_map< IMPID > ::type_imp | type_type |
implementation of the type trait More... | |
typedef nxattribute< IMPID > | attribute_type |
define the actual type of this object More... | |
Public Member Functions | |
nxattribute () noexcept | |
default constructor More... | |
nxattribute (implementation_type &&i) | |
move constructor from implementation More... | |
nxattribute (const typename nxobject_trait< IMPID >::object_type &o) | |
conversion constructor More... | |
attribute_type & | operator= (const typename nxobject_trait< IMPID >::object_type &o) |
conversion assignment More... | |
template<typename STORAGE , typename IMAP , typename IPA > | |
void | write (const pni::core::mdarray< STORAGE, IMAP, IPA > &o) const |
write data from an mdarray instance More... | |
template<typename ATYPE > | |
void | write (const pni::core::array_view< ATYPE > &v) const |
write view data to an attribute More... | |
template<typename T > | |
void | write (size_t n, const T *data) const |
write data from a plain C pointer More... | |
template<typename T > | |
void | write (const std::vector< T > &data) const |
write data from a vector More... | |
template<typename T > | |
void | write (const T &value) const |
write a single scalar value More... | |
void | write (const char *value) const |
write a C-string More... | |
void | write (const pni::core::array &a) const |
write array type erasure data More... | |
template<typename STORAGE , typename IMAP , typename IPA > | |
void | read (pni::core::mdarray< STORAGE, IMAP, IPA > &o) const |
read data to an array More... | |
template<typename ATYPE > | |
void | read (pni::core::array_view< ATYPE > &v) const |
template<typename ATYPE > | |
void | read (pni::core::array_view< ATYPE > &&v) const |
void | read (pni::core::array &a) const |
read data to array More... | |
template<typename T > | |
void | read (T &value) const |
read a single scalar value More... | |
template<typename T > | |
void | read (size_t n, T *value) const |
read data to pointer More... | |
template<typename T > | |
void | read (std::vector< T > &data) const |
read data to an STL vector More... | |
template<typename CTYPE > | |
CTYPE | shape () const |
obtain attribute shape More... | |
size_t | rank () const |
return attribute rank More... | |
size_t | size () const |
obtain attribute size More... | |
pni::core::type_id_t | type_id () const |
obtain type id More... | |
void | close () |
close attribute More... | |
bool | is_valid () const |
check validity of the attribute More... | |
pni::core::string | name () const |
get attribute name More... | |
pni::core::string | filename () const |
return filename More... | |
template<typename... ITYPES> | |
attribute_type | operator() (ITYPES...indices) const |
apply selection to an attribute More... | |
attribute_type | operator() (const std::vector< pni::core::slice > &indices) const |
nxobject_trait< IMPID > ::object_type | parent () const |
return parent object More... | |
Private Member Functions | |
template<typename ATYPE > | |
void | _write_array (const ATYPE &a) const |
write data from array More... | |
template<typename ATYPE > | |
void | _read_array (ATYPE &a) const |
read data to array More... | |
Private Attributes | |
implementation_type | _imp |
implementation of the attribute object More... | |
nxattribute represents an attribute which is attached to one of the Nexus objects. Objects of this type can be used to read and write attribute data from and to an object.
typedef nxattribute<IMPID> pni::io::nx::nxattribute< IMPID >::attribute_type |
typedef nximp_map<IMPID>::attribute_imp pni::io::nx::nxattribute< IMPID >::implementation_type |
typedef nximp_map<IMPID>::type_imp pni::io::nx::nxattribute< IMPID >::type_type |
|
inlineexplicitnoexcept |
|
inlineexplicit |
invalid_object_error | if the implementation is not valid |
type_error | if the implementation type is not an attribute |
object_error | in case of any other error |
i | rvalue to an implementation instance |
|
inline |
Constructs an attribute object form an instance of object_type.
type_error | if the object is not an attribute |
object_error | in case of any other error |
o | instance of object_type |
|
inlineprivate |
Read attribute data from the file and store it to the array.
memory_not_allocated_error | if the arrays buffer is not allocated |
shape_mismatch_error | if the shapes of the array and the attribute do not match |
io_error | in case of a general IO error |
type_error | if the datatype is unkonwn |
invalid_object_error | in case the attribute is not valid |
object_error | in case of any other error |
ATYPE | array type |
a | instance of ATYPE |
|
inlineprivate |
Read data from an array type and store it in the attribute.
memory_not_allocated_error | if the array buffer is not allocated |
shape_mismatch_error | if the shapes of the array and the attribute do not match |
io_error | in case of IO errors |
invalid_object_error | if attribute is not valid |
type_error | if the data type is unknown |
object_error | in case of any other error |
ATYPE | array type |
a | instance of ATYPE |
|
inline |
type_error | if object type cannot be determined |
object_error | in case of any other error |
|
inline |
Returns the name of the file the attribute belongs too.
invalid_object_error | if the field is not valid |
io_error | if the filename information retrieval fails |
type_error | if the internal object type does not support filename retrieval |
object_error | in case of any other error |
|
inline |
object_error | if the validity check fails |
|
inline |
Obtain the name of the attribute. With this name it can be identified at a particular object.
invalid_object_error | if object is not valid |
io_error | in case of an IO error |
object_error | in case of any other error |
type_error | if object type cannot be determined |
|
inline |
|
inline |
|
inline |
This assignment operator converts an object_type to an attribute.
type_error | if the object is not an attribute |
object_error | in case of any other error |
o | instance of object_type |
|
inline |
This method returns the parent object of a
invalid_object_error | if attribute is not valid |
type_error | if parent type is unkown |
object_error | in case of any other error |
|
inline |
This method returns the rank of the attribute - the number of dimensions.
invalid_object_error | if the attribute is not valid |
object_error | in case of any other error |
|
inline |
Read data to an DArray instance.
memory_not_allocated_error | if array buffer is not allocated |
size_mismatch_error | if array and attribute shape do not match |
invalid_object_error | if field is not valid |
type_error | if data type is not supported |
io_error | in case of a general IO error |
object_error | in case of any other error |
STORAGE | storage type for mdarray |
IMAP | index map type for mdarray |
IPA | in-place arithmetics type for mdarray |
o | instance of DArray |
|
inline |
|
inline |
|
inline |
memory_not_allocated_error | if array not allocated |
type_error | if data type is not supported |
size_mismatch_error | if array shape does not match |
invalid_object_error | if field is not valid |
io_error | in case of a general IO error |
object_error | in case of any other error |
a | instance of array |
|
inline |
Read a single scalar value.
size_mismatch_error | if the attribute is not scalar |
invalid_object_error | if the attribute is not valid |
io_error | in case of a general IO error |
type_error | if data type is not supported |
object_error | in case of any other error |
T | type to read to |
value | reference to an instance of T |
|
inline |
Read data to a memory location referenced by the pointer value. This method is for compatability with old C-code. It is assumed that enough memory is allocated.
size_mismatch_error | if n and attribute size do not match |
type_error | if T is not supported |
invalid_object_error | if attribute is not valid |
io_error | in case of a general IO error |
object_error | in case of any other error |
T | data type to read to |
n | the size of the memory referred to by the pointer |
value | pointer to memory |
|
inline |
Read data from an attribute to an STL vector.
size_mismatch_error | if n and attribute size do not match |
type_error | if T is not supported |
invalid_object_error | if attribute is not valid |
io_error | in case of a general IO error |
object_error | in case of any other error |
T | data type to read to |
data | reference to the vector |
|
inline |
invalid_object_error | if attribute not valid |
object_error | in case of any other error |
CTYPE | user requested container type |
|
inline |
Return the number of elements stored in the attribute.
invalid_object_error | if the attribute is not valid |
object_error | in case of any other error |
|
inline |
Returns the type ID of the data stored in the attribute.
invalid_object_error | if attribute is not valid |
object_error | in case of any other error |
type_error | if data type is not supported |
|
inline |
Write data from an mdarray instance to the attribute object
memory_not_allocated_error | if array buffer is not allocated |
size_mismatch_errror | if array and attribute shape do not match |
io_error | in case of IO errors |
invalid_object_error | if the object is not valid |
type_error | if the datatype stored in the array is not supported |
object_error | in case of any other error |
STORAGE | storage type of the mdarray |
IMAP | index map type of the mdarray |
IPA | inplace arithmetic type of the mdarray |
o | instance of DArray from which to write data |
|
inline |
Write the data reference by an array view to the attribute.
memory_not_allocated_error | if array buffer is not allocated |
size_mismatch_errror | if array and attribute shape do not match |
io_error | in case of IO errors |
invalid_object_error | if the object is not valid |
type_error | if the datatype stored in the array is not supported |
object_error | in case of any other error |
ATYPE | array type of the view |
v | refernence to an array_view instance |
|
inline |
This method is for interoperability with old C-code. It writes data referenced by a plain pointer. It is assumed that the user has allocated enough memory.
size_mismatch_error | if memory and attribute size do not match |
io_error | in case of a general IO error |
type_error | if data type not supported by the library |
invalid_object_error | if attribute not valid |
object_error | in case of any other error |
T | data type of the pointer |
n | the number of elements to read to memory |
data | pointer to the data |
|
inline |
Write data stored in an STL vector to an attribute.
size_mismatch_error | if memory and attribute size do not match |
io_error | in case of a general IO error |
type_error | if data type not supported by the library |
invalid_object_error | if attribute not valid |
object_error | in case of any other error |
T | value type of the vector |
data | reference to the vector |
|
inline |
Write a single scalar value. This throws an exception if the field is not scalar (size=1).
size_mismatch_error | if field is not scalar |
io_error | in case of a general IO error |
invalid_object_error | in case of an invalid field object |
type_error | in case the datatype is not supported |
object_error | in case of any other error |
T | data type of the scalar to write |
value | reference to the value to write |
|
inline |
This is a special implementation of write for classical C-strings.
size_mismatch_error | if field is not scalar |
invalid_object_error | if field is not valid |
io_error | in case of a general IO error |
object_error | in case of any other error |
type_error | if the datatype is not supported |
value | pointer to a C-string |
|
inline |
memory_not_allocated_error | if array buffer is not allocated |
size_mismatch_errror | if array and attribute shape do not match |
type_error | if data type not supported |
invalid_object_error | if field is not valid |
io_error | in case of a general IO error |
object_error | in case of any other error |
a | instance of array |
|
private |