libpniio
Data Structures | Typedefs | Enumerations | Functions
Low level objects
Collaboration diagram for Low level objects:

Data Structures

class  pni::io::nx::flat_group< GTYPE >
 flat group adapter More...
 
class  pni::io::nx::nxlink< IMPID >
 representation of a NeXus link More...
 
class  pni::io::nx::nxattribute< IMPID >
 attribute object More...
 
class  pni::io::nx::nxattribute_manager< OTYPE >
 attribute manager template More...
 
class  pni::io::nx::nxdate_time
 date time factory More...
 
class  pni::io::nx::nxdeflate_filter< FIMP >
 Nexus deflate filter. More...
 
class  pni::io::nx::nxfield< IMPID >
 nxfield base class More...
 
class  pni::io::nx::nxfile< IMPID >
 File object. More...
 
class  pni::io::nx::nxfilter< FIMP >
 Filter object. More...
 
class  pni::io::nx::nxgroup< IMPID >
 NXgroup object. More...
 
struct  pni::io::nx::nximp_code_map< T >
 implementation code type map More...
 
struct  pni::io::nx::nximp_map< c >
 implementation map More...
 
struct  pni::io::nx::nxobject_trait< id >
 nexus object traits More...
 
struct  pni::io::nx::nxobject_group< VTYPE >
 get group type More...
 
struct  pni::io::nx::nxobject_field< VTYPE >
 get field type More...
 
struct  pni::io::nx::nxobject_attribute< VTYPE >
 get attribute type More...
 

Typedefs

template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
using pni::io::nx::nxobject = boost::variant< GTYPE, FTYPE, ATYPE, LTYPE >
 

Enumerations

enum  pni::io::nx::nximp_code { pni::io::nx::nximp_code::HDF5 }
 implementation codes More...
 
enum  pni::io::nx::nxlink_type { pni::io::nx::nxlink_type::HARD, pni::io::nx::nxlink_type::SOFT, pni::io::nx::nxlink_type::EXTERNAL, pni::io::nx::nxlink_type::ATTRIBUTE }
 Nexus link type. More...
 
enum  pni::io::nx::nxlink_status { pni::io::nx::nxlink_status::VALID, pni::io::nx::nxlink_status::INVALID }
 Nexus link status. More...
 
enum  pni::io::nx::nxobject_type {
  pni::io::nx::nxobject_type::NXFIELD, pni::io::nx::nxobject_type::NXGROUP, pni::io::nx::nxobject_type::NXFILE, pni::io::nx::nxobject_type::NXATTRIBUTE,
  pni::io::nx::nxobject_type::NXNONE
}
 Nexus typd ids. More...
 

Functions

template<template< nximp_code > class GTYPE, nximp_code IMPID>
flat_group< GTYPE< IMPID > > pni::io::nx::make_flat (const GTYPE< IMPID > &group)
 create a flat group More...
 
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
flat_group< GTYPE > pni::io::nx::make_flat (const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &object)
 create a flat group More...
 
template<typename CTYPE , template< nximp_code > class GTYPE, nximp_code IMPID>
void pni::io::nx::get_links (const GTYPE< IMPID > &parent, CTYPE &container)
 get list of links More...
 
template<typename CTYPE , template< nximp_code > class GTYPE, nximp_code IMPID>
CTYPE pni::io::nx::get_links (const GTYPE< IMPID > &parent)
 get links below a group More...
 
template<typename CTYPE , template< nximp_code > class GTYPE, nximp_code IMPID>
void pni::io::nx::get_links_recursive (const GTYPE< IMPID > &parent, CTYPE &container)
 get links recursively More...
 
template<typename CTYPE , template< nximp_code > class GTYPE, nximp_code IMPID>
CTYPE pni::io::nx::get_links_recursive (const GTYPE< IMPID > &parent)
 get links recursively More...
 
template<nximp_code IMPID>
bool pni::io::nx::operator== (const nxgroup< IMPID > &a, const nxgroup< IMPID > &b)
 group equality check More...
 
