ConditionalExpression
-
class ConditionalExpression : public HPS::Object
A ConditionalExpression is a string or collection of strings separated by logical operators. In practice, conditional expressions form a tree with the leaves being strings (the actual Conditions that must be satisfied) and the interior nodes being logical operators.
Public Functions
-
ConditionalExpression AND(ConditionalExpression const &in_operand2) const
An AND condition is satisfied if both of its operand conditions are satisfied.
- Parameters:
in_operand2 – The condition to AND with this object.
- Returns:
a new condition representing the logical AND of the operand condition with this object.
-
ConditionalExpression()
The default constructor creates an empty condition that is always satisfied.
-
ConditionalExpression(char const *in_condition)
This constructor is the way to construct a ConditionalExpression object from a string.
- Parameters:
in_condition – The string to use as the condition, assumed to be utf8 encoded.
-
ConditionalExpression(ConditionalExpression &&in_that)
The move constructor creates a ConditionalExpression by transferring the underlying impl of the rvalue reference to this ConditionalExpression thereby avoiding a copy and allocation.
- Parameters:
in_that – An rvalue reference to a ConditionalExpression to take the impl from.
-
ConditionalExpression(ConditionalExpression const &in_that)
The copy constructor copies the source condition.
- Parameters:
in_that – the source to be copied.
-
ConditionalExpression(float in_number)
This constructor is the way to construct a ConditionalExpression object from a number.
- Parameters:
in_value – The number to use as the condition.
-
ConditionalExpression(HPS::Condition::Intrinsic in_special)
This constructor is the way to construct a ConditionalExpression object from a special intrinsic type.
- Parameters:
in_special – The intrinsic type to use as the condition.
-
ConditionalExpression EQ(ConditionalExpression const &in_operand2) const
An EQ conditional expression is satisfied if its operand expressions are equal.
- Parameters:
in_operand2 – The expression to compare to this object.
- Returns:
a new conditional expression representing the equality comparison of the operand expression with this object.
-
bool Equals(ConditionalExpression const &in_that) const
Check if the source object is equivalent to this object.
- Parameters:
in_that – The source object to compare to this object.
- Returns:
true if the objects are equivalent, false otherwise.
-
ConditionalExpression GT(ConditionalExpression const &in_operand2) const
An GT conditional expression is satisfied if its second operand is greater than the first operand.
- Parameters:
in_operand2 – The expression to compare to this object.
- Returns:
a new conditional expression representing the greater than comparison of the operand expression with this object.
-
ConditionalExpression GTEQ(ConditionalExpression const &in_operand2) const
An GTEQ conditional expression is satisfied if its second operand is greater than or equal to the first operand.
- Parameters:
in_operand2 – The expression to compare to this object.
- Returns:
a new conditional expression representing the greater than or equal to comparison of the operand expression with this object.
-
bool IsSatisfiedBy(char const *in_condition) const
Determines if the source ConditionalExpression object is satisfied by the given condition.
- Parameters:
in_condition – The condition to test against the ConditionalExpression object.
- Returns:
true if the ConditionalExpression object is satisfied, false otherwise.
-
bool IsSatisfiedBy(UTF8Array const &in_conditions) const
Determines if the source ConditionalExpression object is satisfied by the given conditions.
- Parameters:
in_conditions – The conditions to test against the ConditionalExpression object.
- Returns:
true if the ConditionalExpression object is satisfied, false otherwise.
-
ConditionalExpression LT(ConditionalExpression const &in_operand2) const
An LT conditional expression is satisfied if its second operand is less than the first operand.
- Parameters:
in_operand2 – The expression to compare to this object.
- Returns:
a new conditional expression representing the less than comparison of the operand expression with this object.
-
ConditionalExpression LTEQ(ConditionalExpression const &in_operand2) const
An LTEQ conditional expression is satisfied if its second operand is less than or equal to the first operand.
- Parameters:
in_operand2 – The expression to compare to this object.
- Returns:
a new conditional expression representing the less than or equal to comparison of the operand expression with this object.
-
ConditionalExpression NEQ(ConditionalExpression const &in_operand2) const
An NEQ conditional expression is satisfied if its operand expressions are not equal.
- Parameters:
in_operand2 – The expression to compare to this object.
- Returns:
a new conditional expression representing the non-equality comparison of the operand expression with this object.
-
inline virtual HPS::Type ObjectType() const
This function returns the type the object, as declared (if the object is derived, this does not give the true type of the derived object).
- Returns:
The declared type of the object in question, which may differ from the true, underlying type.
-
ConditionalExpression operator!() const
A NOT condition is satisfied if its operand condition is not satisfied.
- Returns:
a new condition representing the logical negation of this object.
-
bool operator!=(ConditionalExpression const &in_that) const
Check if the source object is equivalent to this object.
- Parameters:
in_that – The source object to compare to this object.
- Returns:
true if the objects are not equivalent, false otherwise.
-
ConditionalExpression operator&&(ConditionalExpression const &in_operand2) const
An AND condition is satisfied if both of its operand conditions are satisfied.
- Parameters:
in_operand2 – The condition to AND with this object.
- Returns:
a new condition representing the logical AND of the operand condition with this object.
-
ConditionalExpression &operator=(ConditionalExpression &&in_that)
The move assignment operator transfers the underlying impl of the rvalue reference to this ConditionalExpression thereby avoiding a copy.
- Parameters:
in_that – An rvalue reference to a ConditionalExpression to take the impl from.
- Returns:
A reference to this ConditionalExpression.
-
ConditionalExpression &operator=(ConditionalExpression const &in_that)
Copies the source ConditionalExpression object to this object.
- Parameters:
in_that – The source of the copy.
- Returns:
A reference to this object.
-
bool operator==(ConditionalExpression const &in_that) const
Check if the source object is equivalent to this object.
- Parameters:
in_that – The source object to compare to this object.
- Returns:
true if the objects are equivalent, false otherwise.
-
ConditionalExpression operator^(ConditionalExpression const &in_operand2) const
An XOR condition is satisfied if either operand condition is satisfied, but not both.
- Parameters:
in_operand2 – The condition to XOR with this object.
- Returns:
a new condition representing the logical XOR of the operand condition with this object.
-
ConditionalExpression operator||(ConditionalExpression const &in_operand2) const
An OR condition is satisfied if either of its operand conditions are satisfied.
- Parameters:
in_operand2 – The condition to OR with this object.
- Returns:
a new condition representing the logical OR of the operand condition with this object.
-
ConditionalExpression OR(ConditionalExpression const &in_operand2) const
An OR condition is satisfied if either of its operand conditions are satisfied.
- Parameters:
in_operand2 – The condition to OR with this object.
- Returns:
a new condition representing the logical OR of the operand condition with this object.
-
bool ShowCondition(UTF8 &out_condition) const
Shows the condition string that has been set on this object, if any. A ConditionalExpression object can only have either a number, condition string, intrinsic type, or operands.
- Parameters:
out_condition – The condition string.
- Returns:
true if a condition string has been set, false otherwise.
-
bool ShowIntrinsic(Condition::Intrinsic &out_special) const
Shows the intrinsic type that has been set on this object, if any. A ConditionalExpression object can only have either a number, condition string, intrinsic type, or operands.
- Parameters:
out_special – The intrinsic type.
- Returns:
true if an intrinsic type has been set, false otherwise.
-
bool ShowNumber(float &out_number) const
Shows the number that has been set on this object, if any. A ConditionalExpression object can only have either a number, condition string, intrinsic type, or operands.
- Parameters:
out_number – The number.
- Returns:
true if a number has been set, false otherwise.
-
bool ShowOperands(ConditionalExpressionArray &out_operands) const
Retrieves the operands, if any, of this condition object. A ConditionalExpression object can only have either a number, condition string, intrinsic type, or operands.
- Parameters:
out_operands – An array of condition operands.
- Returns:
true if operands are set on this object, false otherwise.
-
ConditionalExpression XOR(ConditionalExpression const &in_operand2) const
An XOR condition is satisfied if either operand condition is satisfied, but not both.
- Parameters:
in_operand2 – The condition to XOR with this object.
- Returns:
a new condition representing the logical XOR of the operand condition with this object.
Public Static Functions
-
static ConditionalExpression AND(ConditionalExpression const &in_operand1, ConditionalExpression const &in_operand2)
An AND condition is satisfied if both of its operand conditions are satisfied.
- Parameters:
in_operand1 – The first condition operand.
in_operand2 – The second condition operand.
- Returns:
a new condition representing the logical AND of the operand conditions.
-
static ConditionalExpression AND(ConditionalExpressionArray const &in_operands)
An AND condition is satisfied if all of its operand conditions are satisfied.
- Parameters:
in_operands – The condition operands.
- Returns:
a new condition representing the logical AND of the operand conditions.
-
static ConditionalExpression EQ(ConditionalExpression const &in_operand1, ConditionalExpression const &in_operand2)
An EQ conditional expression is satisfied if its operand expressions are equal.
- Parameters:
in_operand1 – The first condition operand.
in_operand2 – The second condition operand.
- Returns:
a new conditional expression representing the equality comparison of the operand expressions.
-
static ConditionalExpression GT(ConditionalExpression const &in_operand1, ConditionalExpression const &in_operand2)
An GT conditional expression is satisfied if its second operand is greater than the first operand.
- Parameters:
in_operand1 – The first condition operand.
in_operand2 – The second condition operand.
- Returns:
a new conditional expression representing the greater than comparison of the operand expressions.
-
static ConditionalExpression GTEQ(ConditionalExpression const &in_operand1, ConditionalExpression const &in_operand2)
An GTEQ conditional expression is satisfied if its second operand is greater than or equal to the first operand.
- Parameters:
in_operand1 – The first condition operand.
in_operand2 – The second condition operand.
- Returns:
a new conditional expression representing the greater than or equal to comparison of the operands.
-
static ConditionalExpression LT(ConditionalExpression const &in_operand1, ConditionalExpression const &in_operand2)
An LT conditional expression is satisfied if its second operand is less than the first operand.
- Parameters:
in_operand1 – The first condition operand.
in_operand2 – The second condition operand.
- Returns:
a new conditional expression representing the less than comparison of the operand expressions.
-
static ConditionalExpression LTEQ(ConditionalExpression const &in_operand1, ConditionalExpression const &in_operand2)
An LTEQ conditional expression is satisfied if its second operand is less than or equal to the first operand.
- Parameters:
in_operand1 – The first condition operand.
in_operand2 – The second condition operand.
- Returns:
a new conditional expression representing the less than or equal to comparison of the operand expressions.
-
static ConditionalExpression NEQ(ConditionalExpression const &in_operand1, ConditionalExpression const &in_operand2)
An NEQ conditional expression is satisfied if its operand expressions are not equal.
- Parameters:
in_operand1 – The first condition operand.
in_operand2 – The second condition operand.
- Returns:
a new conditional expression representing the non-equality comparison of the operand expressions.
-
static ConditionalExpression NOT(ConditionalExpression const &in_operand)
A NOT condition is satisfied if its operand condition is not satisfied.
- Parameters:
in_operand – The condition operand.
- Returns:
a new condition representing the logical negation of the operand.
-
static ConditionalExpression OR(ConditionalExpression const &in_operand1, ConditionalExpression const &in_operand2)
An OR condition is satisfied if either of its operand conditions are satisfied.
- Parameters:
in_operand1 – The first condition operand.
in_operand2 – The second condition operand.
- Returns:
a new condition representing the logical OR of the operand conditions.
-
static ConditionalExpression OR(ConditionalExpressionArray const &in_operands)
An OR condition is satisfied if any of its operand conditions are satisfied.
- Parameters:
in_operands – The condition operands.
- Returns:
a new condition representing the logical OR of the operand conditions.
-
static ConditionalExpression XOR(ConditionalExpression const &in_operand1, ConditionalExpression const &in_operand2)
An XOR condition is satisfied if either operand condition is satisfied, but not both.
- Parameters:
in_operand1 – The first condition operand.
in_operand2 – The second condition operand.
- Returns:
a new condition representing the logical XOR of the operand conditions.
Friends
- friend HPS_API ConditionalExpression AND (ConditionalExpression const &in_operand1, ConditionalExpression const &in_operand2)
An AND condition is satisfied if both of its operand conditions are satisfied.
- Parameters:
in_operand1 – The first condition operand.
in_operand2 – The second condition operand.
- Returns:
a new condition representing the logical AND of the operand conditions.
- friend HPS_API ConditionalExpression EQ (ConditionalExpression const &in_operand1, ConditionalExpression const &in_operand2)
An EQ conditional expression is satisfied if its operand expressions are equal.
- Parameters:
in_operand1 – The first condition operand.
in_operand2 – The second condition operand.
- Returns:
a new conditional expression representing the equality comparison of the operand expressions.
- friend HPS_API ConditionalExpression GT (ConditionalExpression const &in_operand1, ConditionalExpression const &in_operand2)
An GT conditional expression is satisfied if its second operand is greater than the first operand.
- Parameters:
in_operand1 – The first condition operand.
in_operand2 – The second condition operand.
- Returns:
a new conditional expression representing the greater than comparison of the operand expressions.
- friend HPS_API ConditionalExpression GTEQ (ConditionalExpression const &in_operand1, ConditionalExpression const &in_operand2)
An GTEQ conditional expression is satisfied if its second operand is greater than or equal to the first operand.
- Parameters:
in_operand1 – The first condition operand.
in_operand2 – The second condition operand.
- Returns:
a new conditional expression representing the greater than or equal to comparison of the operands.
- friend HPS_API ConditionalExpression LT (ConditionalExpression const &in_operand1, ConditionalExpression const &in_operand2)
An LT conditional expression is satisfied if its second operand is less than the first operand.
- Parameters:
in_operand1 – The first condition operand.
in_operand2 – The second condition operand.
- Returns:
a new conditional expression representing the less than comparison of the operand expressions.
- friend HPS_API ConditionalExpression LTEQ (ConditionalExpression const &in_operand1, ConditionalExpression const &in_operand2)
An LTEQ conditional expression is satisfied if its second operand is less than or equal to the first operand.
- Parameters:
in_operand1 – The first condition operand.
in_operand2 – The second condition operand.
- Returns:
a new conditional expression representing the less than or equal to comparison of the operand expressions.
- friend HPS_API ConditionalExpression NEQ (ConditionalExpression const &in_operand1, ConditionalExpression const &in_operand2)
An NEQ conditional expression is satisfied if its operand expressions are not equal.
- Parameters:
in_operand1 – The first condition operand.
in_operand2 – The second condition operand.
- Returns:
a new conditional expression representing the non-equality comparison of the operand expressions.
- friend HPS_API ConditionalExpression NOT (ConditionalExpression const &in_operand)
A NOT condition is satisfied if its operand condition is not satisfied.
- Parameters:
in_operand – The condition operand.
- Returns:
a new condition representing the logical negation of the operand.
- friend HPS_API ConditionalExpression OR (ConditionalExpression const &in_operand1, ConditionalExpression const &in_operand2)
An OR condition is satisfied if either of its operand conditions are satisfied.
- Parameters:
in_operand1 – The first condition operand.
in_operand2 – The second condition operand.
- Returns:
a new condition representing the logical OR of the operand conditions.
- friend HPS_API ConditionalExpression XOR (ConditionalExpression const &in_operand1, ConditionalExpression const &in_operand2)
An XOR condition is satisfied if either operand condition is satisfied, but not both.
- Parameters:
in_operand1 – The first condition operand.
in_operand2 – The second condition operand.
- Returns:
a new condition representing the logical XOR of the operand conditions.
-
ConditionalExpression AND(ConditionalExpression const &in_operand2) const