31#ifndef ODIM_PATH_MATCHER
32#define ODIM_PATH_MATCHER
36#include <drain/util/Flags.h>
37#include <drain/util/Range.h>
62 this->indexMax = indexMax;
73 this->group = e.group;
74 this->index = e.index;
75 this->indexMax = e.indexMax;
85 this->group = e.group;
86 this->index = e.index;
87 this->indexMax = INDEX_MAX;
100 this->indexMax = INDEX_MAX;
112 void set(
const std::string &s);
116 bool isSingle()
const {
117 return (!
isIndexed()) || (index == indexMax);
123 indexMax = INDEX_MAX;
131 indexMax = INDEX_MAX;
138 bool test(
const ODIMPathElem & elem)
const;
149 std::ostream &
toStream(std::ostream & sstr)
const;
174std::ostream &
operator<<(std::ostream & ostr,
const ODIMPathElemMatcher & p) {
203 template<
typename ... T>
A map of radar data, indexed by quantity code (DBZH, VRAD, etc).
Definition Data.h:1293
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
ODIMPathElemMatcher(const ODIMPathElem &e)
Constructor from ODIMPathElem.
Definition ODIMPathMatcher.h:80
ODIMPathElemMatcher(const ODIMPathElemMatcher &e)
Copy constructor.
Definition ODIMPathMatcher.h:68
virtual std::ostream & toStream(std::ostream &sstr) const
For string presentation.
Definition ODIMPathMatcher.cpp:344
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:139
ODIMPathElemMatcher(ODIMPathElem::group_t groups=ROOT, index_t index=0, index_t indexMax=INDEX_MAX)
Default constructor.
Definition ODIMPathMatcher.h:55
ODIMPathElemMatcher(const std::string &s)
Constructor from string.
Definition ODIMPathMatcher.h:92
bool test(const ODIMPathElem &elem) const
Test if the elem has the same group, and elem.index is within [index,indexMax].
Definition ODIMPathMatcher.cpp:192
virtual void extractIndex(const std::string &s)
Extracts index range of type index[:indexMax].
Definition ODIMPathMatcher.cpp:91
DOC: Add class description.
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:330
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:190
bool isLiteral() const
Checks if corresponds to a single path, implying that all the index ranges are singletons.
Definition ODIMPathMatcher.cpp:231
ODIMPathMatcher(const std::string &path)
Almost copy constructor.
Definition ODIMPathMatcher.h:211
bool matchHead(const rack::ODIMPath &path) const
Match leading part of path.
Definition ODIMPathMatcher.cpp:269
bool ensureLimitingSlash()
Resolves "where|where".
Definition ODIMPathMatcher.cpp:66
bool matchTail(const rack::ODIMPath &path) const
Match trailing part of path.
Definition ODIMPathMatcher.cpp:297
ODIMPathMatcher(const char *path)
Almost copy constructor.
Definition ODIMPathMatcher.h:218
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:324
ODIMPathMatcher()
Basic constructor.
Definition ODIMPathMatcher.h:195
ODIMPathMatcher(const ODIMPathMatcher &matcher)
Copy constructor.
Definition ODIMPathMatcher.h:200
void extractPath(ODIMPath &path) const
Convert to a single path, assuming uniqueness. Future option: extract all the enumerated paths.
Definition ODIMPathMatcher.cpp:242
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:255
Definition AltitudeOp.cpp:42
std::ostream & operator<<(std::ostream &ostr, const PlainData< DT > &d)
Definition Data.h:631
bool & acceptTrailing
If true, allow trailing empty elements (appearing as repeated separators)
Definition Path.h:78