Gaia
|
The Filter class allows to check whether a predicate is true for a given Point. More...
#include <filter.h>
Public Member Functions | |
Filter (const Filter &filter) | |
void | updateVariables () |
Look in the predicate/value tree for all the variables it can find and put them inside their respective *VarList member variables. More... | |
bool | needsBinding () const |
Returns whether this filter needs to be bound to a specific layout. More... | |
void | bindToLayout (const PointLayout &layout) |
void | bindToPointAttributes () |
bool | isTrue (const Point *p) const |
Returns whether the filter predicate is true for the given point. | |
bool | isAlwaysTrue () const |
Returns whether the filter predicate is always true, regardless of the given point. | |
const parser::Predicate * | pred () const |
QString | toString () const |
Static Public Member Functions | |
static Filter * | parse (const QString &str) |
Parses a given string and returns the newly created Filter object. | |
static int | opFromString (const QString &str) |
static int | opFromString (const std::string &str) |
Protected Member Functions | |
void | clear () |
void | clearVariables () |
void | updateVariables (parser::Predicate *pred) |
void | updateVariables (parser::Value *value) |
void | updateVariables (parser::Label *label) |
Static Protected Member Functions | |
static Filter * | stealDataFrom (const Filter &other) |
Protected Attributes | |
parser::Predicate * | _pred |
QList< parser::ValueVariable * > | _valueVarList |
QList< parser::LabelVariable * > | _labelVarList |
QList< parser::LabelPointID * > | _pointVarList |
QStringList | _slist |
QList< Real > | _vlist |
const Point * | _currentPoint |
Friends | |
class | parser::FilterParser |
template<typename SearchPointType , typename DataSetType > | |
class | BaseQueryOptimizer |
void | parser::yy_reduce (parser::yyParser *, int) |
The Filter class allows to check whether a predicate is true for a given Point.
To use it, you first need to instantiate it (usually returned by the FilterParser::parse() method), and then bind it to a specific layout (so that variables used in the query are bound to the variables in the layout). You can then call Filter::isTrue() method with a Point as argument to know whether the predicate is true for the given Point or not.
bool gaia2::Filter::needsBinding | ( | ) | const |
Returns whether this filter needs to be bound to a specific layout.
A filter will need to be bound when it has at least one value or label variable, otherwise it is free (and most probably useless!).
Referenced by gaia2::BaseView< DataSetType, PointType, SearchPointType, DistanceType >::validate().
void gaia2::Filter::updateVariables | ( | ) |
Look in the predicate/value tree for all the variables it can find and put them inside their respective *VarList member variables.
This needs to be called if you want your filter to be valid, otherwise it might do weird things (such as crash your program, corrupt your data, ...).