libpniio
Modules | Functions
Nexus Algorithms
Collaboration diagram for Nexus Algorithms:

Modules

 Internal classes used by algorithms
 

Functions

template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
ATYPE pni::io::nx::as_attribute (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o)
 as attribute wrapper More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
FTYPE pni::io::nx::as_field (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o)
 as field wrapper More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
GTYPE pni::io::nx::as_group (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o)
 as group wrapper More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
LTYPE pni::io::nx::as_link (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o)
 as link wrapper More...
 
template<nximp_code IMPID>
void pni::io::nx::close (nxlink< IMPID > &)
 close object More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
void pni::io::nx::close (nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o)
 close object More...
 
template<typename T , typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE , typename STYPE >
nxobject< GTYPE, FTYPE, ATYPE,
LTYPE > 
pni::io::nx::create_attribute (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &parent, const pni::core::string &name, const STYPE &shape, bool overwrite=false)
 create multidimensional attribute More...
 
template<typename T , typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
nxobject< GTYPE, FTYPE, ATYPE,
LTYPE > 
pni::io::nx::create_attribute (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &parent, const pni::core::string &name, bool overwrite=false)
 create scalar attribute More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE , typename... ARGTS>
nxobject< GTYPE, FTYPE, ATYPE,
LTYPE > 
pni::io::nx::create_attribute (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o, pni::core::type_id_t tid, ARGTS...args)
 create attribute More...
 
template<typename T , typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE , typename STYPE , typename FILTERT , typename PATHT >
nxobject< GTYPE, FTYPE, ATYPE,
LTYPE > 
pni::io::nx::create_field (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &location, const PATHT &path, const STYPE &shape, const STYPE &chunk, const FILTERT &filter)
 field construction More...
 
template<typename T , typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE , typename STYPE , typename PATHT >
nxobject< GTYPE, FTYPE, ATYPE,
LTYPE > 
pni::io::nx::create_field (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &parent, const PATHT &path, const STYPE &shape, const STYPE &chunk)
 field construction template More...
 
template<typename T , typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE , typename STYPE , typename PATHT , typename FILTERIMP >
nxobject< GTYPE, FTYPE, ATYPE,
LTYPE > 
pni::io::nx::create_field (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &parent, const PATHT &path, const STYPE &shape, const nxfilter< FILTERIMP > &filter)
 field construction template More...
 
template<typename T , typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE , typename PATHT , typename STYPE = pni::core::shape_t>
nxobject< GTYPE, FTYPE, ATYPE,
LTYPE > 
pni::io::nx::create_field (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &parent, const PATHT &path, const STYPE &shape={1})
 field construction template More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE , typename... ARGTS>
nxobject< GTYPE, FTYPE, ATYPE,
LTYPE > 
pni::io::nx::create_field (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o, pni::core::type_id_t tid, ARGTS...args)
 field construction template More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE , typename PATHT >
nxobject< GTYPE, FTYPE, ATYPE,
LTYPE > 
pni::io::nx::create_group (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o, const PATHT &path)
 create_group wrapper More...
 
template<template< nximp_code > class PTYPE, nximp_code IMPID>
nxobject_trait< IMPID >
::object_type 
pni::io::nx::get_attribute (const PTYPE< IMPID > &parent, const pni::core::string &name)
 get attribute by name More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
nxobject< GTYPE, FTYPE, ATYPE,
LTYPE > 
pni::io::nx::get_attribute (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &parent, const pni::core::string &name)
 get attribute More...
 
template<typename CTYPE , template< nximp_code > class PTYPE, nximp_code IMPID>
CTYPE pni::io::nx::get_attributes (const PTYPE< IMPID > &parent)
 get attributes from an object More...
 
template<typename CTYPE , typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
CTYPE pni::io::nx::get_attributes (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &parent)
 get attributes More...
 
template<typename OTYPE >
auto pni::io::nx::get_child (const OTYPE &o, const pni::core::string &n, const pni::core::string &c="") -> decltype(get_parent(o))
 get child by name and/or class More...
 
template<template< nximp_code > class OTYPE, nximp_code IMPID>
auto pni::io::nx::get_child (const OTYPE< IMPID > &parent, size_t index) -> decltype(get_parent(parent))
 get child by index More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
auto pni::io::nx::get_child (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &parent, size_t index) -> decltype(get_parent(parent))
 get child by index More...
 
template<typename CTYPE , typename OTYPE >
CTYPE pni::io::nx::get_children (const OTYPE &parent, const string &c)
 get children with a common class More...
 
template<template< nximp_code > class OTYPE, nximp_code IMPID>
pni::core::string pni::io::nx::get_class (const OTYPE< IMPID > &group)
 get the class of a group More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
pni::core::string pni::io::nx::get_class (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o)
 get group class More...
 
template<template< nximp_code > class OTYPE, nximp_code IMPID>
pni::core::string pni::io::nx::get_filename (const OTYPE< IMPID > &o)
 get filename More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
pni::core::string pni::io::nx::get_filename (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o)
 get filename More...
 
template<template< nximp_code > class OTYPE, nximp_code IMPID>
pni::core::string pni::io::nx::get_name (const OTYPE< IMPID > &o)
 get object name More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
pni::core::string pni::io::nx::get_name (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o)
 get name More...
 
template<typename OTYPE , typename PATHT >
auto pni::io::nx::get_object (const OTYPE &o, const PATHT &path) -> decltype(get_parent(o))
 retrieve an object from path More...
 
template<template< nximp_code > class OTYPE, nximp_code IMPID>
nxobject_trait< IMPID >
::object_type 
pni::io::nx::get_parent (const OTYPE< IMPID > &o)
 return parent More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
nxobject< GTYPE, FTYPE, ATYPE,
LTYPE > 
pni::io::nx::get_parent (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o)
 get parent More...
 
template<template< nximp_code > class OTYPE, nximp_code IMPID>
pni::core::string pni::io::nx::get_path (const OTYPE< IMPID > &o)
 get object path More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
pni::core::string pni::io::nx::get_path (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o)
 get path More...
 
template<template< nximp_code > class OTYPE, nximp_code IMPID>
size_t pni::io::nx::get_rank (const OTYPE< IMPID > &o)
 get rank More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
size_t pni::io::nx::get_rank (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o)
 get rank More...
 
template<typename OTYPE >
auto pni::io::nx::get_root (const OTYPE &p) -> decltype(get_parent(p))
 get root More...
 
template<typename CTYPE , template< nximp_code > class OTYPE, nximp_code IMPID>
CTYPE pni::io::nx::get_shape (const OTYPE< IMPID > &object)
 get shape More...
 
template<typename CTYPE , typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
CTYPE pni::io::nx::get_shape (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o)
 get shape More...
 
template<template< nximp_code > class OTYPE, nximp_code IMPID>
size_t pni::io::nx::get_size (const OTYPE< IMPID > &o)
 get number of elements More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
size_t pni::io::nx::get_size (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o)
 get size More...
 
template<template< nximp_code > class OTYPE, nximp_code IMPID>
pni::core::type_id_t pni::io::nx::get_type (const OTYPE< IMPID > &o)
 get type More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
pni::core::type_id_t pni::io::nx::get_type (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o)
 get type More...
 
template<typename FTYPE >
pni::core::string pni::io::nx::get_unit (const FTYPE &field)
 get the unit of a field More...
 
template<template< nximp_code > class OTYPE, nximp_code IMPID>
void pni::io::nx::grow (OTYPE< IMPID > &o, size_t dimension=0, size_t extend=1)
 grow a field More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
void pni::io::nx::grow (nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o, size_t d=0, size_t e=1)
 grow object More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
bool pni::io::nx::is_attribute (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o) noexcept
 check if attribute More...
 
template<template< nximp_code > class OTYPE, nximp_code IMPID>
bool pni::io::nx::is_class (const OTYPE< IMPID > &object, const pni::core::string &type)
 checks group type More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
bool pni::io::nx::is_class (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o, const pni::core::string &c)
 is class function More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
bool pni::io::nx::is_field (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o) noexcept
 check if field More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
bool pni::io::nx::is_group (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o) noexcept
 test for group More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
bool pni::io::nx::is_link (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o) noexcept
 test for group More...
 
template<typename OTYPE >
bool pni::io::nx::is_valid (const OTYPE &o) noexcept
 visitor checking object validity More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
bool pni::io::nx::is_valid (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o) noexcept
 is_valid wrapper More...
 
template<template< nximp_code > class OTYPE, nximp_code IMPID>
auto pni::io::nx::begin (const OTYPE< IMPID > &group) -> decltype(group.begin())
 get iterator to first element More...
 
template<template< nximp_code > class OTYPE, nximp_code IMPID>
auto pni::io::nx::end (const OTYPE< IMPID > &group) -> decltype(group.end())
 get iterator to last element More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
GTYPE::iterator pni::io::nx::begin (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o)
 get iterator to first child More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
GTYPE::iterator pni::io::nx::end (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o)
 get iterator to last+1 child More...
 
template<typename OTYPE >
OTYPE pni::io::nx::get_object_by_name (const OTYPE &parent, const pni::core::string &name)
 search for object by name More...
 
template<typename OTYPE >
OTYPE pni::io::nx::get_object_by_name_and_class (const OTYPE &parent, const pni::core::string &name, const pni::core::string &c)
 search for object by name and class More...
 
template<typename OTYPE >
OTYPE pni::io::nx::get_object_by_class (const OTYPE &parent, pni::core::string c)
 find object by class More...
 
template<template< nximp_code > class OTYPE, nximp_code IMPID, typename ATYPE >
void pni::io::nx::read (const OTYPE< IMPID > &o, ATYPE &a)
 read data More...
 
template<template< nximp_code > class OTYPE, nximp_code IMPID, typename ATYPE , typename... ITYPES>
void pni::io::nx::read (const OTYPE< IMPID > &o, ATYPE &a, ITYPES...indices)
 read data More...
 
template<typename ATYPE , typename GTYPE , typename FTYPE , typename ATTYPE , typename LTYPE , typename... ITYPES>
void pni::io::nx::read (const nxobject< GTYPE, FTYPE, ATTYPE, LTYPE > &o, ATYPE &a, ITYPES...indices)
 read data from a field or attribute More...
 
template<typename ATYPE , typename GTYPE , typename FTYPE , typename ATTYPE , typename LTYPE >
void pni::io::nx::read (const nxobject< GTYPE, FTYPE, ATTYPE, LTYPE > &o, ATYPE &a, const std::vector< pni::core::slice > &sel)
 read data from a field or attribute More...
 
template<template< nximp_code > class OTYPE, nximp_code IMPID>
void pni::io::nx::set_class (const OTYPE< IMPID > &o, const pni::core::string &nxclass)
 set class for a group More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
void pni::io::nx::set_class (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o, const pni::core::string &c)
 set class More...
 
template<typename FTYPE >
void pni::io::nx::set_unit (const FTYPE &field, const pni::core::string &value)
 set the unit More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
void pni::io::nx::set_unit (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o, const pni::core::string &s)
 set unit More...
 
template<template< nximp_code > class OTYPE, nximp_code IMPID, typename ATYPE >
void pni::io::nx::write (const OTYPE< IMPID > &o, const ATYPE &a)
 write data to an attribute or field More...
 
template<template< nximp_code > class OTYPE, nximp_code IMPID, typename ATYPE , typename... ITYPES>
void pni::io::nx::write (const OTYPE< IMPID > &o, const ATYPE &a, ITYPES...indices)
 write data to an attribute or field More...
 
template<typename ATYPE , typename GTYPE , typename FTYPE , typename AATYPE , typename LTYPE , typename... ITYPES>
void pni::io::nx::write (nxobject< GTYPE, FTYPE, AATYPE, LTYPE > &&o, const ATYPE &a, ITYPES...indices)
 write wrapper More...
 

Detailed Description

Nexus files can be considered as a heterogeneous container (a container holding instances of different types). This section describes algorithms that work on particular Nexus objects.

There are basically three kinds of algorithms

General purpose algorithms are

function name purpose principal input return type
as_attribute convert nxobject to nxattribute nxobject nxattribute
as_field convert nxobject to nxfield nxobject nxfield
as_group convert nxobject to nxgroup nxobject nxgruop
is_attribute true if object is an nxattribute nxobject bool
is_field true if object is an nxfield nxobject bool
is_group true if object is an nxgroup nxobject bool
is_valid true if object is valid all bool
get_name return the name of an object all string
colse close an object all void
create_attribute create an attribute nxobject, nxfield, nxgroupnxobject
get_attribute return an attribute nxobject, nxfield, nxgruopnxobject
get_attributes return attribute container nxfield,nxgroup,nxobject container<nxobject>
get_parent get parent object all nxobject
get_path get path all nxpath
get_root return root group all nxobject

Group related algorithms are

function name purpose principal input return type
get_child_by_index return child by numeric index nxgroup, nxobject nxobject
get_child return child by namenxgroup, nxobject nxobject
get_children returns list of children nxgroup, nxobject container
get_object get object by path nxgroup, nxobject nxobject
create_field create a field nxgroup, nxobject nxobject
create_group create a group nxgroup, nxobject nxobject
get_class return a groups class nxgroup, nxobject string
is_class check if object is of a particular class nxgroup,nxobject bool
set_class set the class of an object nxgruop, nxobject void

IO (nxattribute, nxfield) related algorithms

function name purpose principal input return type
get_shape return object shape nxfield, nxattribute, nxobject container
get_size return size of element nxfield, nxattribute, nxobject size_t
get_type get type ID of the object nxfield, nxattribute, nxobject type_id_t
get_unit return unit of data field nxfield, nxobject string
set_unit set unit for a field nxfield, nxobject void
get_rank return number of dimensions nxfield, nxattribute, nxobject size_t
grow grow a field nxfield, nxobject void
read read data from object nxfield, nxattribute, nxobject void
write write data to object nxfield, nxattribute, nxobject void

Function Documentation

template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
ATYPE pni::io::nx::as_attribute ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)

Function template extracting an attribute stored in an nxobject instance. If the object is not an attribute an nxattribute_error exception will be thrown. The object is returned as an nxattribute instance.

auto attr_obj = get_object(root,path_to_atribute);
auto a = as_attribute(attr_obj);
Exceptions
type_errorif stored object is not a attribute type
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
Parameters
oinstance of nxobject
Returns
instance of ATYPE
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
FTYPE pni::io::nx::as_field ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)

function template extracting a field stored in an nxobject instance. If the stored object is not an instance of nxfield an exception of type nxfield_error will be thrown.

auto object = get_object(root,path_to_field);
auto field = as_field(field_obj);
Exceptions
type_errorif stored object is not a field type
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
Parameters
oinstance of nxobject
Returns
instance of FTYPE
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
GTYPE pni::io::nx::as_group ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)

Function template returning a group object stored in an nxobject instance. If the stored object is not an instance of nxgroup an exception will be thrown.

auto object = get_object(root,path_to_group);
auto group = as_group(group_obj);
Exceptions
type_errorif stored object is not a group type
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
Parameters
oinstance of nxobject<GTYPE,FTYPE,ATYPE>
Returns
instance of GTYPE
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
LTYPE pni::io::nx::as_link ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)

Function template extracting a link stored in an nxobject instance. If the object is not a link a type_error exception will be thrown. The object is returned as an nxlink instance.

auto link_obj = get_object(root,path_to_link);
auto l = as_link(link_obj);
Exceptions
type_errorif stored object is not a attribute type
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
oinstance of nxobject
Returns
instance of ATYPE
template<template< nximp_code > class OTYPE, nximp_code IMPID>
auto pni::io::nx::begin ( const OTYPE< IMPID > &  group) -> decltype(group.begin())

Returns an iterator to the first child element of a group object.

Parameters
groupreference to a group instance
Returns
iterator to first child
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
GTYPE::iterator pni::io::nx::begin ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)

Returns an iterator to the first child attached to a group stored in an nxobject instance. If the nxobject instance does not hold a group type_error is thrown.

Exceptions
type_errorif the stored object is not a group
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
ogroup object
Returns
iterator to the first child
template<nximp_code IMPID>
void pni::io::nx::close ( nxlink< IMPID > &  )

Invokes the close() method of the passed object. The objects accepted by this function template are either of type nxfield, nxattribute, nxgroup, or nxfile.

Exceptions
object_errorin case of errors
type_errorif internal object type is not supported
Template Parameters
OTYPEobject type
Parameters
oinstance of the object to close
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
void pni::io::nx::close ( nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)

Wrapper function around the close_visitor. The function closes the object stored in the variant type passed to it.

Exceptions
object_errorin case of an error during closing the object
type_errorif the internal object type could not be determined
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
oinstance of nxobject<GTYPE,FTYPE,ATYPE,LTYPE>
template<typename T , typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE , typename STYPE >
nxobject<GTYPE,FTYPE,ATYPE,LTYPE> pni::io::nx::create_attribute ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  parent,
const pni::core::string &  name,
const STYPE &  shape,
bool  overwrite = false 
)

Create an attribute of a particular name, type, and shape at a parent object. The parent is provided as an instance of nxobject.

auto g = get_object(...);
auto attr = create_attribute<int32>(g,"test",shape_t{4,4});

The last argument is the shape of the attribute. If now shape is passed a scalar attribute will be created.

Exceptions
invalid_object_errorif the parent object is not valid
type_errorif the data type is not supported or the parent holds an nxattribute instance
object_errorin case of any other error
Template Parameters
Tdata type of the attribute
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
STYPEshape container type
Parameters
parentinstance of parent object
namename of the new attribute
shapeshape of the attribute
overwriteif true an existing attribute will be overwritten
Returns
attribute as an instance of nxobject
template<typename T , typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
nxobject<GTYPE,FTYPE,ATYPE,LTYPE> pni::io::nx::create_attribute ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  parent,
const pni::core::string &  name,
bool  overwrite = false 
)

Create an attribute of a particular name, type, and shape at a parent object. The parent is provided as an instance of nxobject.

auto g = get_object(...);
auto attr = create_attribute<int32>(g,"test",shape_t{4,4});

The last argument is the shape of the attribute. If now shape is passed a scalar attribute will be created.

Exceptions
invalid_object_errorif the parent object is not valid
type_errorif the data type is not supported or the parent holds an nxattribute instance
object_errorin case of any other error
Template Parameters
Tdata type of the attribute
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
parentinstance of the parent
namename of the new attribute
overwriteif true overwrite an existing attribute of equal name
Returns
attribute as an instance of nxobject
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE , typename... ARGTS>
nxobject<GTYPE,FTYPE,ATYPE,LTYPE> pni::io::nx::create_attribute ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o,
pni::core::type_id_t  tid,
ARGTS...  args 
)

Create an attribute of a given name, shape, and type at a parent object. This special version of create_attribute is particularly useful in situations where the data type is provided at runtime.

auto parent = get_object(...);
string name = get_name_from_user(...);
type_id_t tid = get_type_from_user(...);
auto attr = create_attribute(parent,tid,name);

The first two arguments are the parent object and the type id. All other arguments are the same as for the other create_attribute templates.

Exceptions
invalid_object_errorif the parent object is not valid
type_errorif the data type is not supported or the parent holds an nxattribute instance
object_errorin case of any other error
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
STYPEshape container type
Parameters
oinstance of VTYPE with the parent group
tidtype id of the attributes data type
argsresidual arguments
Returns
newly created attribute as an instance of nxobject
template<typename T , typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE , typename STYPE , typename FILTERT , typename PATHT >
nxobject<GTYPE,FTYPE,ATYPE,LTYPE> pni::io::nx::create_field ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  location,
const PATHT &  path,
const STYPE &  shape,
const STYPE &  chunk,
const FILTERT &  filter 
)

The full function to construct a field relative to a particular group.

Exceptions
invalid_object_errorif the parent is not valid
type_errorif the data type is not supported
size_mismatch_errorif chunk-shape and shape do not match
object_errorin case of any other error
Template Parameters
Tdata type of the new array
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
STYPEshape type
FILTERTfilter type
PATHTpath type
Parameters
locationthe root location where the field should be created
patha string or nxpath object with the path to the field
shapethe initial shape of the field
chunkthe chunkd shape of the field
filterreference to the filter object
Returns
field type wrapped into an nxobject instance
template<typename T , typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE , typename STYPE , typename PATHT >
nxobject<GTYPE,FTYPE,ATYPE,LTYPE> pni::io::nx::create_field ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  parent,
const PATHT &  path,
const STYPE &  shape,
const STYPE &  chunk 
)

This template does field construction without filters

Exceptions
invalid_object_errorif the parent is not valid
type_errorif the data type is not supported
size_mismatch_errorif chunk-shape and shape do not match
object_errorin case of any other error
Template Parameters
Tdata type of the new field
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
STYPEshape type
PATHTpath type
Parameters
parentthe parent object for the field
pathstring or nxpath with the location of the field
shapethe shape of the field
chunkthe chunk shape for the field
Returns
field type wrapped into an nxobject instance
template<typename T , typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE , typename STYPE , typename PATHT , typename FILTERIMP >
nxobject<GTYPE,FTYPE,ATYPE,LTYPE> pni::io::nx::create_field ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  parent,
const PATHT &  path,
const STYPE &  shape,
const nxfilter< FILTERIMP > &  filter 
)

This template does field construction with filters. Only the primary shape of the field is given by the user. The chunk shape will be created automatically.

Exceptions
invalid_object_errorif the parent is not valid
type_errorif the data type is not supported
size_mismatch_errorif chunk-shape and shape do not match
object_errorin case of any other error
Template Parameters
Tdata type of the new field
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
STYPEshape type
PATHTpath type
FILTERIMPfilter implementation type
Parameters
parentthe parent object for the field
pathstring or nxpath with the location of the field
shapethe shape of the field
filterreference to the filter to use
Returns
field type wrapped into an nxobject instance
template<typename T , typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE , typename PATHT , typename STYPE = pni::core::shape_t>
nxobject<GTYPE,FTYPE,ATYPE,LTYPE> pni::io::nx::create_field ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  parent,
const PATHT &  path,
const STYPE &  shape = {1} 
)
Exceptions
invalid_object_errorif the parent is not valid
type_errorif the data type is not supported
size_mismatch_errorif chunk-shape and shape do not match
object_errorin case of any other error
Template Parameters
Tdata type of the new field
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
PATHTpath type
STYPEshape type
Parameters
parentthe parent location for the new field
pathstring or nxpath with the relative position for the field
shapethe shape of the new field
Returns
field type wrapped into an nxobject instance
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE , typename... ARGTS>
nxobject<GTYPE,FTYPE,ATYPE,LTYPE> pni::io::nx::create_field ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o,
pni::core::type_id_t  tid,
ARGTS...  args 
)

This template function is particulary useful if the data type for the new field is available only at runtime.

Exceptions
invalid_object_errorif the parent is not valid
type_errorif the data type is not supported
size_mismatch_errorif chunk-shape and shape do not match
object_errorin case of any other error
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
ARGTSresidual argument types
Parameters
oparent location for the new field
tidthe type ID for the new field
argsresidual args as for the other function templates
Returns
field type wrapped into an nxobject instance
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE , typename PATHT >
nxobject<GTYPE,FTYPE,ATYPE,LTYPE> pni::io::nx::create_group ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o,
const PATHT &  path 
)

Wrapper function for the create_group_visitor. This wrapper creates a new group of a particular name and class directly below the parent group. In order to successfully create a group at least the name argument must be non-empty. If an empty string is passed as the groups class then the NX_class attribute will not be set. The function does not create intermediate groupw which do not exist. In this case an key_error exception will be thrown.

Exceptions
invalid_object_errorif the parent is not valid
key_errorif an element in the path provided by the user does not exist
type_errorif the parent object is not a group
object_errorin case of any other error
value_errorif the user did not provide a name for the new group
io_errorif metadata retrieval failed
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
PATHTpath type
Parameters
oreference to the parent
paththe path or name of the new group
Returns
object_types with the newly created group
template<template< nximp_code > class OTYPE, nximp_code IMPID>
auto pni::io::nx::end ( const OTYPE< IMPID > &  group) -> decltype(group.end())

Returns an iterator to the last+1 child of a group.

Parameters
groupreference to the group instance
Returns
iterator to last+1 element
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
GTYPE::iterator pni::io::nx::end ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)

Return an interator to the last+1 child attached to a group stored in an instance of nxobject or throw type_error if the nxobject instance does not hold a gruop.

Exceptions
type_errorif the stored object is not a group
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
othe group from which we want the iterator
Returns
iterator to last+1 child
template<template< nximp_code > class PTYPE, nximp_code IMPID>
nxobject_trait<IMPID>::object_type pni::io::nx::get_attribute ( const PTYPE< IMPID > &  parent,
const pni::core::string &  name 
)

Return an attribute from a parent object. This template will work for the following types

  • nxfield
  • nxgroup
Exceptions
invalid_object_errorif parent is not valid
key_errorif the object does not have an attribute with name
object_errorin case of any other erro
Template Parameters
PTYPEparent type template
IMPIDparent type implementation id
Parameters
parentrefernece to parent instance
nameattributes name
Returns
attribute type
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
nxobject<GTYPE,FTYPE,ATYPE,LTYPE> pni::io::nx::get_attribute ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  parent,
const pni::core::string &  name 
)

Returns an attribute from an object stored in an instance of nxobject. The object must be either an nxfield or an nxgroup instance.

Exceptions
invalid_object_errorif the parent is not valid
key_errorif the attribute does not exist
type_errorif the parent is not a field or group
object_errorin case of any other error
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
parentreference to the parent object
namethe attributes name
Returns
attribute as an object_types variant
template<typename CTYPE , template< nximp_code > class PTYPE, nximp_code IMPID>
CTYPE pni::io::nx::get_attributes ( const PTYPE< IMPID > &  parent)

Return a container with all attributes attached to an object. The value type of the container must either be an instance of nxobject or nxattribute (otherwise a compile time assertion will be raised).

This template will retrieve the attributes from the following types

  • nxfield
  • nxgroup
Exceptions
object_errorin case of any other erro
Template Parameters
CTYPEcontainer type where to store the attributes
PTYPEparent type template
IMPIDparent type implementation id
Parameters
parentreference to parent instance
Returns
instance of CTYPE with attributes
template<typename CTYPE , typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
CTYPE pni::io::nx::get_attributes ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  parent)

Return all attributes attached to an object in an instance of a ser defined container type.

Exceptions
invalid_object_errorif the parent is not valid
object_errorin case of any other error
Template Parameters
CTYPEcontainer type
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
parentreference to the parent object
Returns
attribute as an object_types variant
template<typename OTYPE >
auto pni::io::nx::get_child ( const OTYPE &  o,
const pni::core::string &  n,
const pni::core::string &  c = "" 
) -> decltype(get_parent(o))

Returns the child of a group which is determined by its name and/or group.

Exceptions
invalid_object_errorif the parent is not valid
type_errorif the object is not an nxgroup instance or the nxobject instance does not store a group
key_errorif an object which satisifies the requested name and class could not be found
object_errorin case of any other error
Template Parameters
OTYPEgroup or nxobject instance
Parameters
onxgroup or nxobject instance
nname of the child
cclass of the object
Returns
child as instance of nxobject
template<template< nximp_code > class OTYPE, nximp_code IMPID>
auto pni::io::nx::get_child ( const OTYPE< IMPID > &  parent,
size_t  index 
) -> decltype(get_parent(parent))

Get a child by its numerical index. The parent object is an instance of nxgroup.

Exceptions
invalid_object_errorif the parent is not valid
index_errorif index exceeds total number of children
type_errorif the type of a child is not supported
object_errorin case of any other error
Template Parameters
OTYPEobject template
IMPIDimplementation ID
Parameters
parentinstance of the parent object
indexnumerical index of the requested child
Returns
child instance as nxobject
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
auto pni::io::nx::get_child ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  parent,
size_t  index 
) -> decltype(get_parent(parent))

This template function takes an instance of nxobject wrapping a group as a parent. If the wrapped object is not a group a type_error exception is thrown.

Exceptions
invalid_object_errorif the parent is not valid
index_errorif the index exceeds the total number of children
type_errorif the parent is not a group or the child type is not supported
object_errorin case of any other error
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
parentinstance of nxobject with the parent group
indexthe numerical index of the requested child
Returns
child instance as nxobject
template<typename CTYPE , typename OTYPE >
CTYPE pni::io::nx::get_children ( const OTYPE &  parent,
const string &  c 
)

Returns all children of a parent group which share a common class type. The results will be stored in a container type provided by the user as a template paremeter. It is important to note that the only parameter we can search for here is the base class type. As we are searching only within a single parent all names must be distinct. Unlike the get_cild function template this template does not throw if no object matches the class type. Instead, an empty container is returned.

Exceptions
invalid_object_errorif the parent is not valid
type_errorif the object is not an nxgroup instance or the nxobject instance does not store a group
object_errorin case of any other error
Template Parameters
CTYPEcontainer type to hold the results
OTYPEgroup or nxobject instance
Parameters
onxgroup or nxobject instance
cclass of the object
Returns
child as instance of nxobject
template<template< nximp_code > class OTYPE, nximp_code IMPID>
pni::core::string pni::io::nx::get_class ( const OTYPE< IMPID > &  group)

This function template returns the class of a group which is stored in its NX_class attribute.

Exceptions
invalid_object_errorif parent group is not valid
shape_mismatch_errorthe attribute is not a scalar
type_errorthe attribute type is not supported
io_errorattribute data retrieval failed
object_errorin case of any other error
Template Parameters
IMPIDimplementation ID for the group
Parameters
groupthe group for which the class should be obtained
Returns
string with class type
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
pni::core::string pni::io::nx::get_class ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)

Return the class of a group.

Exceptions
type_errorif the passed object is not a group
invalid_object_errorif the passed object is not valid
shape_mismatch_errorif NX_class attribute is not a scalar
io_errorif attribute data could not be retrieved
object_errorin case of any other error
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
ogroup as instance of nxobject
Returns
Nexus class as a tring
template<template< nximp_code > class OTYPE, nximp_code IMPID>
pni::core::string pni::io::nx::get_filename ( const OTYPE< IMPID > &  o)

Return the filename an object belongs to. This template works for instances of

  • nxgroup
  • nxfield
  • nxattribute
  • links
Exceptions
invalid_object_errorin case of an invalid object
io_errorif filename cannot be retrieved
type_errorif the implementation type does not support filename retrieval
object_errorin case of any other error
Template Parameters
OTYPEobject type template
IMPIDimplementation ID
Parameters
oreference to the object
Returns
name of the object
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
pni::core::string pni::io::nx::get_filename ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)

Get the name of the file where a particular object is stored.

Exceptions
invalid_oject_errorif the object is not valid
io_errorif filename retrieval fails
type_errorif the implementation type does not support filename retrieval
object_errorin case of any other error
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
oinstance of nxobject
Returns
name of the object
template<template< nximp_code > class OTYPE, nximp_code IMPID>
pni::core::string pni::io::nx::get_name ( const OTYPE< IMPID > &  o)

Return the name of an object. This template function is called in case that the object is an instance of

  • nxgroup
  • nxfile
  • nxattribute
  • nxlink
Exceptions
io_errorin case of problems
invalid_object_erroin case of an invalid object
type_errorif a type cannot be retrieved for this type
object_errorin case of any other error
Template Parameters
OTYPEobject type template
IMPIDimplementation ID
Parameters
oreference to the object
Returns
name of the object
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
pni::core::string pni::io::nx::get_name ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)

Retriev the name of an object stored in an instance of the nxobject template.

Exceptions
io_errorin case of IO errors
invalid_oject_errorif the object is not valid
type_errorif a type cannot be retrieved for this type
object_errorin case of any other error
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
oinstance of nxobject
Returns
name of the object
template<typename OTYPE , typename PATHT >
auto pni::io::nx::get_object ( const OTYPE &  o,
const PATHT &  path 
) -> decltype(get_parent(o))

Retrieve an object whose position is determined by a nexus path. The path can be either relative or absolute. In the former case the path is relative to the parent object. In the latter on the parent object is only used to retrieve the root group and then continue from there.

Exceptions
invalid_object_errorif the parent is not valid
type_errorif the object is not a group
key_errorif one of the path element does not lead to a child
object_errorin the case of any other error
Template Parameters
OTYPEparent object type
IMPIDimplementation ID of the parent tyep
Parameters
oreference to the parent
pathreference to the path
Returns
the requested object as nxobject instance
template<typename OTYPE >
OTYPE pni::io::nx::get_object_by_class ( const OTYPE &  parent,
pni::core::string  c 
)
template<typename OTYPE >
OTYPE pni::io::nx::get_object_by_name ( const OTYPE &  parent,
const pni::core::string &  name 
)

Search for an object stored below its parent by name. The parent must be an instance of nxgroup or nxobject wrapping a group instance. IF the object could not be found a key_error exception is thrown.

Exceptions
key_errorif no object with the requested name exists
invalid_object_errorif the parent is not a valid object
io_errorin case of errors during object meta data retrieval
object_errorin case of any object construction or destruction problem
Parameters
parentthe parent object
namethe name of the requested object
Returns
the requested object as an instance of nxobject
template<typename OTYPE >
OTYPE pni::io::nx::get_object_by_name_and_class ( const OTYPE &  parent,
const pni::core::string &  name,
const pni::core::string &  c 
)

This function searches for an object by its name and class. Obviously such an object can only be a group as fields do not have a class attribute.

The function first tries to find an object with a matching name. If it finds such an object it checks if it is a group and throws a type_error exception if it is not. In the case of a group the function continues to check if the group type matches.

Exceptions
invalid_object_errorif the parent object is not valid
io_errorin case of errors during retrieving object metadata
type_errorif the object found by name is not a group
key_errorif no object of the requested name and class could be found
object_errorin any case of errors during object creation, destruction, or copying
Template Parameters
OTYPEobject type
Parameters
parentthe parent object
namethe name of the requested group
cthe class of the requested group
Returns
a group object of matching name and class
template<template< nximp_code > class OTYPE, nximp_code IMPID>
nxobject_trait<IMPID>::object_type pni::io::nx::get_parent ( const OTYPE< IMPID > &  o)

Returns the parent object of an instance of nxfield, nxattribute, or nxgroup object. The parent is returned as an instance of nxobject.

Exceptions
invalid_object_errorif the child is not valid
type_errorif there are some issues with the internal type
object_errorin case of errors generating parent object
Template Parameters
OTYPEobject template
IMPIDimplementation ID
Parameters
oobject instance
Returns
parent as nxobject instance
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
nxobject<GTYPE,FTYPE,ATYPE,LTYPE> pni::io::nx::get_parent ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)

Return the parent object of an instance of nxobject as a new instance of nxobject.

Exceptions
invalid_object_errorif the object is not valid
type_errorin case of internal type issues
object_errorin case of errors generating parent object
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
oinstance of nxobject
Returns
parent object as instance of nxobject
template<template< nximp_code > class OTYPE, nximp_code IMPID>
pni::core::string pni::io::nx::get_path ( const OTYPE< IMPID > &  o)

Return the path of an object as a string. The object can be either an instance of nxfield, nxgroup, or nxattribute.

Exceptions
invalid_object_errorif one of the fields parents could not be retrieved or the attribute itself is not valid
shape_mismatch_errorif a possible class attribute is not scalar
io_errorif class data retrieval failed
type_errorif the class attribute exists but is of the wrong type
object_errorin case of any other error
Template Parameters
OTYPEobject type template
IMPIDimplementation ID
Parameters
oobject instance
Returns
path as string
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
pni::core::string pni::io::nx::get_path ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)

Return the path of an object stored in an nxobject instance.

Exceptions
invalid_object_errorif one of the fields parents could not be retrieved or the attribute itself is not valid
shape_mismatch_errorif a possible class attribute is not scalar
io_errorif class data retrieval failed
type_errorif the class attribute exists but is of the wrong type
object_errorin case of any other error
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
oinstance of nxobject
Returns
path as string
template<template< nximp_code > class OTYPE, nximp_code IMPID>
size_t pni::io::nx::get_rank ( const OTYPE< IMPID > &  o)

Return the number of dimensions of an attribute or field.

Exceptions
invalid_object_errorif object is not valid
object_errorin case of any other error
Template Parameters
OTYPEobject template
IMPIDimplementation ID of the object
Parameters
oreference to the field or attribute
Returns
number of dimensions
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
size_t pni::io::nx::get_rank ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)

Return the number of dimensions of a field or attribute wrapped in an instance of nxobject.

auto field = get_object(root,path_to_field);
size_t r = get_rank(field);
Exceptions
invalid_object_errorif object is not valid
type_errorif the wrapped object is a group
object_errorin case of any other error
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
oobject instance
Returns
number of dimensions
template<typename OTYPE >
auto pni::io::nx::get_root ( const OTYPE &  p) -> decltype(get_parent(p))

Return the root group of an object.

Exceptions
invalid_object_errorif the object is not valid
type_errorif the implementation does not support this operation
io_errorin the case that name retrieval fails
object_errorin case of any other error
Template Parameters
OTYPEobject type
Parameters
preference an instance of OTYPE
Returns
an instance of nxobject with the root group
template<typename CTYPE , template< nximp_code > class OTYPE, nximp_code IMPID>
CTYPE pni::io::nx::get_shape ( const OTYPE< IMPID > &  object)

Returns the shape of an attribute or field type. In the case of any other type compilation fails due to an internal static_assert statement. The container type used to retrieve the shape information must be provided by the user as a template parameter.

nxfield field = get_object(root,path_to_field);
auto shape = get_shape<shape_t>(field);
Exceptions
invalid_object_errorif the object is not valid
object_errorin case of any other error
Template Parameters
CTYPEcontainer type for the shape
OTYPEobject template
IMPIDimplementation ID
Parameters
objectthe object for which the shape should be determined
Returns
instance of CTYPE with shape information
template<typename CTYPE , typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
CTYPE pni::io::nx::get_shape ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)

Returns the shape of an attribute or field type. In the case of any other type compilation fails due to an internal static_assert statement. The container type used to retrieve the shape information must be provided by the user as a template parameter.

object_types field = get_object(root,path_to_field);
auto shape = get_shape<shape_t>(field);
Exceptions
invalid_object_errorif the object is not valid
object_errorin case of any other error
Template Parameters
CTYPEcontainer type for the shape
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
oinstance of VTYPE
Returns
an instance of CTYPE with the elements for each dimension
template<template< nximp_code > class OTYPE, nximp_code IMPID>
size_t pni::io::nx::get_size ( const OTYPE< IMPID > &  o)

Return the number of elements stored in a group, field, or attribute. In the case of a group this function template returns the number of children the group has. In the case of fields and attributes the number of elements are stored in the particular instance.

This template function works for

  • nxgroup
  • nxfield
  • nxattribute
Exceptions
invalid_object_errorif the object is not valid
object_errorin case of any other error
Template Parameters
OTYPEobject template
IPMIDimplementation ID argument of the object template
Parameters
oreference to the group, field, or attribute object
Returns
number of elements
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
size_t pni::io::nx::get_size ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)

Return the number of elements stored in a group, field, or attribute. In the case of a group this function template returns the number of children the group has. In the case of fields and attributes the number of elements are stored in the particular instance.

object_types field = get_object(root,path_to_field);
auto s = get_size(field);
Exceptions
invalid_object_errorif object is not valid
object_errorin case of any other error
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
oinstance of nxobject
Returns
size of the object
template<template< nximp_code > class OTYPE, nximp_code IMPID>
pni::core::type_id_t pni::io::nx::get_type ( const OTYPE< IMPID > &  o)

Get the type ID of a field or attribute. If the type of the object is not an attribute or field type compilation will fails due to an static_insert within the template.

Exceptions
invalid_object_errorif the object is not valid
type_errorif the data type used is not suppported
object_errorin case of any other error
Template Parameters
OTYPEobject template
IMPIDimplementation ID
Parameters
oobject reference
Returns
type ID
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
pni::core::type_id_t pni::io::nx::get_type ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)

Get the type ID of a field or attribute.

object_types field = get_object(root,path_to_field);
type_id_t tc = get_type(field);
Exceptions
invalid_object_errorif the object is not valid
type_errorif the data type is not supported or the object is a group
object_errorin case of any other error
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute_type
LTYPElink type
Parameters
oobject wrapped into nxobject
Returns
value of type_id_t
template<typename FTYPE >
pni::core::string pni::io::nx::get_unit ( const FTYPE &  field)

Return the unit string of a field. This function works only for field types as attributes cannot store unit information.

Template Parameters
invalid_object_errorif the field is not valid
shape_mismatch_errorif the unit attribute is not scalar
io_errorif reading the attribute failed
type_errorif the type used for the units attribute is not supported
object_errorin case of any other error
Parameters
fieldinstance of the Nexus field
Returns
content of the units string
template<template< nximp_code > class OTYPE, nximp_code IMPID>
void pni::io::nx::grow ( OTYPE< IMPID > &  o,
size_t  dimension = 0,
size_t  extend = 1 
)
Exceptions
invalid_object_errorif the field is not active
index_errorif dimension exceeds the rank
object_errorin case of any other error
Template Parameters
OTYPEobject template
IMPIDimplementation ID of the object
Parameters
othe object to grow
dimensionindex of the dimension which to extend
extendnumber of elements by which to extend
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
void pni::io::nx::grow ( nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o,
size_t  d = 0,
size_t  e = 1 
)
auto field = get_object(root,path_to_field);
grow(field,1,10);
Exceptions
invalid_object_errorif the field is not active
index_errorif dimension exceeds the rank
type_errorif the wrapped object is a group or attribute
object_errorin the case of any other error
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
oinstance of nxobject
ddimension along which to grow
eextent by which to grow along d
Returns
nothing
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
bool pni::io::nx::is_attribute ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)
noexcept

Function template checking if the object stored in an nxobject instance is an instance of nxattribute. If this is the case true is returned, otherwise false. The function does not test for the validity of an object. It just provides runtime information about the type of the object stored in the nxobject instance.

Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
oreference to an instance of nxobject<GTYPE,FTYPE,ATYPE>
Returns
true if o is an attribute, false otherwise
template<template< nximp_code > class OTYPE, nximp_code IMPID>
bool pni::io::nx::is_class ( const OTYPE< IMPID > &  object,
const pni::core::string &  type 
)

This function template checks whether or not a group is of a particular type.

Exceptions
invalid_object_errorif parent group is not valid
shape_mismatch_errorthe attribute is not a scalar
type_errorthe attribute type is not supported
io_errorattribute data retrieval failed
object_errorin case of any other error
Template Parameters
OTYPEnexus object template
IMPIDimplementation ID of the object
Parameters
objectthe group to check
typethe type we want ot check for
Returns
true if the group is of that type, false otherwise
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
bool pni::io::nx::is_class ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o,
const pni::core::string &  c 
)

Returns true if a group stored in an instance of nxobject is member of a particular class.

Exceptions
invalid_object_errorif parent group is not valid
shape_mismatch_errorthe attribute is not a scalar
type_errorthe attribute type is not supported
io_errorattribute data retrieval failed
object_errorin case of any other error
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
oinstance of nxobject
cNexus class to check for
Returns
true if group class and c match, false otherwise
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
bool pni::io::nx::is_field ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)
noexcept

Function template testing if the object stored in an instance of nxobject is an instance of nxfield. If this is the case true is returned, false otherwise. The function does not test for validity of an object. It just helps to retrieve type information at runtime.

Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
oinstance of nxobject<GTYPE,FTYPE,ATYPE,LTYPE>
Returns
true if the object is a field, false otherwise
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
bool pni::io::nx::is_group ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)
noexcept

Template function testing if the object stored in an instance of nxobject is an instance of nxgroup. If this is the case true is returned, false otherwise. The function does not test for the validity of the stored object. It just provides type information about the stored object at runtime.

Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
oreference to nxobject<GTYPE,FTYPE,ATYPE,LTYPE>
Returns
true if object is a group, false otherwise
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
bool pni::io::nx::is_link ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)
noexcept

Template function testing if the object stored in an instance of nxobject is an instance of nxlink. If this is the case true is returned, false otherwise. The function does not test for the validity of the stored object. It just provides type information about the stored object at runtime.

Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
oreference to nxobject<GTYPE,FTYPE,ATYPE,LTYPE>
Returns
true if object is a group, false otherwise
template<typename OTYPE >
bool pni::io::nx::is_valid ( const OTYPE &  o)
noexcept

Check if the passed object is valid and return true if this is the case. This template code takes instances

  • nxattribute
  • nxfield
  • nxgroup
  • nxfile
  • nxlink

as input arguments.

Exceptions
object_errorif the validity check fails
Template Parameters
OTYPEobject type
Parameters
oinstance of OTYPE
Returns
true if the object is valid
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
bool pni::io::nx::is_valid ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o)
noexcept

Test the validity of an object stored in an nxobject instance by calling the is_valid method on the particular instance.

auto o = ....;
if(!is_valid(o))
{
std::cerr<<"Nexus object is not valid - abort program!"<<std::endl;
return -1;
}
Exceptions
object_errorif validity check fails
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
oreference to nxobject<GTYPE,FTYPE,ATYPE,LTYPE>
Returns
true if valid, false otherwise
template<template< nximp_code > class OTYPE, nximp_code IMPID, typename ATYPE >
void pni::io::nx::read ( const OTYPE< IMPID > &  o,
ATYPE &  a 
)

Read data form an attribute or field type instance. This function tempalte reads the entire content of the field or attribute. The exceptions which are thrown here depend on ATYPE.

Exceptions
invalid_object_errorif the field is not valid
io_errorif reading the data fails
type_errorif the data type of ATYPE is not supported
memory_not_allocated_errorif ATYPE is an array type and its internal buffer has no memory associated with it
size_mismatch_errorif the number of elements of ATYPE and the field do not match
object_errorin case of any other error
Template Parameters
OTYPEobject template
IMPIDimplementation ID for the object
ATYPEarray type where to store the data
Parameters
ofield or attribute instance
acontainer instance
template<template< nximp_code > class OTYPE, nximp_code IMPID, typename ATYPE , typename... ITYPES>
void pni::io::nx::read ( const OTYPE< IMPID > &  o,
ATYPE &  a,
ITYPES...  indices 
)

Read data form an attribute or field type instance. This function allows reading only a part of the field by passing a multiindex selection to the function. The exceptions which are thrown here depend on ATYPE.

Exceptions
shape_mismatch_errorif selection and field rank do not match
invalid_object_errorif the field is not valid
io_errorif reading the data fails
type_errorif the data type of ATYPE is not supported
memory_not_allocated_errorif ATYPE is an array type and its internal buffer has no memory associated with it
size_mismatch_errorif the number of elements of ATYPE and the field do not match
object_errorin case of any other error
Template Parameters
OTYPEobject template
IMPIDimplementation ID for the object
ATYPEarray type where to store the data
ITYPESindex types
Parameters
ofield or attribute instance
acontainer instance
indicesselection indices passed as variadic arguments
template<typename ATYPE , typename GTYPE , typename FTYPE , typename ATTYPE , typename LTYPE , typename... ITYPES>
void pni::io::nx::read ( const nxobject< GTYPE, FTYPE, ATTYPE, LTYPE > &  o,
ATYPE &  a,
ITYPES...  indices 
)

