Public Types | Static Public Member Functions | Static Protected Member Functions | List of all members
DataTools Class Reference

Tool for selecting datasets based on paths, quantities and min/max elevations. More...

#include <DataTools.h>

Public Types

typedef std::map< std::string, ODIMPathElemquantity_map
 

Static Public Member Functions

template<class M >
static void getAttributes (const Hi5Tree &src, const Hi5Tree::path_t &path, M &attributes, bool updateOnly=false)
 Traverses upward in hierachy to find the value of the given PolarODIM where, what, or how attribute. More...
 
static void getQuantityMap (const Hi5Tree &srcDataset, ODIMPathElemMap &m)
 
static void updateInternalAttributes (Hi5Tree &src)
 Copies values of what , where and how attributes to internal attributes down to data[n] groups. More...
 
static void updateInternalAttributes (const Hi5Tree &src)
 This const version does nothing, but is needed for Data:: #supdateTree3() More...
 
static void updateCoordinatePolicy (Hi5Tree &src, const drain::image::CoordinatePolicy &policy=drain::image::CoordinatePolicy(drain::image::EdgePolicy::LIMIT))
 
static void markExcluded (Hi5Tree &src, bool exclude=true)
 Mark/unmark whole tree to be deleted with #Hi5Base::deleteExcluded() More...
 
static void markExcluded (Hi5Tree &src, const Hi5Tree::path_t &path, bool exclude=true)
 (Un)mark groups along a path for deletion by #Hi5Base::deleteExcluded()
 
static bool treeToStream (const Hi5Tree::node_data_t &data, std::ostream &ostr)
 Tree attribute formatter. More...
 
static std::list< std::string > & getMainAttributes ()
 
static drain::VariableMapgetAttributeStyles ()
 List of most important ODIM attributes (with style suggestion).
 

Static Protected Member Functions

static bool removeIfExcluded (const Hi5Tree &src)
 Removes the children of the tree if Node::exclude is set. More...
 
static void updateInternalAttributes (Hi5Tree &src, const drain::FlexVariableMap &attributes)
 Copies values of what , where and how attributes to internal attributes down to data[n] groups. More...
 

Detailed Description

Tool for selecting datasets based on paths, quantities and min/max elevations.

Applies drain::RegExp in matching.

Member Function Documentation

◆ getAttributes()

void getAttributes ( const Hi5Tree &  src,
const Hi5Tree::path_t &  path,
M &  attributes,
bool  updateOnly = false 
)
static

Traverses upward in hierachy to find the value of the given PolarODIM where, what, or how attribute.

Parameters
src- structure to be searched
path- starting path, to be continued upwards
group- "what", "where", or "how"
attributeName- name of the attribute Collects PolarODIM /where, /what and /how attributes recursively along the path and stores them in a std::map<std::string,T> (e.g. VariableMap or ReferenceMap, ODIM).
 Does not change attributes of src.
 \see updateAttributes()
template <class M> static void getAttributesOLD(const Hi5Tree &src, const std::string & path, M & attributes, bool updateOnly = false);

◆ markExcluded()

void markExcluded ( Hi5Tree &  src,
bool  exclude = true 
)
static

Mark/unmark whole tree to be deleted with #Hi5Base::deleteExcluded()

This function traverses all the children and their children, recursively. Needed here, ATTRIBUTE_GROUPS not in Hi5Base.

◆ removeIfExcluded()

static bool removeIfExcluded ( const Hi5Tree &  src)
inlinestaticprotected

Removes the children of the tree if Node::exclude is set.

\return - true if children were removed

static bool removeIfExcluded_REMOVE(Hi5Tree & dst); Does nothing

Returns
- false (always, as nothing will be removed)

◆ treeToStream()

bool treeToStream ( const Hi5Tree::node_data_t &  data,
std::ostream &  ostr 
)
static

Tree attribute formatter.

Applied by drain::TreeUtils::dump(). Example:

drain::Output output(filename);
drain::TreeUtils::dump(ctx.getHi5(RackContext::CURRENT), output, DataTools::treeToStream);
Output utility. Opens stdout with "-". Closes upon destruction.
Definition: Output.h:56
static bool dump(const TR &tree, std::ostream &ostr=std::cout, bool(*callBack)(const typename TR::node_data_t &, std::ostream &)=TreeUtils::dataDumper, const std::string &indent="")
Render a tree using character graphics.
Definition: TreeUtils.h:192
static bool treeToStream(const Hi5Tree::node_data_t &data, std::ostream &ostr)
Tree attribute formatter.
Definition: DataTools.cpp:121
Returns
– true, if data is empty, ie. no attributes or data array.

◆ updateInternalAttributes() [1/3]

static void updateInternalAttributes ( const Hi5Tree &  src)
inlinestatic

This const version does nothing, but is needed for Data:: #supdateTree3()

See also
updateAttributes(Hi5Tree & src, const drain::FlexVariableMap & attributes)

◆ updateInternalAttributes() [2/3]

void updateInternalAttributes ( Hi5Tree &  src)
static

Copies values of what , where and how attributes to internal attributes down to data[n] groups.

Traverses the data tree, updates the data (image) attributes along the path down to data[n] level; the lowest groups containing data arrays, that is data groups, are not updated.

Note that also the \i coordinate \i policy is updated, because the corresponding variable is linked by ImageFrame::init().

Typically, this is called on the root.

See also
updateAttributes(Hi5Tree & src, const drain::FlexVariableMap & attributes)

◆ updateInternalAttributes() [3/3]

void updateInternalAttributes ( Hi5Tree &  src,
const drain::FlexVariableMap attributes 
)
staticprotected

Copies values of what , where and how attributes to internal attributes down to data[n] groups.

Traverses the data tree, updates the data (image) attributes along the path down to data[n] level; the lowest groups containing data arrays, that is data groups, are not updated.

Note that also the \i coordinate \i policy is updated, because the corresponding variable is linked by ImageFrame::init().

Typically, this is called on the root.

See also
updateAttributes(Hi5Tree & src)

Write to "hidden" variables of this node (src).

Step 1: collect local values of /what, /where, and /how groups, overwriting attributes initialised to parent values.


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