31 #ifndef ODIM_PATH_MATCHER
32 #define ODIM_PATH_MATCHER
37 #include <drain/util/Range.h>
58 flags(this->group, ODIMPathElem::getDictionary(),
'|'){
61 this->indexMax = indexMax;
70 flags(this->group, ODIMPathElem::getDictionary(),
'|') {
71 this->group = e.group;
72 this->index = e.index;
73 this->indexMax = e.indexMax;
81 flags(this->group, ODIMPathElem::getDictionary(),
'|') {
82 this->group = e.group;
83 this->index = e.index;
84 this->indexMax = INDEX_MAX;
91 flags(this->group, ODIMPathElem::getDictionary(),
'|') {
95 this->indexMax = INDEX_MAX;
107 void set(
const std::string &s);
111 bool isSingle()
const {
112 return (!
isIndexed()) || (index == indexMax);
118 indexMax = INDEX_MAX;
126 indexMax = INDEX_MAX;
141 std::ostream &
toStream(std::ostream & sstr)
const;
195 template<
typename ... T>
198 setElems(elem, rest...);
A bit vector with external Dictionary mapping from strings to bits and vice versa.
Definition: FlagsOld.h:45
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:343
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:191
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:99
bool isIndexed() const
Abbreviation of (group == NONE)
Definition: ODIMPath.h:318
drain::Flagger::ivalue_t group_t
In H5, "groups" correspond to "directories" or "folders" in Unix and Windows.
Definition: ODIMPath.h:91
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:182
bool isLiteral() const
Checks if corresponds to a single path, implying that all the index ranges are singletons.
Definition: ODIMPathMatcher.cpp:230
ODIMPathMatcher(const std::string &path)
Almost copy constructor.
Definition: ODIMPathMatcher.h:203
bool matchHead(const rack::ODIMPath &path) const
Match leading part of path.
Definition: ODIMPathMatcher.cpp:268
bool ensureLimitingSlash()
Resolves "where|where".
Definition: ODIMPathMatcher.cpp:69
bool matchTail(const rack::ODIMPath &path) const
Match trailing part of path.
Definition: ODIMPathMatcher.cpp:296
ODIMPathMatcher(const char *path)
Almost copy constructor.
Definition: ODIMPathMatcher.h:210
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:323
ODIMPathMatcher()
Basic constructor.
Definition: ODIMPathMatcher.h:187
ODIMPathMatcher(const ODIMPathMatcher &matcher)
Copy constructor.
Definition: ODIMPathMatcher.h:192
void extractPath(ODIMPath &path) const
Convert to a single path, assuming uniqueness. Future option: extract all the enumerated paths.
Definition: ODIMPathMatcher.cpp:241
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:254
Definition: DataSelector.cpp:1277
Definition: DataSelector.cpp:44
bool & acceptTrailing
If true, allow trailing empty elements (appearing as repeated separators)
Definition: Path.h:79