nidas v1.2.3
|
Match samples according to DSM and Sample ID ranges, and configure the ranges with criteria in text format. More...
#include <SampleMatcher.h>
Classes | |
struct | RangeMatcher |
Public Member Functions | |
SampleMatcher () | |
Construct an empty SampleMatcher with no ranges. | |
bool | addCriteria (const std::string &ctext) |
Add a sample range using this syntax: | |
bool | match (dsm_sample_id_t id) |
Return true if the given id satisfies the current range criteria. | |
bool | match (const Sample *samp) |
Return true if this sample matches all the criteria in this matcher, both sample ids and time range. | |
bool | exclusiveMatch () |
Return true if this matcher can only match a single ID pair (DSM,SID), meaning only one range has been added and it specifies two specific positive IDs. | |
int | numRanges () |
The number of ranges added to this SampleMatcher. | |
void | setStartTime (nidas::util::UTime start) |
Set the time before which samples will not match. | |
nidas::util::UTime | getStartTime () |
void | setEndTime (nidas::util::UTime end) |
Set the time after which samples will not match. | |
nidas::util::UTime | getEndTime () |
Private Types | |
typedef std::map< dsm_sample_id_t, bool > | id_lookup_t |
typedef std::vector< RangeMatcher > | range_matches_t |
Private Attributes | |
range_matches_t | _ranges |
id_lookup_t | _lookup |
nidas::util::UTime | _startTime |
nidas::util::UTime | _endTime |
dsm_sample_id_t | _first_dsmid |
Match samples according to DSM and Sample ID ranges, and configure the ranges with criteria in text format.
|
private |
|
private |
SampleMatcher::SampleMatcher | ( | ) |
Construct an empty SampleMatcher with no ranges.
An empty SampleMatcher implicitly matches all samples.
Add a sample range using this syntax:
* [^]{<d1>[-<d2>|*},{<s1>[-<s2>]|*} *
The leading '^' will exclude any sample IDs in the given range instead of including them. The '*' matches any ID. The older convention where -1 matches all IDs is still supported.
An empty criteria string is allowed and valid but changes nothing.
References _first_dsmid, _lookup, _ranges, and nidas::core::getSample().
Referenced by nidas::core::NidasApp::parseNext(), and nidas::core::SampleTracer::SampleTracer().
bool SampleMatcher::exclusiveMatch | ( | ) |
Return true if this matcher can only match a single ID pair (DSM,SID), meaning only one range has been added and it specifies two specific positive IDs.
References _ranges, and nidas::core::getSample().
Referenced by DumpClient::printHeader(), and DumpClient::setSensors().
|
inline |
References _endTime.
|
inline |
References _startTime.
Return true if this sample matches all the criteria in this matcher, both sample ids and time range.
References _endTime, _startTime, match(), and nidas::util::UTime::toUsecs().
bool SampleMatcher::match | ( | dsm_sample_id_t | id | ) |
Return true if the given id
satisfies the current range criteria.
Search the ranges for one which includes this id, then return true if the range is an inclusion and otherwise false. The outcome is cached for future lookups, but the cache is cleared if the criteria change.
References _first_dsmid, _lookup, _ranges, GET_DSM_ID, GET_SHORT_ID, and nidas::core::getSample().
Referenced by nidas::core::SampleTracer::active(), nidas::core::SampleTracer::active(), match(), DataStats::receive(), and DumpClient::setSensors().
|
inline |
The number of ranges added to this SampleMatcher.
References _ranges.
Referenced by DataDump::parseRunstring().
|
inline |
Set the time after which samples will not match.
References _endTime.
Referenced by nidas::core::NidasApp::parseNext().
|
inline |
Set the time before which samples will not match.
References _startTime.
Referenced by nidas::core::NidasApp::parseNext().
|
private |
Referenced by getEndTime(), match(), and setEndTime().
|
private |
Referenced by addCriteria(), and match().
|
private |
Referenced by addCriteria(), and match().
|
private |
Referenced by addCriteria(), exclusiveMatch(), match(), and numRanges().
|
private |
Referenced by getStartTime(), match(), and setStartTime().