Function to check if the condition associated with the event is true. Includes frame and run count checking.
| 85 | // Function to check if the condition associated with the event is true. Includes frame and |
| 86 | // run count checking. |
| 87 | bool isConditionMet(T *instance) |
| 88 | { |
| 89 | // Validity check |
| 90 | if ( this->isFinished() ) |
| 91 | return false; |
| 92 | |
| 93 | // Frame check |
| 94 | --step; |
| 95 | if ( step > 0 ) |
| 96 | return false; |
| 97 | this->step = this->runFreq; |
| 98 | |
| 99 | // Conditional check |
| 100 | if ( this->condProc ) |
| 101 | return this->condProc(instance); |
| 102 | return true; // always run if there is no conditional function |
| 103 | }; |
| 104 | private: |
| 105 | // Data members |
| 106 | std::function<bool(T*)> condProc = nullptr; |