reading and writing dimensions
More...
#include <dimensions.hpp>
This structure provides two static methods to read and write the dimensions of a field or attribute to an XML tag.
Reads the dimension information from a dim tag. A index/value pair is returned.
- Parameters
-
dim_node | node 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
-
index | dimension index |
value | number 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
-
- Parameters
-
dims | node 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
-
- Template Parameters
-
- Parameters
-
- 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
-
s | reference 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
-
- Parameters
-
dim | container 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
-
dim | node 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
-
dim | node with dimension information |
- Returns
- number of elements
The documentation for this class was generated from the following files: