2020-07-09 20:08:40 +02:00
|
|
|
#ifndef FRAMEWORK_TASKS_EXECUTABLEOBJECTIF_H_
|
|
|
|
#define FRAMEWORK_TASKS_EXECUTABLEOBJECTIF_H_
|
2016-06-15 23:48:41 +02:00
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
class PeriodicTaskIF;
|
2016-06-15 23:48:41 +02:00
|
|
|
|
2018-07-13 18:28:26 +02:00
|
|
|
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
|
|
|
|
|
|
|
#include <cstring>
|
2016-06-15 23:48:41 +02:00
|
|
|
/**
|
|
|
|
* @brief The interface provides a method to execute objects within a task.
|
|
|
|
* @details The performOperation method, that is required by the interface is
|
2018-07-12 16:29:32 +02:00
|
|
|
* executed cyclically within a task context.
|
2020-07-09 20:08:40 +02:00
|
|
|
* @author Bastian Baetz
|
2016-06-15 23:48:41 +02:00
|
|
|
*/
|
|
|
|
class ExecutableObjectIF {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @brief This is the empty virtual destructor as required for C++ interfaces.
|
|
|
|
*/
|
|
|
|
virtual ~ExecutableObjectIF() { }
|
|
|
|
/**
|
2018-07-12 16:29:32 +02:00
|
|
|
* @brief The performOperation method is executed in a task.
|
2016-06-15 23:48:41 +02:00
|
|
|
* @details There are no restrictions for calls within this method, so any
|
|
|
|
* other member of the class can be used.
|
|
|
|
* @return Currently, the return value is ignored.
|
|
|
|
*/
|
2018-07-12 16:29:32 +02:00
|
|
|
virtual ReturnValue_t performOperation(uint8_t operationCode = 0) = 0;
|
|
|
|
|
2018-07-13 18:28:26 +02:00
|
|
|
/**
|
|
|
|
* @brief Function called during setup assignment of object to task
|
2020-07-09 20:08:40 +02:00
|
|
|
* @details
|
|
|
|
* Has to be called from the function that assigns the object to a task and
|
|
|
|
* enables the object implementation to overwrite this function and get
|
|
|
|
* a reference to the executing task
|
2018-07-13 18:28:26 +02:00
|
|
|
* @param task_ Pointer to the taskIF of this task
|
|
|
|
*/
|
2020-07-09 20:08:40 +02:00
|
|
|
virtual void setTaskIF(PeriodicTaskIF* task_) {};
|
2018-07-13 18:28:26 +02:00
|
|
|
|
2020-07-09 20:08:40 +02:00
|
|
|
/**
|
|
|
|
* This function should be called after the object was assigned to a
|
|
|
|
* specific task.
|
|
|
|
*
|
|
|
|
* Example: Can be used to get task execution frequency.
|
|
|
|
* The task is created after initialize() and the object ctors have been
|
|
|
|
* called so the execution frequency can't be cached in initialize()
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
virtual ReturnValue_t initializeAfterTaskCreation() {
|
|
|
|
return HasReturnvaluesIF::RETURN_OK;
|
2018-07-13 18:28:26 +02:00
|
|
|
}
|
2016-06-15 23:48:41 +02:00
|
|
|
};
|
|
|
|
|
2020-07-09 20:08:40 +02:00
|
|
|
#endif /* FRAMEWORK_TASKS_EXECUTABLEOBJECTIF_H_ */
|