#include <baseLoopActions.hpp>
Public Member Functions | |
| BaseLoopExecuteActivity (const std::string &id, rad::SMAdapter &sm, DataContext &data, int loop_index, LoopCompletionHandler *completion_handler=nullptr) | |
| virtual | ~BaseLoopExecuteActivity ()=default |
| void | Run () override |
| BaseLoopExecuteActivity (const BaseLoopExecuteActivity &)=delete | |
| BaseLoopExecuteActivity & | operator= (const BaseLoopExecuteActivity &)=delete |
| template<typename T> | |
| T | GetLoopParam (const std::string &name) const |
| template<typename T> | |
| T | GetLoopParam (const std::string &name, const T &default_value) const |
| template<typename T> | |
| bool | ReadLoopOldb (const std::string &name, T &out) const |
Public Member Functions inherited from ifw::slm::KillableThreadActivity | |
| KillableThreadActivity (const KillableThreadActivity &)=delete | |
| KillableThreadActivity & | operator= (const KillableThreadActivity &)=delete |
| pthread_t | GetNativeHandle () const override |
| bool | IsThreadJoined () const override |
Protected Member Functions | |
| virtual bool | DoExecute ()=0 |
Protected Member Functions inherited from ifw::slm::KillableThreadActivity | |
| void | StartThread () override |
| void | JoinThread () override |
Protected Attributes | |
| rad::SMAdapter & | m_sm |
| DataContext & | m_data |
| int | m_loop_index |
| LoopStateData | m_loop_state |
| LoopCompletionHandler * | m_completion_handler |
| log4cplus::Logger | m_logger = log4cplus::Logger::getInstance(LOGGER_NAME + ".BaseLoopExecuteActivity") |
Protected Attributes inherited from ifw::slm::KillableThreadActivity | |
| std::atomic< bool > | m_killed {false} |
| std::atomic< int > | m_thread_generation {0} |
Base class for loop execute activities.
This activity runs the loop execution logic in a separate thread. Users should extend this class and override DoExecute() to implement their custom control logic.
| ifw::slm::BaseLoopExecuteActivity::BaseLoopExecuteActivity | ( | const std::string & | id, |
| rad::SMAdapter & | sm, | ||
| DataContext & | data, | ||
| int | loop_index, | ||
| LoopCompletionHandler * | completion_handler = nullptr ) |
|
virtualdefault |
|
delete |
|
protectedpure virtual |
Hook method for derived classes to implement custom execute logic.
This method is called from Run() and should contain the actual control algorithm implementation.
Implemented in ifw::slm::TestableExecuteActivity.
|
inline |
Read a per-loop configuration parameter by name.
"params/<name>" entries live in the params vector_string node, so they must go through GetLoopParamFromConfig (which parses the vector) and not through a plain rad::Config key lookup - config-ng cannot resolve a named child on a sequence node.
| name | Parameter name (e.g. "params/motor_speed") |
| T | Expected type (string, int, double, bool) |
| std::runtime_error | if parameter missing or type mismatch |
|
inline |
Read a per-loop configuration parameter with a default value.
|
delete |
|
inline |
Read this loop's current OLDB value (key sl/loop_/<name>), e.g. a setpoint another component wrote. Returns false if the key is missing or has a different type. This is a convenience for loops that need to consume OLDB state instead of (or in addition to) static config.
|
overridevirtual |
Implements ifw::slm::KillableThreadActivity.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |