![]() |
JaffarPlus
High-performance best-first search optimizer for tool-assisted speedruns
|
Concrete, type-specialized condition over operands of type T.
More...
#include <condition.hpp>
Public Types | |
| enum | operator_t { op_equal , op_not_equal , op_greater , op_greater_or_equal , op_less , op_less_or_equal , op_bit_true , op_bit_false , op_modulo_zero , op_modulo_non_zero } |
| The comparison operator applied between the condition's two operands. More... | |
Public Member Functions | |
| _vCondition (const operator_t opType, Property *property1, Property *property2, T immediate1, T immediate2) | |
| Builds a typed condition from its operands. | |
| bool | evaluate () const |
| Evaluates the comparison using the operands' current values. | |
Static Public Member Functions | |
| static operator_t | getOperatorType (const std::string &operation) |
| Maps a configuration operator string to its operator_t value. | |
Protected Attributes | |
| const operator_t | _opType |
| The comparison operator selected for this condition. | |
Static Private Member Functions | |
| static bool | _opEqual (const T a, const T b) |
| Returns a == b. | |
| static bool | _opNotEqual (const T a, const T b) |
| Returns a != b. | |
| static bool | _opGreater (const T a, const T b) |
| Returns a > b. | |
| static bool | _opGreaterOrEqual (const T a, const T b) |
| Returns a >= b. | |
| static bool | _opLess (const T a, const T b) |
| Returns a < b. | |
| static bool | _opLessOrEqual (const T a, const T b) |
| Returns a <= b. | |
| static bool | _opBitTrue (const T a, const T b) |
Returns true if the bit of a at index b is set. | |
| static bool | _opBitFalse (const T a, const T b) |
Returns true if the bit of a at index b is clear. | |
| static bool | _opModuloZero (const T a, const T b) |
| Returns true if a % b == 0. | |
| static bool | _opModuloNonZero (const T a, const T b) |
| Returns true if a % b != 0. | |
Private Attributes | |
| bool(* | _opFcPtr )(const T, const T) |
| Resolved operator implementation, selected once at construction from _opType. | |
| Property *const | _property1 |
| First operand as a property, or nullptr to use _immediate1. | |
| Property *const | _property2 |
| Second operand as a property, or nullptr to use _immediate2. | |
| const T | _immediate1 |
| First operand's immediate value (used when _property1 is null). | |
| const T | _immediate2 |
| Second operand's immediate value (used when _property2 is null). | |
Concrete, type-specialized condition over operands of type T.
Each operand is either a Property (read live on every evaluation) or a fixed immediate value. When a property pointer is non-null it overrides the corresponding immediate. The operator is resolved once at construction to a function pointer to keep evaluate branch-free.
| T | The numeric type the operands are compared as. |
Definition at line 92 of file condition.hpp.
|
inherited |
The comparison operator applied between the condition's two operands.
Definition at line 26 of file condition.hpp.
|
inline |
Builds a typed condition from its operands.
| opType | The comparison operator to apply. |
| property1 | First operand as a property, or nullptr to use immediate1. |
| property2 | Second operand as a property, or nullptr to use immediate2. |
| immediate1 | First operand's immediate value, used when property1 is nullptr. |
| immediate2 | Second operand's immediate value, used when property2 is nullptr. |
Definition at line 103 of file condition.hpp.
|
inlinestaticprivate |
Returns true if the bit of a at index b is clear.
Definition at line 154 of file condition.hpp.
|
inlinestaticprivate |
Returns true if the bit of a at index b is set.
Definition at line 152 of file condition.hpp.
|
inlinestaticprivate |
Returns a == b.
Definition at line 140 of file condition.hpp.
|
inlinestaticprivate |
Returns a > b.
Definition at line 144 of file condition.hpp.
|
inlinestaticprivate |
Returns a >= b.
Definition at line 146 of file condition.hpp.
|
inlinestaticprivate |
Returns a < b.
Definition at line 148 of file condition.hpp.
|
inlinestaticprivate |
Returns a <= b.
Definition at line 150 of file condition.hpp.
|
inlinestaticprivate |
Returns true if a % b != 0.
Definition at line 158 of file condition.hpp.
|
inlinestaticprivate |
Returns true if a % b == 0.
Definition at line 156 of file condition.hpp.
|
inlinestaticprivate |
Returns a != b.
Definition at line 142 of file condition.hpp.
|
inlinevirtual |
Evaluates the comparison using the operands' current values.
For each operand, the live property value is used when a property was supplied; otherwise the immediate value is used.
Implements jaffarPlus::Condition.
Definition at line 129 of file condition.hpp.
|
inlinestaticinherited |
Maps a configuration operator string to its operator_t value.
| operation | The operator token from the config (e.g. "==", ">=", "BitTrue", "%0"). |
| A | logic error if the token is not a recognized operator. |
Definition at line 59 of file condition.hpp.
|
private |
First operand's immediate value (used when _property1 is null).
Definition at line 165 of file condition.hpp.
|
private |
Second operand's immediate value (used when _property2 is null).
Definition at line 166 of file condition.hpp.
|
private |
Resolved operator implementation, selected once at construction from _opType.
Definition at line 161 of file condition.hpp.
|
protectedinherited |
The comparison operator selected for this condition.
Definition at line 79 of file condition.hpp.
|
private |
First operand as a property, or nullptr to use _immediate1.
Definition at line 163 of file condition.hpp.
|
private |
Second operand as a property, or nullptr to use _immediate2.
Definition at line 164 of file condition.hpp.