libpniio
Static Public Member Functions | Private Types | Static Private Member Functions
pni::io::nx::xml::dimensions Class Reference

reading and writing dimensions More...

#include <dimensions.hpp>

Static Public Member Functions

static size_t rank (const node &dim)
 get number of dimensions More...
 
static size_t size (const node &dim)
 get size of an object More...
 
static pni::core::shape_t object_from_xml (const node &dims)
 return shape More...
 
template<typename DTYPE >
static DTYPE object_from_xml (const node &dims)
 return shape More...
 
static node object_to_xml (const pni::core::shape_t &s)
 create dimension node More...
 
template<typename DTYPE >
static node object_to_xml (const DTYPE &dim)
 create dimension node More...
 

Private Types

typedef std::vector
< index_value_type
iv_vector
 vector type to hold index-value pairs More...
 

Static Private Member Functions

static node index_value_to_node (size_t index, size_t value)
 generate dim node More...
 
static index_value_type index_value_from_node (const node &dim_node)
 read dim information More...
 

Detailed Description

This structure provides two static methods to read and write the dimensions of a field or attribute to an XML tag.

Member Typedef Documentation

Member Function Documentation

index_value_type pni::io::nx::xml::dimensions::index_value_from_node ( const node dim_node)
staticprivate

Reads the dimension information from a dim tag. A index/value pair is returned.

Parameters
dim_nodenode which should be a dim type
Returns
index value pair for the dim entry
node pni::io::nx::xml::dimensions::index_value_to_node ( size_t  index,
size_t  value 
)
staticprivate

Generate the content of a 'dim' node. This funtion basically adds two attributes: the index of the dim and its value.

Parameters
indexdimension index
valuenumber of elements along this dimension
Returns
node with dim attributes
pni::core::shape_t pni::io::nx::xml::dimensions::object_from_xml ( const node dims)
static

Returns a container of type shape_t whose elements are the numbers of elements along each dimension.

Exceptions
parser_errorif a tag cannot be read
Parameters
dimsnode with dimension information
Returns
instance of shape_t
template<typename DTYPE >
static DTYPE pni::io::nx::xml::dimensions::object_from_xml ( const node dims)
inlinestatic

Return the number of elements along each dimension. The container type used is determined at compile time from the template parameter.

Exceptions
parser_errorin case of parsing errors
Template Parameters
DTYPEcontainer type
Parameters
dimsa dim node
Returns
instance of DTYPE with the shape information
node pni::io::nx::xml::dimensions::object_to_xml ( const pni::core::shape_t &  s)
static

Create a dimensions node from a container with shape information.

Parameters
sreference to the shape container
Returns
XML node with dimension information
template<typename DTYPE >
static node pni::io::nx::xml::dimensions::object_to_xml ( const DTYPE &  dim)
inlinestatic

Create a dimension node from shape information stored in a container.

Template Parameters
DTYPEcontainer type
Parameters
dimcontainer instance with shape information
Returns
node instance with shape information
size_t pni::io::nx::xml::dimensions::rank ( const node dim)
static

Return the number of dimensions a particular dimensions tags spans. If the object is scalar this function returns 0.

Parameters
dimnode with dimension information
Returns
number of dimensions
size_t pni::io::nx::xml::dimensions::size ( const node dim)
static

This returns the number of elements which can be stored by an object of a particular dimension. If the rank of the object is 0 this function returns 1 indicating that this is a scalar object.

Parameters
dimnode with dimension information
Returns
number of elements

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