Classes | Static Public Member Functions | Static Public Attributes | Static Protected Member Functions | List of all members
Writer Class Reference

Converts Rack's h5 structure to native h5 structure applied for file output. More...

#include <Hi5Write.h>

Inheritance diagram for Writer:
Inheritance graph
[legend]
Collaboration diagram for Writer:
Collaboration graph
[legend]

Classes

class  CompoundConv
 
class  CompoundConv< int >
 For some reason HDF5 int fails, but long int does not (Native vs Standard type diff?) More...
 
class  CompoundConv< std::string >
 

Static Public Member Functions

static void writeFile (const std::string &filename, const Hi5Tree &tree)
 Writes Rack's hi5 object to an HDF5 file.
 
static void treeToH5File (const Hi5Tree &tree, hid_t fid, const Hi5Tree::path_t &path)
 Writes Rack's hi5 object to an HDF5 file. More...
 
static void dataToH5Attribute (const drain::Variable &d, hid_t fid, const Hi5Tree::path_t &path, const std::string &attribute)
 Converts drain::Variable to an HDF5 attribute of a group or dataset.
 
static void dataToH5AttributeString (const drain::Variable &d, hid_t fid, const Hi5Tree::path_t &path, const std::string &attribute)
 Creates and writes scalar (non-std::string) attributes to group. More...
 
static hid_t imageToH5DataSet (const drain::image::Image &image, hid_t fid, const Hi5Tree::path_t &path)
 Converts drain::image::Image to an HDF5 dataset.
 
template<class K , class V >
static void vectorToH5Compound (const std::vector< std::pair< K, V > > &v, hid_t fid, const Hi5Tree::path_t &path, const char *labelFirst="key", const char *labelSecond="value")
 Write a vector of paired values. More...
 
template<class K , class V >
static void mapToH5Compound (const std::map< K, V > &m, hid_t fid, const Hi5Tree::path_t &path, const char *labelFirst="key", const char *labelSecond="value")
 TODO: More...
 
static void linkToH5Attribute (hid_t lid, hid_t fid, const std::string &path, const std::string &attribute)
 Under constr. More...
 
- Static Public Member Functions inherited from Hi5Base
static void handleStatus (herr_t status, const std::string &message, drain::Logger &mout, int lineNo=0)
 
template<int L, class T >
static void handleStatus (drain::Logger &mout, herr_t status, const std::string &message, const T &arg, int lineNo=0)
 
static hid_t getH5StandardType (const std::type_info &type)
 Give a native C++ type, returns a standard(?) HDF5 data type.
 
static hid_t getH5NativeDataType (const std::type_info &t)
 Given a native C++ type, returns a native HDF5 data type. More...
 
template<class T >
static hid_t getH5NativeDataType ()
 Given a native C++ type, returns a native HDF5 data type.
 
static hid_t getH5StringVariableLength ()
 
static drain::image::ImagegetPalette (Hi5Tree &dst)
 Creates a 256-element RGB palette to be referenced with linkPalette().
 
static void linkPalette (const Hi5Tree &palette, Hi5Tree &dst)
 Links the palette that has been (or will be) created with createPalette().
 
static void writeText (const Hi5Tree &src, const std::list< typename Hi5Tree::path_t > &paths, std::ostream &ostr=std::cout)
 Dumps the H5 structure, attributes and data properties.
 
static void writeText (const Hi5Tree &src, std::ostream &ostr=std::cout)
 Dumps the H5 structure, attributes and data properties. (Calls writeText(src, src.getKeys(), ostr)).
 
static void readText (Hi5Tree &src, std::istream &istr=std::cin)
 Constructs a tree from formatted text. See writeText(). More...
 
static void parsePath (const std::string &line, Hi5Tree::path_t &path, std::string &attrKey, std::string &attrValue)
 Split full path string to path object and attribute key. More...
 
static void readTextLine (Hi5Tree &src, const std::string &line)
 Assign a value with optional type specification. More...
 
static void assignAttribute (Hi5Tree &dst, const std::string &assignment)
 
static void deleteExcluded (Hi5Tree &src)
 Traverse subtree setting exclude=true . More...
 

Static Public Attributes

static unsigned short compressionLevel = 6
 

Static Protected Member Functions

static hsize_t deriveDimensions (const drain::image::Geometry &g, std::vector< hsize_t > &dims, std::vector< hsize_t > &chunkDims)
 

Detailed Description

Converts Rack's h5 structure to native h5 structure applied for file output.

ODIM conventions are purposely not included in the Hi5 utilities.

Member Function Documentation

◆ dataToH5AttributeString()

void dataToH5AttributeString ( const drain::Variable d,
hid_t  fid,
const Hi5Tree::path_t &  path,
const std::string &  attribute 
)
static

Creates and writes scalar (non-std::string) attributes to group.

For std::string and characterArrays.

◆ deriveDimensions()

hsize_t deriveDimensions ( const drain::image::Geometry g,
std::vector< hsize_t > &  dims,
std::vector< hsize_t > &  chunkDims 
)
staticprotected
Returns
- rank: 2 for single, 3 for multichannel, or 0 in errors

Handles also ZLIB compression (ODIM recommendation: zlib compression level 6)

◆ linkToH5Attribute()

static void linkToH5Attribute ( hid_t  lid,
hid_t  fid,
const std::string &  path,
const std::string &  attribute 
)
static

Under constr.

Under constr

◆ mapToH5Compound()

void mapToH5Compound ( const std::map< K, V > &  m,
hid_t  fid,
const Hi5Tree::path_t &  path,
const char *  labelFirst = "key",
const char *  labelSecond = "value" 
)
static

TODO:

Writes key-value pairs as compound data. Constucts a std::vector or std::pair's , converting strings to const char *, if applied. Then, calls vectorToH5Compound()

◆ treeToH5File()

void treeToH5File ( const Hi5Tree &  tree,
hid_t  fid,
const Hi5Tree::path_t &  path 
)
static

Writes Rack's hi5 object to an HDF5 file.

Conversion from Rack's hi5 to native HDF5.

Parameters
tree- input object hi5 structure
fid- output in native HDF5 structure
path- path of a subtree of input (tree).

... otherwise handle as H5Group, ie. continue iteration

Copy attributes (group or image)

◆ vectorToH5Compound()

void vectorToH5Compound ( const std::vector< std::pair< K, V > > &  v,
hid_t  fid,
const Hi5Tree::path_t &  path,
const char *  labelFirst = "key",
const char *  labelSecond = "value" 
)
static

Write a vector of paired values.

This method uses std::pair as entries. Each entry consists of two values named first and second .

Template Parameters
K- type of the first element, typically the key associated with the value (the second element)
V- type of the second element, typically the value associated with the key (the first element)
Parameters
v- vector containing pairs, perhaps obtaining by adding
f- HDF5 file id
path- location of the target dataset
label1- label of the first value

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