Merge pull request 'setTaskIF in periodic task' (#154) from KSat/fsfw:mueller/Linux-SetTaskIF-Fix into master

This commit is contained in:
Steffen Gaisser 2020-08-25 12:29:02 +02:00
commit fddf31121d
7 changed files with 15 additions and 25 deletions

View File

@ -81,7 +81,7 @@ void PeriodicTask::taskFunctionality() {
}
}
ReturnValue_t PeriodicTask::addComponent(object_id_t object, bool setTaskIF) {
ReturnValue_t PeriodicTask::addComponent(object_id_t object) {
ExecutableObjectIF* newObject = objectManager->get<ExecutableObjectIF>(
object);
if (newObject == nullptr) {
@ -91,9 +91,7 @@ ReturnValue_t PeriodicTask::addComponent(object_id_t object, bool setTaskIF) {
}
objectList.push_back(newObject);
if(setTaskIF) {
newObject->setTaskIF(this);
}
newObject->setTaskIF(this);
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -63,8 +63,7 @@ public:
* -@c RETURN_OK on success
* -@c RETURN_FAILED if the object could not be added.
*/
ReturnValue_t addComponent(object_id_t object,
bool setTaskIF = true) override;
ReturnValue_t addComponent(object_id_t object) override;
uint32_t getPeriodMs() const override;

View File

@ -21,8 +21,7 @@ void* PeriodicPosixTask::taskEntryPoint(void* arg) {
return NULL;
}
ReturnValue_t PeriodicPosixTask::addComponent(object_id_t object,
bool addTaskIF) {
ReturnValue_t PeriodicPosixTask::addComponent(object_id_t object) {
ExecutableObjectIF* newObject = objectManager->get<ExecutableObjectIF>(
object);
if (newObject == nullptr) {

View File

@ -39,8 +39,7 @@ public:
* @param object Id of the object to add.
* @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
*/
ReturnValue_t addComponent(object_id_t object,
bool addTaskIF = true) override;
ReturnValue_t addComponent(object_id_t object) override;
uint32_t getPeriodMs() const override;

View File

@ -78,6 +78,8 @@ ReturnValue_t MultiObjectTask::addComponent(object_id_t object) {
return HasReturnvaluesIF::RETURN_FAILED;
}
objectList.push_back(newObject);
newObject->setTaskIF(this);
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -1,11 +1,5 @@
/**
* @file MultiObjectTask.h
* @brief This file defines the MultiObjectTask class.
* @date 30.01.2014
* @author baetz
*/
#ifndef MULTIOBJECTTASK_H_
#define MULTIOBJECTTASK_H_
#ifndef FSFW_OSAL_RTEMS_MULTIOBJECTTASK_H_
#define FSFW_OSAL_RTEMS_MULTIOBJECTTASK_H_
#include "../../objectmanager/ObjectManagerIF.h"
#include "../../tasks/PeriodicTaskIF.h"
@ -21,7 +15,7 @@ class ExecutableObjectIF;
* @details MultiObjectTask is an extension to ObjectTask in the way that it is able to execute
* multiple objects that implement the ExecutableObjectIF interface. The objects must be
* added prior to starting the task.
*
* @author baetz
* @ingroup task_handling
*/
class MultiObjectTask: public TaskBase, public PeriodicTaskIF {
@ -63,11 +57,11 @@ public:
* @param object Id of the object to add.
* @return RETURN_OK on success, RETURN_FAILED if the object could not be added.
*/
ReturnValue_t addComponent(object_id_t object);
ReturnValue_t addComponent(object_id_t object) override;
uint32_t getPeriodMs() const;
uint32_t getPeriodMs() const override;
ReturnValue_t sleepFor(uint32_t ms);
ReturnValue_t sleepFor(uint32_t ms) override;
protected:
typedef std::vector<ExecutableObjectIF*> ObjectList; //!< Typedef for the List of objects.
/**
@ -110,4 +104,4 @@ protected:
void taskFunctionality(void);
};
#endif /* MULTIOBJECTTASK_H_ */
#endif /* FSFW_OSAL_RTEMS_MULTIOBJECTTASK_H_ */

View File

@ -36,8 +36,7 @@ public:
* to the component.
* @return
*/
virtual ReturnValue_t addComponent(object_id_t object,
bool setTaskIF = true) {
virtual ReturnValue_t addComponent(object_id_t object) {
return HasReturnvaluesIF::RETURN_FAILED;
};