template<nximp_code IMPID>
bool pni::io::nx::operator!= (const nxgroup< IMPID > &a, const nxgroup< IMPID > &b)
 group inequality check More...
 
template<template< nximp_code > class GTYPE, nximp_code IMPID>
void pni::io::nx::link (const nxpath &target, const GTYPE< IMPID > &g, const pni::core::string &name)
 create a link More...
 
template<typename GTYPE >
void pni::io::nx::link (const pni::core::string &target, const GTYPE &g, const pni::core::string &name)
 create a link More...
 
template<typename GTYPE >
void pni::io::nx::link (const char *target, const GTYPE &g, const pni::core::string &name)
 create a link More...
 
template<typename STYPE , typename GTYPE >
void pni::io::nx::link (const STYPE &target, const GTYPE &g, const pni::core::string &name)
 create a link More...
 
template<template< nximp_code > class GTYPE, nximp_code IMPID>
auto pni::io::nx::link_type (const GTYPE< IMPID > &parent, const pni::core::string &name) -> nxlink_type
 return link type More...
 
template<typename GTYPE >
bool pni::io::nx::is_external_link (const GTYPE &parent, const pni::core::string &name)
 return true if link is external More...
 
template<typename GTYPE >
bool pni::io::nx::is_soft_link (const GTYPE &parent, const pni::core::string &name)
 return true if link is soft More...
 
template<typename GTYPE >
bool pni::io::nx::is_hard_link (const GTYPE &parent, const pni::core::string &name)
 return true if link is hard More...
 
std::ostream & pni::io::nx::operator<< (std::ostream &stream, const nxlink_type &ltype)
 ouput operator for link type enumeration More...
 

Detailed Description

This classes implement the basic components from which each nexus object is created.

Typedef Documentation

template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
using pni::io::nx::nxobject = typedef boost::variant<GTYPE,FTYPE,ATYPE,LTYPE>

nxobject is an alias to a boost::variant template which can hold an instance of a group, a field, or an attribute. It can be thus used as a general container for all kind of Nexus objects.

Enumeration Type Documentation

This codes identify a particular implementation for the Nexus classes. As simple as this seems this value is particularly important as it is the central quanityt that identifies all the types belonging to a particular implementation.

Enumerator
HDF5 

HDF5 implementation code.

Enumeration type describing the status of a link.

Enumerator
VALID 

the link is resolvable

INVALID 

cannot be resolved

This enumeration characterizes a particular type of a link. There are three kinds of links possible

  • hard links - this is the most common case. In most cases this link is established when an object is first created
  • soft links - a secondary link pointing to an object, created after the original object has been set up
  • external link - a link pointing to an object in an external file

Attributes to not have a link type. However, we define one to make the interfaces more consistent. The link type ATTRIBUTE thus tells a user that the object he is dealing with is an attribute attached to an object.

Enumerator
HARD 

denotes a hard link

SOFT 

denotes a soft link

EXTERNAL 

denotes an external link

ATTRIBUTE 

returned by attributes

This enumeration class provides identifiers for different Nexus types. Basically there are only two types: fields and groups. Indeed a third is required if the objects does not belong to any of the two mentioned before.

Enumerator
NXFIELD 

NXField identifier.

NXGROUP 

NXGroup identifier.

NXFILE 

NXFile identifier.

NXATTRIBUTE 

attribute identifier

NXNONE 

no valid Nexus object

Function Documentation

template<typename CTYPE , template< nximp_code > class GTYPE, nximp_code IMPID>
void pni::io::nx::get_links ( const GTYPE< IMPID > &  parent,
CTYPE &  container 
)

Appends the links below a parent group to a given container. Only the direct links are taken into account.

Template Parameters
CTYPEcontainer type for the link
GTYPENeXus group template
IMPIDimplementation ID
Parameters
parentthe parent group
containerreference to the target container
template<typename CTYPE , template< nximp_code > class GTYPE, nximp_code IMPID>
CTYPE pni::io::nx::get_links ( const GTYPE< IMPID > &  parent)