This function template is a wrapper for the read_visitor. It will read data from the field or attribute stored in the variant type. Partial IO is supported only for fields. As data cannot be read from a group an exception will be thrown if the object stored in the variant type is a group object.

Exceptions
shape_mismatch_errorif selection and field rank do not match
invalid_object_errorif the field is not valid
io_errorif reading the data fails
type_errorif the data type of ATYPE is not supported
memory_not_allocated_errorif ATYPE is an array type and its internal buffer has no memory associated with it
size_mismatch_errorif the number of elements of ATYPE and the field do not match
object_errorin case of any other error
Template Parameters
ATYPEtarget type for the read
GTYPEgroup type
FTYPEfield type
ATTYPEattribute type
LTYPElink type
ITPYESindex types
Parameters
oinstance of VTYPE
ainstance of ATYPE with the data
indicesindex type instances
Returns
nothing
template<typename ATYPE , typename GTYPE , typename FTYPE , typename ATTYPE , typename LTYPE >
void pni::io::nx::read ( const nxobject< GTYPE, FTYPE, ATTYPE, LTYPE > &  o,
ATYPE &  a,
const std::vector< pni::core::slice > &  sel 
)

This function template is a wrapper for the read_visitor. It will read data from the field or attribute stored in the variant type. Partial IO is supported only for fields. As data cannot be read from a group an exception will be thrown if the object stored in the variant

Exceptions
shape_mismatch_errorif selection and field rank do not match
invalid_object_errorif the field is not valid
io_errorif reading the data fails
type_errorif the data type of ATYPE is not supported or the object passed by the user holds a group instance
memory_not_allocated_errorif ATYPE is an array type and its internal buffer has no memory associated with it
size_mismatch_errorif the number of elements of ATYPE and the field do not match
object_errorin case of any other error
Template Parameters
ATYPEtarget type for the read
GTYPEgroup type
FTYPEfield type
ATTYPEattribute type
LTYPElink type
ITPYESindex types
Parameters
oinstance of VTYPE
ainstance of ATYPE with the data
selselection from which to read
Returns
nothing
template<template< nximp_code > class OTYPE, nximp_code IMPID>
void pni::io::nx::set_class ( const OTYPE< IMPID > &  o,
const pni::core::string &  nxclass 
)

Sets the NX_class attribute at a group to a particular value.

Exceptions
type_errorif o is not a group
invalid_object_errorif the group is not valid
type_errorif the data type is not supported
object_errorin case of any other error
Template Parameters
OTYPEobject template
IMPIDimplementation ID of the object
Parameters
ogroup instance for which to set NX_class
nxclassthe value of NX_class
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
void pni::io::nx::set_class ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o,
const pni::core::string &  c 
)

Set the NX_class attribute for a group stored in an instance of nxobject.

Exceptions
type_errorif o is not a group
invalid_object_errorif the group is not valid
type_errorif the data type is not supported
object_errorin case of any other error
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
ogroup as instance of nxobject
cNexus class as string
template<typename FTYPE >
void pni::io::nx::set_unit ( const FTYPE &  field,
const pni::core::string &  value 
)

Set the unit for a field. The unit is stored in an attribute with name "units" of data type string. The attribute is scalar.

Exceptions
invalid_object_errorif field is not valid
type_errorif data type is not supported
io_errorif writing of the value fails
object_errorin case of any other error
Template Parameters
FTYPEfield type
Parameters
fieldinstance of the field
valuethe value for the units attribute
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
void pni::io::nx::set_unit ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  o,
const pni::core::string &  s 
)

Set the unit for a field. The unit is stored in an attribute with name "units" of data type string. The attribute is scalar.

Exceptions
invalid_object_errorif field is not valid
type_errorif data type is not supported
io_errorif writing of the value fails
object_errorin case of any other error
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute type
LTYPElink type
Parameters
oinstance of the parent object
scontent of the unit string
template<template< nximp_code > class OTYPE, nximp_code IMPID, typename ATYPE >
void pni::io::nx::write ( const OTYPE< IMPID > &  o,
const ATYPE &  a 
)

This function writes the entire data from a field.

Exceptions
invalid_object_errorif the field is not valid
io_errorif writing the data fails
type_errorif the data type of ATYPE is not supported
memory_not_allocated_errorif ATYPE is an array type and its internal buffer has no memory associated with it
size_mismatch_errorif the number of elements of ATYPE and the field do not match
object_errorin case of any other error
Template Parameters
OTYPEobject template
IMPIDimplementation ID of the object
ATYPEstorage type where the data is stored
Parameters
oobject instance to which to write the data
ainstance from which to write the data
template<template< nximp_code > class OTYPE, nximp_code IMPID, typename ATYPE , typename... ITYPES>
void pni::io::nx::write ( const OTYPE< IMPID > &  o,
const ATYPE &  a,
ITYPES...  indices 
)

This function writes the entire data from a field.

Exceptions
shape_mismatch_errorif selection and field rank do not match
invalid_object_errorif the field is not valid
io_errorif reading the data fails
type_errorif the data type of ATYPE is not supported
memory_not_allocated_errorif ATYPE is an array type and its internal buffer has no memory associated with it
size_mismatch_errorif the number of elements of ATYPE and the field do not match
object_errorin case of any other error
Template Parameters
OTYPEobject template
IMPIDimplementation ID of the object
ATYPEstorage type where the data is stored
ITYPESindex types
Parameters
oobject instance to which to write the data
ainstance from which to write the data
indicesselection indices passed as variadic arguments
template<typename ATYPE , typename GTYPE , typename FTYPE , typename AATYPE , typename LTYPE , typename... ITYPES>
void pni::io::nx::write ( nxobject< GTYPE, FTYPE, AATYPE, LTYPE > &&  o,
const ATYPE &  a,
ITYPES...  indices 
)

This function template is a wrapper for the write_visitor. It will write data to the field or attribute stored in the variant type. Partial IO is supported only for fields. As data cannot be written to a group an exception will be thrown if the object stored in the variant type is a group object.

Exceptions
shape_mismatch_errorif selection and field rank do not match
invalid_object_errorif the field is not valid
io_errorif writing the data fails
type_errorif the data type of ATYPE is not supported
memory_not_allocated_errorif ATYPE is an array type and its internal buffer has no memory associated with it
size_mismatch_errorif the number of elements of ATYPE and the field do not match
object_errorin case of any other error
Template Parameters
ATYPEdata holding type
VTYPEvariant type
ITPYESindex types
Parameters
oinstance of VTYPE
ainstance of ATYPE with the data
indicesindex type instances