32#ifndef RACK_DATATOOLS_H
33#define RACK_DATATOOLS_H
40#include <drain/RegExp.h>
41#include <drain/image/CoordinatePolicy.h>
42#include <drain/util/BeanLike.h>
43#include <drain/util/ReferenceMap.h>
85 void getAttributes(
const Hi5Tree &src,
const Hi5Tree::path_t & path, M & attributes,
bool updateOnly =
false);
124 int getMaxRange(
const Hi5Tree & src,
bool projected=
true);
129 typedef std::map<std::string, ODIMPathElem> quantity_map;
143 void markExcluded(Hi5Tree &src,
const Hi5Tree::path_t & path,
bool exclude=
true);
158 bool treeToStream(
const Hi5Tree::node_data_t & data, std::ostream &ostr);
218void DataTools::getAttributes(
const Hi5Tree &src,
const Hi5Tree::path_t & p, M & attributes,
bool updateOnly){
232 if (p.empty() || !p.front().isRoot()){
233 mout.
debug(
"add root and restart with path= '" , p ,
"' (revised code)" );
235 Hi5Tree::path_t pRooted;
236 pRooted.appendElem(Hi5Tree::path_t::elem_t::ROOT);
244 mout.
debug(
"path= '" , p ,
"'" );
246 Hi5Tree::path_t path;
247 std::stringstream sstr;
250 for (Hi5Tree::path_t::elem_t elem: p){
252 path.appendElem(elem);
254 mout.
debug(
"check='" , path ,
"'" );
256 const Hi5Tree & s = src(path);
264 for(
const auto & entry: group.attributes){
267 sstr << elem <<
':' << entry.first;
326 for (std::set<ODIMPathElem>::const_iterator git = EncodingODIM::attributeGroups.begin(); git != EncodingODIM::attributeGroups.end(); ++git){
327 const hi5::NodeHi5 & group = s[*git].data;
328 for(drain::VariableMap::const_iterator ait = group.attributes.begin(); ait != group.attributes.end(); ait++){
330 sstr << *git << ':' << ait->first;
331 //mout.debug(8) << "getAttributes: " << sstr.toStr() << '=' << it->second << mout.endl;
333 attributes[sstr.str()] = ait->second;
335 typename M::iterator it = attributes.find(sstr.str());
336 if (it != attributes.end())
337 it->second = ait->second;
343 if (i == std::string::npos){
344 //if (drain::Debug > 4){ std::cerr << "attributes " << attributes << '\n'; }
348 i = path.find('/', i+1);
350 //while (i < path.size()); //(i != std::string::npos);
A map of FlexVariable:s.
Definition VariableMap.h:138
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition Log.h:313
Logger & debug(const TT &... args)
Debug information.
Definition Log.h:667
A map of Variables.
Definition VariableMap.h:61
Policies for coordinate underflows and overflows.
Definition CoordinatePolicy.h:106
static const ODIMPathElemSeq & attributeGroups
Copies contents of this to a h5 group.
Definition EncodingODIM.h:342
Definition DataSelector.cpp:44
std::map< std::string, ODIMPathElem > ODIMPathElemMap
Definition ODIMPath.h:465
QuantityMap & getQuantityMap()
Definition QuantityMap.cpp:279
Rack's hi5 structure that uses Rack classes (Tree, Data, Image).
Definition Hi5.h:74