32#ifndef RACK_DATATOOLS_H
33#define RACK_DATATOOLS_H
38#include <drain/image/CoordinatePolicy.h>
39#include <drain/util/ReferenceMap.h>
81 void getAttributes(
const Hi5Tree &src,
const Hi5Tree::path_t & path, M & attributes,
bool updateOnly =
false);
120 int getMaxRange(
const Hi5Tree & src,
bool projected=
true);
125 typedef std::map<std::string, ODIMPathElem> quantity_map;
139 void markExcluded(Hi5Tree &src,
const Hi5Tree::path_t & path,
bool exclude=
true);
154 bool treeToStream(
const Hi5Tree::node_data_t & data, std::ostream &ostr);
214void DataTools::getAttributes(
const Hi5Tree &src,
const Hi5Tree::path_t & p, M & attributes,
bool updateOnly){
228 if (p.empty() || !p.front().isRoot()){
229 mout.
debug(
"add root and restart with path= '" , p ,
"' (revised code)" );
231 Hi5Tree::path_t pRooted;
232 pRooted.appendElem(Hi5Tree::path_t::elem_t::ROOT);
240 mout.
debug(
"path= '" , p ,
"'" );
242 Hi5Tree::path_t path;
243 std::stringstream sstr;
246 for (Hi5Tree::path_t::elem_t elem: p){
248 path.appendElem(elem);
250 mout.
debug(
"check='" , path ,
"'" );
252 const Hi5Tree & s = src(path);
260 for(
const auto & entry: group.attributes){
263 sstr << elem <<
':' << entry.first;
322 for (std::set<ODIMPathElem>::const_iterator git = EncodingODIM::attributeGroups.begin(); git != EncodingODIM::attributeGroups.end(); ++git){
323 const hi5::NodeHi5 & group = s[*git].data;
324 for(drain::VariableMap::const_iterator ait = group.attributes.begin(); ait != group.attributes.end(); ait++){
326 sstr << *git << ':' << ait->first;
327 //mout.debug(8) << "getAttributes: " << sstr.toStr() << '=' << it->second << mout.endl;
329 attributes[sstr.str()] = ait->second;
331 typename M::iterator it = attributes.find(sstr.str());
332 if (it != attributes.end())
333 it->second = ait->second;
339 if (i == std::string::npos){
340 //if (drain::Debug > 4){ std::cerr << "attributes " << attributes << '\n'; }
344 i = path.find('/', i+1);
346 //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:100
static const ODIMPathElemSeq & attributeGroups
Copies contents of this to a h5 group.
Definition EncodingODIM.h:337
Definition DataSelector.cpp:44
std::map< std::string, ODIMPathElem > ODIMPathElemMap
Definition ODIMPath.h:464
QuantityMap & getQuantityMap()
Definition QuantityMap.cpp:279
Rack's hi5 structure that uses Rack classes (Tree, Data, Image).
Definition Hi5.h:71