13 enum FilterMode {Null=0,Bool,ByValue,ByRange,ByExcludedRange};
19 name(
"noname"), used(true), minimum(0.), maximum(1.), mode(Null)
23 StiFilter(
bool v,
const string& n=
"noname",
bool u=
true):
24 name(n), used(u), minimum(v), maximum(0.), mode(Bool)
28 StiFilter(
int v,
const string& n=
"noname",
bool u=
true):
29 name(n), used(u), minimum(v), maximum(0.), mode(ByValue)
33 StiFilter(
double v,
const string& n=
"noname",
bool u=
true):
34 name(n), used(u), minimum(v), maximum(0.), mode(ByValue)
38 StiFilter(
double min,
double max,
const string& n=
"noname",
bool u=
true):
39 name(n), used(u), minimum(min), maximum(max), mode(ByRange)
43 StiFilter(
double min,
double max,
bool reverse,
const string& n=
"noname",
bool u=
true):
44 name(n), used(u), minimum(min), maximum(max), mode(reverse?ByExcludedRange:ByRange)
49 name(sp.name),used(sp.used),minimum(sp.minimum), maximum(sp.maximum), mode(sp.mode)
55 void setName(
const string& n)
65 void setValue(
bool value)
70 void setValue(
int value)
75 void setValue(
double value)
80 void setRange(
double min,
double max)
86 void set(
double min,
double max,
bool reverse,
const string& n,
bool u)
92 mode = reverse?ByExcludedRange:ByRange;
120 friend ostream& operator<<(ostream& os,
const StiFilter &);
122 virtual bool accept(
bool value);
123 virtual bool accept(
int value);
124 virtual bool accept(
double value);
137 return value? minimum>0 : minimum==0 ;
145 case Null:
return false;
146 case Bool:
return minimum?value>0:value==0;
147 case ByValue:
return minimum==value;
148 case ByRange:
return value>minimum&&value<=maximum;
149 case ByExcludedRange:
return value<=minimum || value>maximum;
159 case Null:
return false;
160 case Bool:
return minimum?value>0:value==0;
161 case ByValue:
return minimum==value;
162 case ByRange:
return value>minimum&&value<=maximum;
163 case ByExcludedRange:
return value<=minimum || value>maximum;
168 typedef vector<StiFilter*> StiFilterVec;
virtual bool accept(bool value)
Filter by value with Bool as input.
StiFilter(double min, double max, const string &n="noname", bool u=true)
Instantiation of a filter by range using double as input.
StiFilter()
Instantiation of a null filter.
StiFilter(double min, double max, bool reverse, const string &n="noname", bool u=true)
Instantiation of a filter by range using double as input and with selective normal/reverse logic...
StiFilter(bool v, const string &n="noname", bool u=true)
Instantiation of a boolean filter.
StiFilter(int v, const string &n="noname", bool u=true)
Instantiation of a filter by value using integer as input.
StiFilter(const StiFilter &sp)
Copy Ctr.
StiFilter(double v, const string &n="noname", bool u=true)
Instantiation of a filter by value using double as input.