new initializeAfterTaskCreation()

This commit is contained in:
Robin Müller 2020-06-29 15:55:20 +02:00
parent d5d968a393
commit 003e70bf47
5 changed files with 17 additions and 20 deletions

View File

@ -94,7 +94,8 @@ ReturnValue_t PeriodicTask::addComponent(object_id_t object, bool setTaskIF) {
if(setTaskIF) {
newObject->setTaskIF(this);
}
return HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = newObject->initializeAfterTaskCreation();
return result;
}
uint32_t PeriodicTask::getPeriodMs() const {

View File

@ -36,7 +36,9 @@ ReturnValue_t PeriodicPosixTask::addComponent(object_id_t object,
if(setTaskIF) {
newObject->setTaskIF(this);
}
return HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = newObject->initializeAfterTaskCreation();
return result;
}
ReturnValue_t PeriodicPosixTask::sleepFor(uint32_t ms) {

View File

@ -78,7 +78,8 @@ ReturnValue_t MultiObjectTask::addComponent(object_id_t object) {
return HasReturnvaluesIF::RETURN_FAILED;
}
objectList.push_back(newObject);
return HasReturnvaluesIF::RETURN_OK;
ReturnValue_t result = newObject->initializeAfterTaskCreation();
return result;
}
uint32_t MultiObjectTask::getPeriodMs() const {

View File

@ -1,15 +1,5 @@
/**
* @file ExecutableObjectIF.h
*
* @brief This file contains the definition for the ExecutableObjectIF interface.
*
* @author Bastian Baetz
*
* @date 12.03.2012
*/
#ifndef EXECUTABLEOBJECTIF_H_
#define EXECUTABLEOBJECTIF_H_
#ifndef FRAMEWORK_TASKS_EXECUTABLEOBJECTIF_H_
#define FRAMEWORK_TASKS_EXECUTABLEOBJECTIF_H_
class PeriodicTaskIF;
@ -20,6 +10,7 @@ class PeriodicTaskIF;
* @brief The interface provides a method to execute objects within a task.
* @details The performOperation method, that is required by the interface is
* executed cyclically within a task context.
* @author Bastian Baetz
*/
class ExecutableObjectIF {
public:
@ -46,15 +37,17 @@ public:
virtual void setTaskIF(PeriodicTaskIF* task_) {};
/**
* This function will be called after the object was assigned to a specific
* task.
* 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() = 0;
virtual ReturnValue_t initializeAfterTaskCreation() {
return HasReturnvaluesIF::RETURN_OK;
}
};
#endif /* EXECUTABLEOBJECTIF_H_ */
#endif /* FRAMEWORK_TASKS_EXECUTABLEOBJECTIF_H_ */

View File

@ -9,7 +9,7 @@ FixedSequenceSlot::FixedSequenceSlot(object_id_t handlerId, uint32_t setTime,
if(executingTask != nullptr) {
handler->setTaskIF(executingTask);
}
//handler->initializeAfterTaskCreation();
handler->initializeAfterTaskCreation();
}
FixedSequenceSlot::~FixedSequenceSlot() {}