$darkmode
Go to the source code of this file.
Classes | |
| class | cloe::events::Evaluate |
| class | cloe::events::EvaluateFactory |
Typedefs | |
| using | cloe::events::EvaluateCallback = DirectCallback< Evaluate, double > |
This file defines the Evaluate event and the corresponding EvaluateFactory. These can be used to make comparisons between two values. For example, let us say that our model would like to make a comparison between some internal value SET_SPEED and a desired value TARGET_SET_SPEED. The user should then be able to insert a trigger with the event corresponding to:
SET_SPEED >= TARGET_SET_SPEED
The model will need to add the EvaluateCallback to its class:
std::shared_ptr<events::EvaluateCallback> callback_set_speed_;
And in it's enroll(Registrar& r) method, it should register the callback:
callback_set_speed_ = register_event<events::Evaluate, double>( r, std::make_unique<events::EvaluateFactory>( name() + "/set_speed", "set speed in km/h"));
In the process(const Sync& s) method, the trigger can then be called:
callback_set_speed_->trigger(s, set_speed_);