43#include <drain/util/Path.h>
44#include <drain/util/Flags.h>
78std::ostream & operator<<(std::ostream & ostr,
const ODIMPathElem & p);
174 const dict_t & getDictionary();
184 const index_t INDEX_MAX;
189 ODIMPathElem(
group_t group =
ROOT, index_t index = 1) : group(group), index(index){
199 ODIMPathElem(
const ODIMPathElem &e) : group(e.group), index(e.index){
200 if (e.group ==
OTHER)
201 currentStr = e.currentStr;
205 ODIMPathElem(
const std::string &s) : group(
ROOT), index(0){
210 ODIMPathElem(
const char *s): group(
ROOT), index(0){
271 mout.
note(
"index (" , i ,
") given for non-indexed element:" , *
this );
286 void set(
const std::string &s){
301 return (group ==
ROOT);
332 return ((this->group & groupFilter) == this->group);
342 index_t getIndex()
const {
349 char getCharCode()
const;
358 return getKey(this->group);
363 std::ostream &
toStream(std::ostream & sstr)
const;
369 const std::string &
str()
const {
370 if (this->group !=
OTHER){
371 std::stringstream sstr;
374 currentStr = sstr.str();
390 operator const std::string &()
const {
401 void add(
const std::string &s);
415 std::string currentStr;
421void ODIMPathElem::extractIndex(
const std::string &s, ODIMPathElem::index_t & idx);
424extern ODIMPathElem odimROOT;
425extern ODIMPathElem odimWHERE;
426extern ODIMPathElem odimWHAT;
427extern ODIMPathElem odimARRAY;
430bool operator<(
const ODIMPathElem & e1,
const ODIMPathElem & e2);
432bool operator==(
const ODIMPathElem & e1,
const ODIMPathElem & e2);
435bool operator!=(
const ODIMPathElem & e1,
const ODIMPathElem & e2){
436 return ! operator==(e1, e2);
441std::ostream & operator<<(std::ostream & ostr,
const ODIMPathElem & p) {
447std::istream & operator>>(std::istream & istr, ODIMPathElem & p) {
449 drain::StringTools::read<512>(istr, s);
456typedef drain::Path<ODIMPathElem,
'/',
true,
false,
true> ODIMPath;
458typedef std::list<ODIMPath> ODIMPathList;
460typedef std::vector<ODIMPathElem> ODIMPathElemSeq;
491 ODIMPathElem(elem), elangle(elangle), timestamp(date+time) {
495 std::string timestamp;
502std::ostream & operator<<(std::ostream & ostr,
const ODIMPathElem2 & elem) {
503 return ostr << (
const ODIMPathElem &)elem <<
'-' << elem.timestamp <<
'-' << elem.elangle;
510 return e1.timestamp < e2.timestamp;
517 return e1.elangle < e2.elangle;
Two-way mapping between strings and objects of template class T.
Definition Dictionary.h:63
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition Log.h:312
Logger & note(const TT &... args)
For top-level information.
Definition Log.h:489
Definition ODIMPath.h:479
const std::string & getKey() const
Debugging/logging. Returns standard name. Does not check if type is OTHER.
Definition ODIMPath.h:357
static const group_t WHAT
Metadata group /what , at any depth.
Definition ODIMPath.h:127
static const group_t IS_INDEXED
Group index mask for groups that have an index.
Definition ODIMPath.h:159
virtual void set(const std::string &s)
Assign a string to this path element.
Definition ODIMPath.h:286
static const group_t LEGEND
Metadata array describing values in the image data (DATA). EXPERIMENTAL.
Definition ODIMPath.h:146
static const group_t DATASET
First level group, /dataset + digit .
Definition ODIMPath.h:106
const std::string & getPrefix() const
Returns the name without the index.
Definition ODIMPath.cpp:198
static const group_t ALL_LEVELS
Abbreviation for linking (referencing) attributes at different levels (tree depths).
Definition ODIMPath.h:121
static const group_t PALETTE
Palette data (to be linked). EXPERIMENTAL.
Definition ODIMPath.h:143
bool is(group_t g) const
Abbreviation of (group == NONE)
Definition ODIMPath.h:294
bool empty() const
Equivalent to isRoot(). This method is required in recognizing the leading empty string....
Definition ODIMPath.h:306
virtual std::ostream & toStream(std::ostream &sstr) const
For string presentation.
Definition ODIMPath.cpp:320
bool isRoot() const
Abbreviation of (group == ROOT)
Definition ODIMPath.h:300
bool belongsTo(int groupFilter) const
Checks if the element belongs to any of groups given.
Definition ODIMPath.h:330
ODIMPathElem & operator=(const char *s)
Calls set(const std::string &) .
Definition ODIMPath.h:238
virtual bool extractPrefix(const std::string &s, bool indexed)
Given the non-numeric prefix of a group, like "dataset" or "data", set the group.
Definition ODIMPath.cpp:144
virtual void set(group_t g, index_t i=0)
The fundamental assignment operator.
Definition ODIMPath.h:265
static const group_t ROOT
Definition ODIMPath.h:102
static const group_t OTHER
User defined group, name stored as a separate string. The string may still contain numbers,...
Definition ODIMPath.h:153
static const group_t HOW
Metadata group /how , at any depth.
Definition ODIMPath.h:133
static const group_t ATTRIBUTE_GROUPS
Group index mask for groups that contain only meta data.
Definition ODIMPath.h:136
static const group_t NONE
None (undefined)
Definition ODIMPath.h:98
unsigned int group_t
In H5, "groups" correspond to directories or folders in file system.
Definition ODIMPath.h:92
bool isIndexed() const
Abbreviation of (group == NONE)
Definition ODIMPath.h:321
const std::string & str() const
Writes the name, including the index, to output stream.
Definition ODIMPath.h:369
static const group_t QUALITY
Special group on first or second level, /quality + digit , used for storing quality data.
Definition ODIMPath.h:115
static const group_t DATA_GROUPS
Group index mask for groups under which data arrays (ARRAY type) are found.
Definition ODIMPath.h:118
static const group_t ALL_GROUPS
User defined group, name stored as a separate string. Index allowed, but only catenated in the string...
Definition ODIMPath.h:140
static const group_t DATA
Second level group, /data + digit .
Definition ODIMPath.h:109
static const group_t WHERE
Metadata group /where , at any depth.
Definition ODIMPath.h:130
static const group_t ARRAY
Data group "data", at deepest level, like /dataset4/data2/quality1/data.
Definition ODIMPath.h:112
virtual void extractIndex(const std::string &s)
Given a string starting with a numeral, try to extract the index.
Definition ODIMPath.cpp:138
ODIMPathElem & operator=(const T &s)
Redirects to set(const std::string &) .
Definition ODIMPath.h:227
Definition DataSelector.cpp:44
bool operator<(const ODIMPathElem &e1, const ODIMPathElem &e2)
Important!
Definition ODIMPath.cpp:259
std::map< std::string, ODIMPathElem > ODIMPathElemMap
Definition ODIMPath.h:465
Definition ODIMPath.h:514
Definition ODIMPath.h:507
Definition ODIMPath.h:467