ScaleOut C++ Native Client API
5.1
|
An object that holds a filtering expression which is used by NamedCache::query to determine which objects in the NamedCache to return. More...
#include <filter.h>
Public Member Functions | |
Filter () | |
Default constructor. More... | |
virtual | ~Filter () |
Destructor. | |
Filter | operator&& (Filter const &other) |
Creates a new Filter object where the underlying expression is the logical AND of this Filter's expression and the other Filter's expression. More... | |
Filter | operator|| (Filter const &other) |
Creates a new Filter object where the underlying expression is the logical OR of this Filter's expression and the other Filter's expression. More... | |
Filter | operator! () |
Creates a new Filter object where the underlying expression is the logical complement of this expression. More... | |
bool | is_empty () const |
If true , this Filter is an "empty" filter, created with the default constructor. More... | |
std::string | str () const |
Returns a canonicalized string representation of the filter expression. More... | |
virtual void | accept (QueryExpression::Visitor &v) const |
Implements the Visitor pattern by accepting a QueryExpression::Visitor object and causing the visitor to examine each of the nodes in the underlying expression tree. More... | |
boost::shared_ptr < QueryExpression const > | query_expression () const |
Returns a shared pointer to the underlying QueryExpression that this Filter object represents. More... | |
Friends | |
class | ReferenceComparand |
class | ValueComparand |
An object that holds a filtering expression which is used by NamedCache::query to determine which objects in the NamedCache to return.
With the exception of the trivial "empty" Filter, Filters are only meaningful in conjunction with a TypedNamedCache subclass, such as NamedProtobufCache, that supports serialization of metadata whenever objects are written to the ScaleOut StateServer and query expression translation into a format understood by the StateServer.
Filter objects are intended to be created via operator overload factory methods by creating an initial Filter from ComparisonExpressions and StringContains expressions. Those filters may then be logically combined with other Filter clauses. For example:
will create a Filter, filter1, that compares the "amount_due" field of objects persisted in the StateServer with the value 50. Only objects with an amount_due greater than or equal to 50 will be returned. The filter
finds objects in StateServer where the amount_due field is greater than or equal to 50 and the days_outstanding field is greater than 30. This filter could have equivalently been written:
These examples assume that the amount_due field and the days_outstanding fields have been attributed with the SossIndex annotation using the mechanism appropriate for the serializer in use by your TypedNamedCache subclass.
sosscli::Filter::Filter | ( | ) |
Default constructor.
Creates an empty Filter object.
If passed an empty Filter object, the base NamedCache::query class will return SossKey key objects for all objects in the NamedCache. If the NamedCache has been subclassed by a query-providing layer such as NamedProtobufCache, then an empty filter will cause key objects to be returned for all objects of the given type (provided they have a compatible index metadata layout).
More interesting Filter objects can be created via the operator overloads defined on ReferenceOperand and ValueOperand.
|
virtual |
Implements the Visitor pattern by accepting a QueryExpression::Visitor object and causing the visitor to examine each of the nodes in the underlying expression tree.
v | The visitor implementation to accept. |
bool sosscli::Filter::is_empty | ( | ) | const |
Filter sosscli::Filter::operator! | ( | ) |
boost::shared_ptr<QueryExpression const> sosscli::Filter::query_expression | ( | ) | const |
Returns a shared pointer to the underlying QueryExpression that this Filter object represents.
std::string sosscli::Filter::str | ( | ) | const |
Returns a canonicalized string representation of the filter expression.