31 #ifndef ODIM_PATH_MATCHER
32 #define ODIM_PATH_MATCHER
36 #include <drain/util/Flags.h>
37 #include <drain/util/Range.h>
58 flags(ODIMPathElem::getDictionary(), this->group,
'|'){
61 this->indexMax = indexMax;
70 flags(ODIMPathElem::getDictionary(), this->group,
'|') {
71 this->group = e.group;
72 this->index = e.index;
73 this->indexMax = e.indexMax;
81 flags(ODIMPathElem::getDictionary(), this->group,
'|') {
82 this->group = e.group;
83 this->index = e.index;
84 this->indexMax = INDEX_MAX;
91 flags(ODIMPathElem::getDictionary(), this->group,
'|') {
96 this->indexMax = INDEX_MAX;
108 void set(
const std::string &s);
112 bool isSingle()
const {
113 return (!
isIndexed()) || (index == indexMax);
119 indexMax = INDEX_MAX;
127 indexMax = INDEX_MAX;
144 std::ostream &
toStream(std::ostream & sstr)
const;
198 template<
typename ... T>
201 setElems(elem, rest...);
Element in a chain in testing a path for a match.
Definition: ODIMPathMatcher.h:49
virtual void set(const std::string &s)
Assign a string to this path element.
Definition: ODIMPathMatcher.cpp:46
virtual std::ostream & toStream(std::ostream &sstr) const
For string presentation.
Definition: ODIMPathMatcher.cpp:345
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: ODIMPathMatcher.cpp:140
bool test(const ODIMPathElem &elem) const
Test if the elem has the same group, and elem.index is within [index,indexMax].
Definition: ODIMPathMatcher.cpp:193
virtual void extractIndex(const std::string &s)
Extracts index range of type <index>[:<indexMax>].
Definition: ODIMPathMatcher.cpp:94
Definition: ODIMPath.h:82
static const group_t ROOT
Definition: ODIMPath.h:102
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
virtual void extractIndex(const std::string &s)
Given a string starting with a numeral, try to extract the index.
Definition: ODIMPath.cpp:138
Structure for testing if a path matches a given sequence of path elements.
Definition: ODIMPathMatcher.h:185
bool isLiteral() const
Checks if corresponds to a single path, implying that all the index ranges are singletons.
Definition: ODIMPathMatcher.cpp:232
ODIMPathMatcher(const std::string &path)
Almost copy constructor.
Definition: ODIMPathMatcher.h:206
bool matchHead(const rack::ODIMPath &path) const
Match leading part of path.
Definition: ODIMPathMatcher.cpp:270
bool ensureLimitingSlash()
Resolves "where|where".
Definition: ODIMPathMatcher.cpp:69
bool matchTail(const rack::ODIMPath &path) const
Match trailing part of path.
Definition: ODIMPathMatcher.cpp:298
ODIMPathMatcher(const char *path)
Almost copy constructor.
Definition: ODIMPathMatcher.h:213
bool matchElem(const rack::ODIMPathElem &elem, bool defaultValue=true) const
Match single element. If matcher path does not contain it, return defaultValue.
Definition: ODIMPathMatcher.cpp:325
ODIMPathMatcher()
Basic constructor.
Definition: ODIMPathMatcher.h:190
ODIMPathMatcher(const ODIMPathMatcher &matcher)
Copy constructor.
Definition: ODIMPathMatcher.h:195
void extractPath(ODIMPath &path) const
Convert to a single path, assuming uniqueness. Future option: extract all the enumerated paths.
Definition: ODIMPathMatcher.cpp:243
bool match(const rack::ODIMPath &path) const
Match the leading part of path , if matcher starts with root. Else, match the trailing part.
Definition: ODIMPathMatcher.cpp:256
Definition: DataSelector.cpp:1277
Definition: DataSelector.cpp:44
bool & acceptTrailing
If true, allow trailing empty elements (appearing as repeated separators)
Definition: Path.h:79