Create a new container of type CTYPE and store all links below a parent group in it.

Template Parameters
CTYPEcontainer type
GTYPENexus group template
IMPIDimplementation ID
Parameters
parentthe parent group for which to store the links
Returns
instance of CTYPE with the links
template<typename CTYPE , template< nximp_code > class GTYPE, nximp_code IMPID>
void pni::io::nx::get_links_recursive ( const GTYPE< IMPID > &  parent,
CTYPE &  container 
)

Recursively iterate over a tree starting from a particular parent group and store all links in a container of type CTYPE. If the container already contains links the new ones are appended.

Template Parameters
CTYPEcontainer type
GTYPENeXus container template
IMPIDNeXus implementation ID
Parameters
parentstarting point for the recursive iteration
containerreference to the target container
template<typename CTYPE , template< nximp_code > class GTYPE, nximp_code IMPID>
CTYPE pni::io::nx::get_links_recursive ( const GTYPE< IMPID > &  parent)
Template Parameters
CTYPEcontainer type
GTYPEgroup template
IMPIDimplementation ID
Parameters
parentroot group for iteration
Returns
instance of CTYPE with links
template<typename GTYPE >
bool pni::io::nx::is_external_link ( const GTYPE &  parent,
const pni::core::string &  name 
)

Returns true if the link used for child name below parent is an external one.

Exceptions
invalid_object_errorif parent is not a valid group
key_errorif parent has no child with name
link_errorif link type could not be obtained
type_errorif the link type is unkown
object_errorin case of any other error
Template Parameters
GTYPEparent type
Parameters
parentinstance of GTYPE
namechild name
Returns
true if link is external, false otherwise
template<typename GTYPE >
bool pni::io::nx::is_hard_link ( const GTYPE &  parent,
const pni::core::string &  name 
)

Returns true if the link used for child name below parent is an hard one.

Exceptions
invalid_object_errorif parent is not a valid group
key_errorif parent has no child with name
link_errorif link type could not be obtained
type_errorif the link type is unkown
object_errorin case of any other error
Template Parameters
GTYPEparent type
Parameters
parentinstance of GTYPE
namechild name
Returns
true if link is hard, false otherwise
template<typename GTYPE >
bool pni::io::nx::is_soft_link ( const GTYPE &  parent,
const pni::core::string &  name 
)

Returns true if the link used for child name below parent is an soft one.

Exceptions
invalid_object_errorif parent is not a valid group
key_errorif parent has no child with name
link_errorif link type could not be obtained
type_errorif the link type is unkown
object_errorin case of any other error
Template Parameters
GTYPEparent type
Parameters
parentinstance of GTYPE
namechild name
Returns
true if link is soft, false otherwise
template<template< nximp_code > class GTYPE, nximp_code IMPID>
void pni::io::nx::link ( const nxpath &  target,
const GTYPE< IMPID > &  g,
const pni::core::string &  name 
)

Creates a link to an object referenced by target. The new link is created below g with name. If the location and the target reside within the same file or the target path has no filename set an internal link will be created. Consider the following example. Here we want to create a link from the data stored in a detector field (all within the same file).

nxpath path = path_from_string("/entry/instrument/detector/data");
nxgroup data_group = ....;
link(path,data_group,"data");

In the next example the same link should be created but this time the detector data is stored in an external file.

nxpath path =
path_from_string("detector_file.nxs://entry/instrument/detector/data");
nxgroup data_group = ...;
link(path,data_group,"data");

The sequence of calls is the same as in the latter examples except that the path includes a file name.

Exceptions
invalid_object_errorif parent group is not valid
link_errorif error during link-creation
value_errorif the path contains any class-only elements
Template Parameters
GTYPEgroup type
Parameters
targetpath to the original object
ggroup where to create the link
namethe new name of the link
template<typename GTYPE >
void pni::io::nx::link ( const pni::core::string &  target,
const GTYPE &  g,
const pni::core::string &  name 
)

Creates a link to an object referenced by target. The new link is created below g with name. Here the target path is given by a string.

Exceptions
invalid_object_Errorif g is not a valid group
link_errorin case of errors during link creation
value_errorif path contains class-only elements
Template Parameters
GTYPEgroup type
Parameters
targetpath to the object as a string
ggroup where to create the link
namethe new name of the link
template<typename GTYPE >
void pni::io::nx::link ( const char *  target,
const GTYPE &  g,
const pni::core::string &  name 
)

Creates a link to an object referenced by target. The new link is created below g with name. Here the target path is given by a string.

Exceptions
invalid_object_errorwhen g is not a valid group
link_errorin case of errors during link creation
value_errorif path contains class-only elements
Template Parameters
GTYPEgroup type
Parameters
targetpath to the object as a string
ggroup where to create the link
namethe new name of the link
template<typename STYPE , typename GTYPE >
void pni::io::nx::link ( const STYPE &  target,
const GTYPE &  g,
const pni::core::string &  name 
)

Create a new link to the target object. The new link will be created below g with name name. This function can currently only create internal links as it assumes that the target and g reside within the same file.

Exceptions
link_errorin case of errors during link creation
invalid_object_errorif either g or target are not valid objects
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
STYPEtype of the target object
GTYPEgroup type
Parameters
targetobject to which the new link should point
ggroup where to create the link
namethe new name of the link
template<template< nximp_code > class GTYPE, nximp_code IMPID>
auto pni::io::nx::link_type ( const GTYPE< IMPID > &  parent,
const pni::core::string &  name 
) -> nxlink_type

Returns the type of link used for child name below parent.

Exceptions
invalid_object_errorif parent is not a valid group
key_errorif parent has no child with name
link_errorif link type could not be obtained
type_errorif the link type is unkown
Template Parameters
GTYPEparent object type
Parameters
parentinstance of GTYPE
nameof the child
Returns
link type
template<template< nximp_code > class GTYPE, nximp_code IMPID>
flat_group<GTYPE<IMPID> > pni::io::nx::make_flat ( const GTYPE< IMPID > &  group)

Create a flat group from a group instance.

Exceptions
invalid_object_errorif the group is not valid
object_errorin case of any other error
type_errorif group conversion fails
Template Parameters
GTYPEgroup type template
IMPIDimplementation ID
Parameters
groupinstance of a group
Returns
flat_group instance
template<typename GTYPE , typename FTYPE , typename ATYPE , typename LTYPE >
flat_group<GTYPE> pni::io::nx::make_flat ( const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &  object)

Create a flat group from an instance from nxobject.

Exceptions
type_errorif the parent object does not hold a group
invalid_object_errorif the parent is not valid
object_errorin case of any other error
Template Parameters
GTYPEgroup type
FTYPEfield type
ATYPEattribute_type
LTYPElink type
Parameters
objectinstance of nxobject with the parent group
Returns
instance of flat_group
template<nximp_code IMPID>
bool pni::io::nx::operator!= ( const nxgroup< IMPID > &  a,
const nxgroup< IMPID > &  b 
)

Checks the inequality of two groups.

Exceptions
type_errorif the internal types could not be determined
object_errorin case of any other error
Parameters
agroup instance on the LHS of the operator
bgroup instance on the RHS of the operator
Returns
true if not equal, false otherwise
std::ostream & pni::io::nx::operator<< ( std::ostream &  stream,
const nxlink_type &  ltype 
)

Writes the textual representation of a link type enum to the output stream.

Parameters
streamoutput stream
ltypereference to a link type
Returns
output stream
template<nximp_code IMPID>
bool pni::io::nx::operator== ( const nxgroup< IMPID > &  a,
const nxgroup< IMPID > &  b 
)

Checks the equality of two groups.

Exceptions
type_errorif internal types could not be determined
object_errorin case of any other error
Parameters
agroup instance on the LHS of the operator
bgroup instance on the RHS of the operator
Returns
true if group are equal, false otherwise