Class that represents a filter expression clause for import specifications. More...
#include <SPL/Runtime/Operator/Port/FilterExpression.h>
|
enum |
Kind { AndClause, OrClause, Predicate, NotClause } |
|
Clause kind. More...
|
|
enum |
Op {
LessThan, LessEqual, GreaterThan, GreaterEqual,
Equal, NotEqual, In, None
} |
|
Individual supported relative operations. More...
|
|
enum |
ArithmeticOp {
NoArithmeticOp, Mod, BitOr, BitAnd,
BitXor, LeftShift, RightShift, Add,
Sub, Mul, Div, BNot
} |
|
typedef std::vector
< ArithmeticOperation > |
ArithmeticOperationsVector |
|
|
static Op |
opFromString (std::string const &opName) |
|
Get the Op from the opName. More...
|
|
static std::string |
opToString (Op op) |
|
Get the opName from the Op. More...
|
|
static ArithmeticOp |
arithmeticOpFromString (std::string const &opName) |
|
Get the ArithmeticOp from the opName. More...
|
|
static std::string |
arithmeticOpToString (ArithmeticOp op) |
|
Get the opName from the ArithmeticOp. More...
|
|
static FilterExpressionPtr |
createPredicate (const Tuple &oTuple, const std::string &symbol, Op op, const Literal &lit) |
|
static FilterExpressionPtr |
createPredicate (const Tuple &oTuple, const std::string &symbol, Op op, const Literal &lit, int64 subscript) |
|
static FilterExpressionPtr |
createModuloPredicate (const Tuple &oTuple, const std::string &symbol, const Literal &modDivisor, Op op, const Literal &lit) |
|
static FilterExpressionPtr |
createModuloPredicate (const Tuple &oTuple, const std::string &symbol, const Literal &modDivisor, Op op, const Literal &lit, int64 subscript) |
|
static FilterExpressionPtr |
createAndClause (FilterExpressionPtr &subclause) |
|
static FilterExpressionPtr |
createAndClause (FilterExpressionPtr &lhs, FilterExpressionPtr &rhs) |
|
static FilterExpressionPtr |
createOrClause (FilterExpressionPtr &subclause) |
|
static FilterExpressionPtr |
createOrClause (FilterExpressionPtr &lhs, FilterExpressionPtr &rhs) |
|
static FilterExpressionPtr |
createNotClause (FilterExpressionPtr &subclause) |
|
static FilterExpressionPtr |
fromString (const Tuple &oTuple, const std::string &str) |
|
Class that represents a filter expression clause for import specifications.
Clause kind.
Enumerator |
AndClause |
'sub1 ( && sub2 )*'
|
OrClause |
'sub1 ( || sub2 )*'
|
Predicate |
'symbol <op> literal' or 'symbol[subscript] <op> literal' where <op> != In or 'literal In symbol'
|
NotClause |
'! sub1'
|
Individual supported relative operations.
Enumerator |
LessThan |
Less than.
|
LessEqual |
Less than or equal.
|
GreaterThan |
Greater than.
|
GreaterEqual |
Greater than or equal.
|
Equal |
Equal.
|
NotEqual |
Not equal.
|
In |
Contained.
|
None |
No operator.
|
Enumerator |
NoArithmeticOp |
No arithmetic operator.
|
Mod |
Modulus.
|
BitOr |
Bitwise or.
|
BitAnd |
Bitwise and.
|
BitXor |
Bitwise exclusive or.
|
LeftShift |
Left shift.
|
RightShift |
Right shift.
|
Add |
Addition.
|
Sub |
Subtraction.
|
Mul |
Multiplication.
|
Div |
Division.
|
BNot |
Bitwise not.
|
SPL::FilterExpression::~FilterExpression |
( |
|
) |
|
static Op SPL::FilterExpression::opFromString |
( |
std::string const & |
opName |
) |
|
|
static |
Get the Op from the opName.
static std::string SPL::FilterExpression::opToString |
( |
Op |
op |
) |
|
|
static |
Get the opName from the Op.
static ArithmeticOp SPL::FilterExpression::arithmeticOpFromString |
( |
std::string const & |
opName |
) |
|
|
static |
Get the ArithmeticOp from the opName.
static std::string SPL::FilterExpression::arithmeticOpToString |
( |
ArithmeticOp |
op |
) |
|
|
static |
Get the opName from the ArithmeticOp.
Create a predicate clause ('symbol <op> literal' where <op> != In or 'literal In symbol')
- Parameters
-
symbol |
symbol name |
oTuple |
Output Tuple for Import operator |
op |
operation |
lit |
literal to compare to |
- Returns
- shared pointer to the predicate clause
- Exceptions
-
SPLRuntimeSubscriptionNoAttributeException |
if attribute is not in tuple |
SPLRuntimeSubscriptionInvalidAttributeTypeException |
if attribute type is incorrect |
SPLRuntimeSubscriptionTypeMismatchException |
if attribute typed doesn't match lit |
Create a predicate clause with a subscript on the symbol ('symbol[subscript] <op> literal' where <op> != In)
- Parameters
-
oTuple |
Output Tuple for Import operator |
symbol |
symbol name |
op |
operation |
lit |
literal to compare to |
subscript |
subscript value |
- Returns
- shared pointer to the predicate clause
- Exceptions
-
SPLRuntimeFilterNoSubscriptWithInException |
if the operator specified by op is equal to Op::In |
SPLRuntimeSubscriptionNoAttributeException |
if attribute is not in tuple |
SPLRuntimeSubscriptionInvalidAttributeTypeException |
if attribute type is incorrect |
SPLRuntimeSubscriptionTypeMismatchException |
if attribute typed doesn't match lit |
Create a predicate clause ('symbol % int64Value <op> int64Value2' where <op> != In)
- Parameters
-
oTuple |
Output Tuple for Import operator |
symbol |
symbol name |
modDivisor |
divisor for modulus |
op |
operation |
lit |
value to compare to modulus |
- Precondition
- modDivisor != 0 && op != In
- Returns
- shared pointer to the predicate clause
- Exceptions
-
SPLRuntimeFilterNoSubscriptWithInException |
if the operator specified by op is equal to Op::In |
SPLRuntimeFilterInvalidClauseException |
if modDivisor == 0 |
SPLRuntimeSubscriptionNoAttributeException |
if attribute is not in tuple |
SPLRuntimeSubscriptionInvalidAttributeTypeException |
if attribute type is incorrect |
SPLRuntimeSubscriptionTypeMismatchException |
if attribute typed doesn't match lit |
SPLRuntimeSubscriptionModNotInt64Exception |
if attribute type is not int64 |
Create a predicate clause with a subscript on the symbol Create a predicate clause ('symbol[subscript] % int64Value <op> int64Value2' where <op> != In)
- Parameters
-
oTuple |
Output Tuple for Import operator |
symbol |
symbol name |
modDivisor |
divisor for modulus |
op |
operation |
lit |
value to compare to modulus |
subscript |
subscript value |
- Precondition
- modDivisor != 0
- Returns
- shared pointer to the predicate clause
- Exceptions
-
SPLRuntimeFilterNoSubscriptWithInException |
if the operator specified by op is equal to Op::In |
SPLRuntimeFilterInvalidClauseException |
if modDivisor == 0 |
SPLRuntimeSubscriptionNoAttributeException |
if attribute is not in tuple |
SPLRuntimeSubscriptionInvalidAttributeTypeException |
if attribute type is incorrect |
SPLRuntimeSubscriptionTypeMismatchException |
if attribute typed doesn't match lit |
SPLRuntimeSubscriptionModNotInt64Exception |
if attribute type is not int64 |
Create an and-clause with one subclause
- Parameters
-
subclause |
first subclause |
- Returns
- shared pointer to and-clause with one subclause
Create an and-clause with two subclauses
- Parameters
-
lhs |
first subclause |
rhs |
second subclause |
- Returns
- shared pointer to and-clause with two subclauses
Create an or-clause with one subclause
- Parameters
-
subclause |
first subclause |
- Returns
- shared pointer to or-clause with one subclause
Create an or-clause with two subclauses
- Parameters
-
lhs |
first subclause |
rhs |
second subclause |
- Returns
- shared pointer to or-clause with two subclauses
Create a not-clause with one subclause
- Parameters
-
- Returns
- shared pointer to not-clause with subclause
Create a filter expression from a string
- Parameters
-
oTuple |
output tuple from the Import operator (to check names/types) |
str |
string form of filter expression |
- Returns
- pointer to created FilterExpression or NULL if unable to form a valid expression
std::string SPL::FilterExpression::toString |
( |
|
) |
const |
Get the string representation of the filter expression
- Returns
- string representation of the filter expression
uint32_t SPL::FilterExpression::getSize |
( |
|
) |
const |
Return the number of subclauses in an and/or-clause
- Precondition
- getKind() != Predicate
- Returns
- number of subclauses in the clause
- Exceptions
-
SPLRuntimeFilterInvalidClauseException |
if the filter expression represents a predicate clause |
Return a subclause of an and/or-clause
- Precondition
- getKind() != Predicate
- index < getSize()
- Parameters
-
- Returns
- subclause at the specified index
- Exceptions
-
SPLRuntimeFilterInvalidClauseException |
if the number of subclauses are equal to or less than the index specified, or the filter expression represents a predicate clause |
FilterExpression const& SPL::FilterExpression::getSubclause |
( |
uint32_t |
index |
) |
const |
Return a subclause of an and/or-clause (const verstion) Note that this returns a const reference, not a shared pointer, which could cause problems if the original is removed while the returned value is being used.
- Precondition
- getKind() != Predicate
- index < getSize()
- Parameters
-
- Returns
- subclause at the specified index
- Exceptions
-
SPLRuntimeFilterInvalidClauseException |
if the number of subclauses are equal to or less than the index specified, or the filter expression represents a predicate clause |
Append a subclause to an and/or-clause
- Precondition
- getKind() != Predicate
- Parameters
-
subclause |
clause to be appended |
- Exceptions
-
SPLRuntimeFilterInvalidClauseException |
if the filter expression represents a predicate clause |
void SPL::FilterExpression::removeClause |
( |
uint32_t |
index |
) |
|
Remove a subclause from an and/or clause
- Precondition
- getKind() != Predicate
- getSize() > 1
- getSize() > index
- Parameters
-
index |
clause to be removed |
- Exceptions
-
SPLRuntimeFilterInvalidClauseException |
if the filter expression represents a predicate clause or if the index is invalid (greater than or equal to the number of clauses) |
Kind SPL::FilterExpression::getKind |
( |
|
) |
const |
|
inline |
Get the kind of the filter expression (and clause, or clause, or a predicate)
- Returns
- kind of the filter expression
const std::string& SPL::FilterExpression::getSymbol |
( |
|
) |
const |
Return the symbol in a predicate clause
- Precondition
- getKind() == Predicate
- Returns
- symbol
- Exceptions
-
SPLRuntimeFilterInvalidClauseException |
if the filter expression does not represent a predicate clause |
const Literal& SPL::FilterExpression::getLiteral |
( |
|
) |
const |
Return the literal in a predicate
- Precondition
- getKind() == Predicate
- Returns
- literal
- Exceptions
-
SPLRuntimeFilterInvalidClauseException |
if the filter expression does not represent a predicate clause |
Op SPL::FilterExpression::getOp |
( |
|
) |
const |
Return the operator in an predicate clause
- Precondition
- getKind() == Predicate
- Returns
- operation
- Exceptions
-
SPLRuntimeFilterInvalidClauseException |
if the filter expression does not represent a predicate clause |
bool SPL::FilterExpression::hasSubscript |
( |
|
) |
const |
Return true if the symbol in a predicate clause has a subscript
- Precondition
- getKind() == Predicate
- Returns
- true if the item has a subscript
- Exceptions
-
SPLRuntimeFilterInvalidClauseException |
if the filter expression does not represent a predicate clause |
int64 SPL::FilterExpression::getSubscript |
( |
|
) |
const |
Return subscript for the symbol in a predicate clause
- Precondition
- getKind() == Predicate && hasSubscript()
- Returns
- subscript value
- Exceptions
-
SPLRuntimeFilterInvalidClauseException |
if the filter expression does not represent a predicate clause or if it does not have a subscript |
bool SPL::FilterExpression::hasModuloDivisor |
( |
|
) |
const |
Return true if the symbol in a predicate clause has a modulo divisor If there are multiple arithmetic operations, the result is undefined.
- Precondition
- getKind() == Predicate
- Returns
- true if the item has a modulo divisor
- Exceptions
-
SPLRuntimeFilterInvalidClauseException |
if the filter expression does not represent a predicate clause |
- Deprecated:
- {use getArithmeticOperand instead}
const Literal& SPL::FilterExpression::getModuloDivisor |
( |
|
) |
const |
Return modulo divisor for the symbol in a predicate clause If there are multiple arithmetic operations, the result is undefined.
- Precondition
- getKind() == Predicate && hasModuloDivisor()
- Returns
- modulo divisor value
- Exceptions
-
SPLRuntimeFilterInvalidClauseException |
if the filter expression does not represent a predicate clause or if it does not have a modulo divisor. |
- Deprecated:
- {use getArithmeticOperand instead}
bool SPL::FilterExpression::isEmpty |
( |
|
) |
const |
Is this an empty FilterExpression?
- Returns
- true if the filter expression represents an empty expression
Compare two FilterExpressions for equality (recursively)
- Parameters
-
Compare two FilterExpressions for inequality (recursively)
- Parameters
-
ArithmeticOperationsVector::size_type SPL::FilterExpression::getArithmeticOperationsCount |
( |
|
) |
const |
Get the number of arithmetic operations in this expression.
ArithmeticOperation const& SPL::FilterExpression::getArithmeticOperation |
( |
ArithmeticOperationsVector::size_type |
operationIndex |
) |
const |
Get an arithmetic operation in this expression. The operations are in the order they are to be applied.
The documentation for this class was generated from the following file: