diff --git a/.run/fsfw-tests_coverage.run.xml b/.run/fsfw-tests_coverage.run.xml index 49d9b1359..9080b3e1d 100644 --- a/.run/fsfw-tests_coverage.run.xml +++ b/.run/fsfw-tests_coverage.run.xml @@ -1,5 +1,5 @@ - + diff --git a/src/fsfw/action/ActionHelper.cpp b/src/fsfw/action/ActionHelper.cpp index d41c78b4b..bee68b404 100644 --- a/src/fsfw/action/ActionHelper.cpp +++ b/src/fsfw/action/ActionHelper.cpp @@ -6,7 +6,7 @@ ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) : owner(setOwner), queueToUse(useThisQueue) {} -ActionHelper::~ActionHelper() {} +ActionHelper::~ActionHelper() = default; ReturnValue_t ActionHelper::handleActionMessage(CommandMessage* command) { if (command->getCommand() == ActionMessage::EXECUTE_ACTION) { @@ -59,7 +59,7 @@ void ActionHelper::setQueueToUse(MessageQueueIF* queue) { queueToUse = queue; } void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId, store_address_t dataAddress) { - const uint8_t* dataPtr = NULL; + const uint8_t* dataPtr = nullptr; size_t size = 0; ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size); if (result != HasReturnvaluesIF::RETURN_OK) { diff --git a/src/fsfw/action/ActionHelper.h b/src/fsfw/action/ActionHelper.h index d86e87d23..a9910b05f 100644 --- a/src/fsfw/action/ActionHelper.h +++ b/src/fsfw/action/ActionHelper.h @@ -1,9 +1,9 @@ #ifndef FSFW_ACTION_ACTIONHELPER_H_ #define FSFW_ACTION_ACTIONHELPER_H_ -#include "../ipc/MessageQueueIF.h" -#include "../serialize/SerializeIF.h" #include "ActionMessage.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/serialize/SerializeIF.h" /** * @brief Action Helper is a helper class which handles action messages * diff --git a/src/fsfw/action/ActionMessage.cpp b/src/fsfw/action/ActionMessage.cpp index 40a516b17..7fc685586 100644 --- a/src/fsfw/action/ActionMessage.cpp +++ b/src/fsfw/action/ActionMessage.cpp @@ -2,9 +2,9 @@ #include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/storagemanager/StorageManagerIF.h" -ActionMessage::ActionMessage() {} +ActionMessage::ActionMessage() = default; -ActionMessage::~ActionMessage() {} +ActionMessage::~ActionMessage() = default; void ActionMessage::setCommand(CommandMessage* message, ActionId_t fid, store_address_t parameters) { @@ -64,9 +64,8 @@ void ActionMessage::clear(CommandMessage* message) { switch (message->getCommand()) { case EXECUTE_ACTION: case DATA_REPLY: { - StorageManagerIF* ipcStore = - ObjectManager::instance()->get(objects::IPC_STORE); - if (ipcStore != NULL) { + auto* ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); + if (ipcStore != nullptr) { ipcStore->deleteData(getStoreId(message)); } break; diff --git a/src/fsfw/action/CommandActionHelper.cpp b/src/fsfw/action/CommandActionHelper.cpp index 19d8e9b89..a06bc44c9 100644 --- a/src/fsfw/action/CommandActionHelper.cpp +++ b/src/fsfw/action/CommandActionHelper.cpp @@ -2,14 +2,14 @@ #include "fsfw/objectmanager/ObjectManager.h" CommandActionHelper::CommandActionHelper(CommandsActionsIF *setOwner) - : owner(setOwner), queueToUse(NULL), ipcStore(NULL), commandCount(0), lastTarget(0) {} + : owner(setOwner), queueToUse(nullptr), ipcStore(nullptr), commandCount(0), lastTarget(0) {} -CommandActionHelper::~CommandActionHelper() {} +CommandActionHelper::~CommandActionHelper() = default; ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId_t actionId, SerializeIF *data) { - HasActionsIF *receiver = ObjectManager::instance()->get(commandTo); - if (receiver == NULL) { + auto *receiver = ObjectManager::instance()->get(commandTo); + if (receiver == nullptr) { return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS; } store_address_t storeId; @@ -29,11 +29,8 @@ ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId_t actionId, const uint8_t *data, uint32_t size) { - // if (commandCount != 0) { - // return CommandsFunctionsIF::ALREADY_COMMANDING; - // } - HasActionsIF *receiver = ObjectManager::instance()->get(commandTo); - if (receiver == NULL) { + auto *receiver = ObjectManager::instance()->get(commandTo); + if (receiver == nullptr) { return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS; } store_address_t storeId; @@ -59,12 +56,12 @@ ReturnValue_t CommandActionHelper::sendCommand(MessageQueueId_t queueId, ActionI ReturnValue_t CommandActionHelper::initialize() { ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); - if (ipcStore == NULL) { + if (ipcStore == nullptr) { return HasReturnvaluesIF::RETURN_FAILED; } queueToUse = owner->getCommandQueuePtr(); - if (queueToUse == NULL) { + if (queueToUse == nullptr) { return HasReturnvaluesIF::RETURN_FAILED; } return HasReturnvaluesIF::RETURN_OK; @@ -104,7 +101,7 @@ ReturnValue_t CommandActionHelper::handleReply(CommandMessage *reply) { uint8_t CommandActionHelper::getCommandCount() const { return commandCount; } void CommandActionHelper::extractDataForOwner(ActionId_t actionId, store_address_t storeId) { - const uint8_t *data = NULL; + const uint8_t *data = nullptr; size_t size = 0; ReturnValue_t result = ipcStore->getData(storeId, &data, &size); if (result != HasReturnvaluesIF::RETURN_OK) { diff --git a/src/fsfw/action/CommandActionHelper.h b/src/fsfw/action/CommandActionHelper.h index dd8ad7f1c..a6ec0ca72 100644 --- a/src/fsfw/action/CommandActionHelper.h +++ b/src/fsfw/action/CommandActionHelper.h @@ -14,14 +14,14 @@ class CommandActionHelper { friend class CommandsActionsIF; public: - CommandActionHelper(CommandsActionsIF* owner); + explicit CommandActionHelper(CommandsActionsIF* owner); virtual ~CommandActionHelper(); ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, const uint8_t* data, uint32_t size); ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, SerializeIF* data); ReturnValue_t initialize(); ReturnValue_t handleReply(CommandMessage* reply); - uint8_t getCommandCount() const; + [[nodiscard]] uint8_t getCommandCount() const; private: CommandsActionsIF* owner; diff --git a/src/fsfw/action/CommandsActionsIF.h b/src/fsfw/action/CommandsActionsIF.h index 5870a9f2a..94d9a7c4e 100644 --- a/src/fsfw/action/CommandsActionsIF.h +++ b/src/fsfw/action/CommandsActionsIF.h @@ -1,9 +1,9 @@ #ifndef FSFW_ACTION_COMMANDSACTIONSIF_H_ #define FSFW_ACTION_COMMANDSACTIONSIF_H_ -#include "../ipc/MessageQueueIF.h" -#include "../returnvalues/HasReturnvaluesIF.h" #include "CommandActionHelper.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" /** * Interface to separate commanding actions of other objects. @@ -21,7 +21,7 @@ class CommandsActionsIF { static const uint8_t INTERFACE_ID = CLASS_ID::COMMANDS_ACTIONS_IF; static const ReturnValue_t OBJECT_HAS_NO_FUNCTIONS = MAKE_RETURN_CODE(1); static const ReturnValue_t ALREADY_COMMANDING = MAKE_RETURN_CODE(2); - virtual ~CommandsActionsIF() {} + virtual ~CommandsActionsIF() = default; virtual MessageQueueIF* getCommandQueuePtr() = 0; protected: diff --git a/src/fsfw/action/HasActionsIF.h b/src/fsfw/action/HasActionsIF.h index acc502d71..89e58adde 100644 --- a/src/fsfw/action/HasActionsIF.h +++ b/src/fsfw/action/HasActionsIF.h @@ -1,11 +1,11 @@ #ifndef FSFW_ACTION_HASACTIONSIF_H_ #define FSFW_ACTION_HASACTIONSIF_H_ -#include "../ipc/MessageQueueIF.h" -#include "../returnvalues/HasReturnvaluesIF.h" #include "ActionHelper.h" #include "ActionMessage.h" #include "SimpleActionHelper.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" /** * @brief @@ -40,12 +40,12 @@ class HasActionsIF { static const ReturnValue_t INVALID_PARAMETERS = MAKE_RETURN_CODE(2); static const ReturnValue_t EXECUTION_FINISHED = MAKE_RETURN_CODE(3); static const ReturnValue_t INVALID_ACTION_ID = MAKE_RETURN_CODE(4); - virtual ~HasActionsIF() {} + virtual ~HasActionsIF() = default; /** * Function to get the MessageQueueId_t of the implementing object * @return MessageQueueId_t of the object */ - virtual MessageQueueId_t getCommandQueue() const = 0; + [[nodiscard]] virtual MessageQueueId_t getCommandQueue() const = 0; /** * Execute or initialize the execution of a certain function. * The ActionHelpers will execute this function and behave differently diff --git a/src/fsfw/action/SimpleActionHelper.cpp b/src/fsfw/action/SimpleActionHelper.cpp index 894f0df6f..fc7e064e8 100644 --- a/src/fsfw/action/SimpleActionHelper.cpp +++ b/src/fsfw/action/SimpleActionHelper.cpp @@ -3,7 +3,7 @@ SimpleActionHelper::SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) : ActionHelper(setOwner, useThisQueue), isExecuting(false) {} -SimpleActionHelper::~SimpleActionHelper() {} +SimpleActionHelper::~SimpleActionHelper() = default; void SimpleActionHelper::step(ReturnValue_t result) { // STEP_OFFESET is subtracted to compensate for adding offset in base @@ -38,7 +38,7 @@ void SimpleActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId ActionMessage::setStepReply(&reply, actionId, 0, HasActionsIF::IS_BUSY); queueToUse->sendMessage(commandedBy, &reply); } - const uint8_t* dataPtr = NULL; + const uint8_t* dataPtr = nullptr; size_t size = 0; ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size); if (result != HasReturnvaluesIF::RETURN_OK) { diff --git a/src/fsfw/action/SimpleActionHelper.h b/src/fsfw/action/SimpleActionHelper.h index 5cb85fbd7..973c7cf2a 100644 --- a/src/fsfw/action/SimpleActionHelper.h +++ b/src/fsfw/action/SimpleActionHelper.h @@ -11,15 +11,15 @@ class SimpleActionHelper : public ActionHelper { public: SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue); - virtual ~SimpleActionHelper(); + ~SimpleActionHelper() override; void step(ReturnValue_t result = HasReturnvaluesIF::RETURN_OK); void finish(ReturnValue_t result = HasReturnvaluesIF::RETURN_OK); ReturnValue_t reportData(SerializeIF* data); protected: void prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId, - store_address_t dataAddress); - virtual void resetHelper(); + store_address_t dataAddress) override; + void resetHelper() override; private: bool isExecuting; @@ -28,4 +28,4 @@ class SimpleActionHelper : public ActionHelper { uint8_t stepCount = 0; }; -#endif /* SIMPLEACTIONHELPER_H_ */ +#endif /* FSFW_ACTION_SIMPLEACTIONHELPER_H_ */ diff --git a/src/fsfw/cfdp/pdu/AckInfo.cpp b/src/fsfw/cfdp/pdu/AckInfo.cpp index f35cfbb12..065d2214b 100644 --- a/src/fsfw/cfdp/pdu/AckInfo.cpp +++ b/src/fsfw/cfdp/pdu/AckInfo.cpp @@ -13,10 +13,12 @@ AckInfo::AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCode ackedC } } +AckInfo::AckInfo() = default; + cfdp::ConditionCode AckInfo::getAckedConditionCode() const { return ackedConditionCode; } -void AckInfo::setAckedConditionCode(cfdp::ConditionCode ackedConditionCode) { - this->ackedConditionCode = ackedConditionCode; +void AckInfo::setAckedConditionCode(cfdp::ConditionCode ackedConditionCode_) { + ackedConditionCode = ackedConditionCode_; if (ackedDirective == cfdp::FileDirectives::FINISH) { this->directiveSubtypeCode = 0b0001; } else { @@ -26,20 +28,18 @@ void AckInfo::setAckedConditionCode(cfdp::ConditionCode ackedConditionCode) { cfdp::FileDirectives AckInfo::getAckedDirective() const { return ackedDirective; } -void AckInfo::setAckedDirective(cfdp::FileDirectives ackedDirective) { - this->ackedDirective = ackedDirective; +void AckInfo::setAckedDirective(cfdp::FileDirectives ackedDirective_) { + ackedDirective = ackedDirective_; } uint8_t AckInfo::getDirectiveSubtypeCode() const { return directiveSubtypeCode; } -void AckInfo::setDirectiveSubtypeCode(uint8_t directiveSubtypeCode) { - this->directiveSubtypeCode = directiveSubtypeCode; +void AckInfo::setDirectiveSubtypeCode(uint8_t directiveSubtypeCode_) { + directiveSubtypeCode = directiveSubtypeCode_; } cfdp::AckTransactionStatus AckInfo::getTransactionStatus() const { return transactionStatus; } -AckInfo::AckInfo() {} - -void AckInfo::setTransactionStatus(cfdp::AckTransactionStatus transactionStatus) { - this->transactionStatus = transactionStatus; +void AckInfo::setTransactionStatus(cfdp::AckTransactionStatus transactionStatus_) { + transactionStatus = transactionStatus_; } diff --git a/src/fsfw/cfdp/pdu/AckInfo.h b/src/fsfw/cfdp/pdu/AckInfo.h index 572fc59fa..1f743f790 100644 --- a/src/fsfw/cfdp/pdu/AckInfo.h +++ b/src/fsfw/cfdp/pdu/AckInfo.h @@ -9,16 +9,16 @@ class AckInfo { AckInfo(cfdp::FileDirectives ackedDirective, cfdp::ConditionCode ackedConditionCode, cfdp::AckTransactionStatus transactionStatus, uint8_t directiveSubtypeCode = 0); - cfdp::ConditionCode getAckedConditionCode() const; - void setAckedConditionCode(cfdp::ConditionCode ackedConditionCode); + [[nodiscard]] cfdp::ConditionCode getAckedConditionCode() const; + void setAckedConditionCode(cfdp::ConditionCode ackedConditionCode_); - cfdp::FileDirectives getAckedDirective() const; + [[nodiscard]] cfdp::FileDirectives getAckedDirective() const; void setAckedDirective(cfdp::FileDirectives ackedDirective); - uint8_t getDirectiveSubtypeCode() const; + [[nodiscard]] uint8_t getDirectiveSubtypeCode() const; void setDirectiveSubtypeCode(uint8_t directiveSubtypeCode); - cfdp::AckTransactionStatus getTransactionStatus() const; + [[nodiscard]] cfdp::AckTransactionStatus getTransactionStatus() const; void setTransactionStatus(cfdp::AckTransactionStatus transactionStatus); private: diff --git a/src/fsfw/cfdp/pdu/AckPduDeserializer.h b/src/fsfw/cfdp/pdu/AckPduDeserializer.h index 0bb95071a..434a66671 100644 --- a/src/fsfw/cfdp/pdu/AckPduDeserializer.h +++ b/src/fsfw/cfdp/pdu/AckPduDeserializer.h @@ -13,7 +13,7 @@ class AckPduDeserializer : public FileDirectiveDeserializer { * @return * - cfdp::INVALID_DIRECTIVE_FIELDS: Invalid fields */ - ReturnValue_t parseData(); + ReturnValue_t parseData() override; private: bool checkAndSetCodes(uint8_t rawAckedByte, uint8_t rawAckedConditionCode); diff --git a/src/fsfw/cfdp/pdu/AckPduSerializer.h b/src/fsfw/cfdp/pdu/AckPduSerializer.h index 68a049e25..0d9534de1 100644 --- a/src/fsfw/cfdp/pdu/AckPduSerializer.h +++ b/src/fsfw/cfdp/pdu/AckPduSerializer.h @@ -18,7 +18,7 @@ class AckPduSerializer : public FileDirectiveSerializer { */ AckPduSerializer(AckInfo& ackInfo, PduConfig& pduConf); - size_t getSerializedSize() const override; + [[nodiscard]] size_t getSerializedSize() const override; ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize, Endianness streamEndianness) const override; diff --git a/src/fsfw/controller/ControllerBase.cpp b/src/fsfw/controller/ControllerBase.cpp index 953dacb46..7a8b6bc41 100644 --- a/src/fsfw/controller/ControllerBase.cpp +++ b/src/fsfw/controller/ControllerBase.cpp @@ -26,7 +26,7 @@ ReturnValue_t ControllerBase::initialize() { MessageQueueId_t parentQueue = 0; if (parentId != objects::NO_OBJECT) { - SubsystemBase* parent = ObjectManager::instance()->get(parentId); + auto* parent = ObjectManager::instance()->get(parentId); if (parent == nullptr) { return RETURN_FAILED; } @@ -52,7 +52,7 @@ MessageQueueId_t ControllerBase::getCommandQueue() const { return commandQueue-> void ControllerBase::handleQueue() { CommandMessage command; - ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + ReturnValue_t result; for (result = commandQueue->receiveMessage(&command); result == RETURN_OK; result = commandQueue->receiveMessage(&command)) { result = modeHelper.handleModeCommand(&command); @@ -73,20 +73,20 @@ void ControllerBase::handleQueue() { } } -void ControllerBase::startTransition(Mode_t mode, Submode_t submode) { +void ControllerBase::startTransition(Mode_t mode_, Submode_t submode_) { changeHK(this->mode, this->submode, false); triggerEvent(CHANGING_MODE, mode, submode); - this->mode = mode; - this->submode = submode; + mode = mode_; + submode = submode_; modeHelper.modeChanged(mode, submode); modeChanged(mode, submode); announceMode(false); changeHK(this->mode, this->submode, true); } -void ControllerBase::getMode(Mode_t* mode, Submode_t* submode) { - *mode = this->mode; - *submode = this->submode; +void ControllerBase::getMode(Mode_t* mode_, Submode_t* submode_) { + *mode_ = this->mode; + *submode_ = this->submode; } void ControllerBase::setToExternalControl() { healthHelper.setHealth(EXTERNAL_CONTROL); } @@ -99,7 +99,7 @@ ReturnValue_t ControllerBase::performOperation(uint8_t opCode) { return RETURN_OK; } -void ControllerBase::modeChanged(Mode_t mode, Submode_t submode) { return; } +void ControllerBase::modeChanged(Mode_t mode_, Submode_t submode_) {} ReturnValue_t ControllerBase::setHealth(HealthState health) { switch (health) { @@ -115,6 +115,6 @@ ReturnValue_t ControllerBase::setHealth(HealthState health) { HasHealthIF::HealthState ControllerBase::getHealth() { return healthHelper.getHealth(); } void ControllerBase::setTaskIF(PeriodicTaskIF* task_) { executingTask = task_; } -void ControllerBase::changeHK(Mode_t mode, Submode_t submode, bool enable) {} +void ControllerBase::changeHK(Mode_t mode_, Submode_t submode_, bool enable) {} ReturnValue_t ControllerBase::initializeAfterTaskCreation() { return HasReturnvaluesIF::RETURN_OK; } diff --git a/src/fsfw/controller/ControllerBase.h b/src/fsfw/controller/ControllerBase.h index 52cc46fd2..550659b82 100644 --- a/src/fsfw/controller/ControllerBase.h +++ b/src/fsfw/controller/ControllerBase.h @@ -24,21 +24,21 @@ class ControllerBase : public HasModesIF, static const Mode_t MODE_NORMAL = 2; ControllerBase(object_id_t setObjectId, object_id_t parentId, size_t commandQueueDepth = 3); - virtual ~ControllerBase(); + ~ControllerBase() override; /** SystemObject override */ - virtual ReturnValue_t initialize() override; + ReturnValue_t initialize() override; - virtual MessageQueueId_t getCommandQueue() const override; + [[nodiscard]] MessageQueueId_t getCommandQueue() const override; /** HasHealthIF overrides */ - virtual ReturnValue_t setHealth(HealthState health) override; - virtual HasHealthIF::HealthState getHealth() override; + ReturnValue_t setHealth(HealthState health) override; + HasHealthIF::HealthState getHealth() override; /** ExecutableObjectIF overrides */ - virtual ReturnValue_t performOperation(uint8_t opCode) override; - virtual void setTaskIF(PeriodicTaskIF *task) override; - virtual ReturnValue_t initializeAfterTaskCreation() override; + ReturnValue_t performOperation(uint8_t opCode) override; + void setTaskIF(PeriodicTaskIF *task) override; + ReturnValue_t initializeAfterTaskCreation() override; protected: /** @@ -54,8 +54,8 @@ class ControllerBase : public HasModesIF, */ virtual void performControlOperation() = 0; - virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, - uint32_t *msToReachTheMode) override = 0; + ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, + uint32_t *msToReachTheMode) override = 0; const object_id_t parentId; diff --git a/src/fsfw/controller/ExtendedControllerBase.cpp b/src/fsfw/controller/ExtendedControllerBase.cpp index 0dfd9dc7c..64b39a315 100644 --- a/src/fsfw/controller/ExtendedControllerBase.cpp +++ b/src/fsfw/controller/ExtendedControllerBase.cpp @@ -6,7 +6,7 @@ ExtendedControllerBase::ExtendedControllerBase(object_id_t objectId, object_id_t poolManager(this, commandQueue), actionHelper(this, commandQueue) {} -ExtendedControllerBase::~ExtendedControllerBase() {} +ExtendedControllerBase::~ExtendedControllerBase() = default; ReturnValue_t ExtendedControllerBase::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, @@ -31,7 +31,7 @@ ReturnValue_t ExtendedControllerBase::handleCommandMessage(CommandMessage *messa void ExtendedControllerBase::handleQueue() { CommandMessage command; - ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + ReturnValue_t result; for (result = commandQueue->receiveMessage(&command); result == RETURN_OK; result = commandQueue->receiveMessage(&command)) { result = actionHelper.handleActionMessage(&command); diff --git a/src/fsfw/controller/ExtendedControllerBase.h b/src/fsfw/controller/ExtendedControllerBase.h index ae2219fd4..b5583a880 100644 --- a/src/fsfw/controller/ExtendedControllerBase.h +++ b/src/fsfw/controller/ExtendedControllerBase.h @@ -18,16 +18,16 @@ class ExtendedControllerBase : public ControllerBase, public HasLocalDataPoolIF { public: ExtendedControllerBase(object_id_t objectId, object_id_t parentId, size_t commandQueueDepth = 3); - virtual ~ExtendedControllerBase(); + ~ExtendedControllerBase() override; /* SystemObjectIF overrides */ - virtual ReturnValue_t initialize() override; + ReturnValue_t initialize() override; - virtual MessageQueueId_t getCommandQueue() const override; + [[nodiscard]] MessageQueueId_t getCommandQueue() const override; /* ExecutableObjectIF overrides */ - virtual ReturnValue_t performOperation(uint8_t opCode) override; - virtual ReturnValue_t initializeAfterTaskCreation() override; + ReturnValue_t performOperation(uint8_t opCode) override; + ReturnValue_t initializeAfterTaskCreation() override; protected: LocalDataPoolManager poolManager; @@ -39,32 +39,32 @@ class ExtendedControllerBase : public ControllerBase, * @param message * @return */ - virtual ReturnValue_t handleCommandMessage(CommandMessage* message) override = 0; + ReturnValue_t handleCommandMessage(CommandMessage* message) override = 0; /** * Periodic helper from ControllerBase, implemented by child class. */ - virtual void performControlOperation() override = 0; + void performControlOperation() override = 0; /* Handle the four messages mentioned above */ void handleQueue() override; /* HasActionsIF overrides */ - virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, - const uint8_t* data, size_t size) override; + ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, + const uint8_t* data, size_t size) override; /* HasLocalDatapoolIF overrides */ - virtual LocalDataPoolManager* getHkManagerHandle() override; - virtual object_id_t getObjectId() const override; - virtual uint32_t getPeriodicOperationFrequency() const override; + LocalDataPoolManager* getHkManagerHandle() override; + [[nodiscard]] object_id_t getObjectId() const override; + [[nodiscard]] uint32_t getPeriodicOperationFrequency() const override; - virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, - LocalDataPoolManager& poolManager) override = 0; - virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override = 0; + ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) override = 0; + LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override = 0; // Mode abstract functions - virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, - uint32_t* msToReachTheMode) override = 0; + ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, + uint32_t* msToReachTheMode) override = 0; }; #endif /* FSFW_CONTROLLER_EXTENDEDCONTROLLERBASE_H_ */ diff --git a/src/fsfw/datapool/DataSetIF.h b/src/fsfw/datapool/DataSetIF.h index 492bcf29a..89970a44d 100644 --- a/src/fsfw/datapool/DataSetIF.h +++ b/src/fsfw/datapool/DataSetIF.h @@ -30,7 +30,7 @@ class DataSetIF { * @brief This is an empty virtual destructor, * as it is proposed for C++ interfaces. */ - virtual ~DataSetIF() {} + virtual ~DataSetIF() = default; /** * @brief This operation provides a method to register local data pool @@ -39,7 +39,7 @@ class DataSetIF { */ virtual ReturnValue_t registerVariable(PoolVariableIF* variable) = 0; - virtual uint16_t getFillCount() const = 0; + [[nodiscard]] virtual uint16_t getFillCount() const = 0; }; #endif /* FSFW_DATAPOOL_DATASETIF_H_ */ diff --git a/src/fsfw/datapool/PoolDataSetBase.cpp b/src/fsfw/datapool/PoolDataSetBase.cpp index b31f4725e..a9ad9cfae 100644 --- a/src/fsfw/datapool/PoolDataSetBase.cpp +++ b/src/fsfw/datapool/PoolDataSetBase.cpp @@ -9,7 +9,7 @@ PoolDataSetBase::PoolDataSetBase(PoolVariableIF** registeredVariablesArray, const size_t maxFillCount) : registeredVariables(registeredVariablesArray), maxFillCount(maxFillCount) {} -PoolDataSetBase::~PoolDataSetBase() {} +PoolDataSetBase::~PoolDataSetBase() = default; ReturnValue_t PoolDataSetBase::registerVariable(PoolVariableIF* variable) { if (registeredVariables == nullptr) { diff --git a/src/fsfw/datapool/PoolDataSetBase.h b/src/fsfw/datapool/PoolDataSetBase.h index dc6ec135a..a643d8d51 100644 --- a/src/fsfw/datapool/PoolDataSetBase.h +++ b/src/fsfw/datapool/PoolDataSetBase.h @@ -64,8 +64,8 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF, public HasRetu * - @c SET_WAS_ALREADY_READ if read() is called twice without calling * commit() in between */ - virtual ReturnValue_t read(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING, - uint32_t lockTimeout = 20) override; + ReturnValue_t read(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING, + uint32_t lockTimeout = 20) override; /** * @brief The commit call initializes writing back the registered variables. * @details @@ -84,39 +84,38 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF, public HasRetu * - @c COMMITING_WITHOUT_READING if set was not read yet and * contains non write-only variables */ - virtual ReturnValue_t commit(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING, - uint32_t lockTimeout = 20) override; + ReturnValue_t commit(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING, + uint32_t lockTimeout = 20) override; /** * Register the passed pool variable instance into the data set. * @param variable * @return */ - virtual ReturnValue_t registerVariable(PoolVariableIF* variable) override; + ReturnValue_t registerVariable(PoolVariableIF* variable) override; /** * Provides the means to lock the underlying data structure to ensure * thread-safety. Default implementation is empty * @return Always returns -@c RETURN_OK */ - virtual ReturnValue_t lockDataPool( - MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING, - uint32_t timeoutMs = 20) override; + ReturnValue_t lockDataPool(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING, + uint32_t timeoutMs = 20) override; /** * Provides the means to unlock the underlying data structure to ensure * thread-safety. Default implementation is empty * @return Always returns -@c RETURN_OK */ - virtual ReturnValue_t unlockDataPool() override; + ReturnValue_t unlockDataPool() override; - virtual uint16_t getFillCount() const override; + [[nodiscard]] uint16_t getFillCount() const override; /* SerializeIF implementations */ - virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size, const size_t maxSize, - SerializeIF::Endianness streamEndianness) const override; - virtual size_t getSerializedSize() const override; - virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, - SerializeIF::Endianness streamEndianness) override; + ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize, + SerializeIF::Endianness streamEndianness) const override; + [[nodiscard]] size_t getSerializedSize() const override; + ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, + SerializeIF::Endianness streamEndianness) override; /** * Can be used to individually protect every read and commit call. @@ -156,7 +155,7 @@ class PoolDataSetBase : public PoolDataSetIF, public SerializeIF, public HasRetu const size_t maxFillCount = 0; void setContainer(PoolVariableIF** variablesContainer); - PoolVariableIF** getContainer() const; + [[nodiscard]] PoolVariableIF** getContainer() const; private: bool protectEveryReadCommitCall = false; diff --git a/src/fsfw/datapool/PoolEntry.cpp b/src/fsfw/datapool/PoolEntry.cpp index fd110e6c7..3c2b5db24 100644 --- a/src/fsfw/datapool/PoolEntry.cpp +++ b/src/fsfw/datapool/PoolEntry.cpp @@ -11,7 +11,7 @@ PoolEntry::PoolEntry(std::initializer_list initValue, bool setValid) : length(static_cast(initValue.size())), valid(setValid) { this->address = new T[this->length]; if (initValue.size() == 0) { - std::memset(this->address, 0, this->getByteSize()); + std::memset(this->address, 0, PoolEntry::getByteSize()); } else { std::copy(initValue.begin(), initValue.end(), this->address); } @@ -22,9 +22,9 @@ PoolEntry::PoolEntry(T* initValue, uint8_t setLength, bool setValid) : length(setLength), valid(setValid) { this->address = new T[this->length]; if (initValue != nullptr) { - std::memcpy(this->address, initValue, this->getByteSize()); + std::memcpy(this->address, initValue, PoolEntry::getByteSize()); } else { - std::memset(this->address, 0, this->getByteSize()); + std::memset(this->address, 0, PoolEntry::getByteSize()); } } @@ -62,7 +62,7 @@ bool PoolEntry::getValid() { template void PoolEntry::print() { - const char* validString = nullptr; + const char* validString; if (valid) { validString = "Valid"; } else { diff --git a/src/fsfw/datapool/PoolEntry.h b/src/fsfw/datapool/PoolEntry.h index d3d80f093..d7b408949 100644 --- a/src/fsfw/datapool/PoolEntry.h +++ b/src/fsfw/datapool/PoolEntry.h @@ -62,7 +62,7 @@ class PoolEntry : public PoolEntryIF { * @param setValid * Sets the initialization flag. It is invalid by default. */ - PoolEntry(T* initValue, uint8_t setLength = 1, bool setValid = false); + explicit PoolEntry(T* initValue, uint8_t setLength = 1, bool setValid = false); //! Explicitely deleted copy ctor, copying is not allowed. PoolEntry(const PoolEntry&) = delete; @@ -77,7 +77,7 @@ class PoolEntry : public PoolEntryIF { * PoolEntries shall never be copied, as a copy might delete the variable * on the heap. */ - ~PoolEntry(); + ~PoolEntry() override; /** * Return typed pointer to start of data. @@ -91,32 +91,32 @@ class PoolEntry : public PoolEntryIF { * For non-array pool entries return type size, for vector entries * return type size times the number of entries. */ - uint8_t getSize(); + uint8_t getSize() override; /** * @brief This operation returns the size in bytes. * @details The size is calculated by sizeof(type) * array_size. */ - uint16_t getByteSize(); + uint16_t getByteSize() override; /** * @brief This operation returns a the address pointer casted to void*. */ - void* getRawData(); + void* getRawData() override; /** * @brief This method allows to set the valid information * of the pool entry. */ - void setValid(bool isValid); + void setValid(bool isValid) override; /** * @brief This method allows to get the valid information * of the pool entry. */ - bool getValid(); + bool getValid() override; /** * @brief This is a debug method that prints all values and the valid * information to the screen. It prints all array entries in a row. */ - void print(); - Type getType(); + void print() override; + Type getType() override; private: /** diff --git a/src/fsfw/datapool/PoolEntryIF.h b/src/fsfw/datapool/PoolEntryIF.h index 99fd80243..6399ec691 100644 --- a/src/fsfw/datapool/PoolEntryIF.h +++ b/src/fsfw/datapool/PoolEntryIF.h @@ -24,7 +24,7 @@ class PoolEntryIF { * @brief This is an empty virtual destructor, * as it is required for C++ interfaces. */ - virtual ~PoolEntryIF() {} + virtual ~PoolEntryIF() = default; /** * @brief getSize returns the array size of the entry. * A single variable parameter has size 1. diff --git a/src/fsfw/datapool/PoolReadGuard.h b/src/fsfw/datapool/PoolReadGuard.h index 24d989330..8d9b91abe 100644 --- a/src/fsfw/datapool/PoolReadGuard.h +++ b/src/fsfw/datapool/PoolReadGuard.h @@ -11,9 +11,9 @@ */ class PoolReadGuard { public: - PoolReadGuard(ReadCommitIF* readObject, - MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING, - uint32_t mutexTimeout = 20) + explicit PoolReadGuard(ReadCommitIF* readObject, + MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING, + uint32_t mutexTimeout = 20) : readObject(readObject), mutexTimeout(mutexTimeout) { if (readObject != nullptr) { readResult = readObject->read(timeoutType, mutexTimeout); @@ -29,7 +29,7 @@ class PoolReadGuard { } } - ReturnValue_t getReadResult() const { return readResult; } + [[nodiscard]] ReturnValue_t getReadResult() const { return readResult; } /** * @brief Can be used to suppress commit on destruction. diff --git a/src/fsfw/datapool/PoolVarList.h b/src/fsfw/datapool/PoolVarList.h deleted file mode 100644 index 8d4df8c7b..000000000 --- a/src/fsfw/datapool/PoolVarList.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef FSFW_DATAPOOL_POOLVARLIST_H_ -#define FSFW_DATAPOOL_POOLVARLIST_H_ - -#include "../datapool/PoolVariableIF.h" -#include "../datapoolglob/GlobalPoolVariable.h" -template -class PoolVarList { - private: - GlobPoolVar variables[n_var]; - - public: - PoolVarList(const uint32_t set_id[n_var], DataSetIF* dataSet, - PoolVariableIF::ReadWriteMode_t setReadWriteMode) { - // I really should have a look at the new init list c++ syntax. - if (dataSet == NULL) { - return; - } - for (uint8_t count = 0; count < n_var; count++) { - variables[count].dataPoolId = set_id[count]; - variables[count].readWriteMode = setReadWriteMode; - dataSet->registerVariable(&variables[count]); - } - } - - GlobPoolVar& operator[](int i) { return variables[i]; } -}; - -#endif /* FSFW_DATAPOOL_POOLVARLIST_H_ */ diff --git a/src/fsfw/datapool/PoolVariableIF.h b/src/fsfw/datapool/PoolVariableIF.h index 95cf898ea..1201a3e7b 100644 --- a/src/fsfw/datapool/PoolVariableIF.h +++ b/src/fsfw/datapool/PoolVariableIF.h @@ -24,8 +24,8 @@ class PoolVariableIF : public SerializeIF, public ReadCommitIF { static constexpr ReturnValue_t INVALID_READ_WRITE_MODE = MAKE_RETURN_CODE(0xA0); static constexpr ReturnValue_t INVALID_POOL_ENTRY = MAKE_RETURN_CODE(0xA1); - static constexpr bool VALID = 1; - static constexpr bool INVALID = 0; + static constexpr bool VALID = true; + static constexpr bool INVALID = false; static constexpr uint32_t NO_PARAMETER = 0xffffffff; enum ReadWriteMode_t { VAR_READ, VAR_WRITE, VAR_READ_WRITE }; @@ -34,23 +34,23 @@ class PoolVariableIF : public SerializeIF, public ReadCommitIF { * @brief This is an empty virtual destructor, * as it is proposed for C++ interfaces. */ - virtual ~PoolVariableIF() {} + ~PoolVariableIF() override = default; /** * @brief This method returns if the variable is write-only, * read-write or read-only. */ - virtual ReadWriteMode_t getReadWriteMode() const = 0; + [[nodiscard]] virtual ReadWriteMode_t getReadWriteMode() const = 0; virtual void setReadWriteMode(ReadWriteMode_t newMode) = 0; /** * @brief This operation shall return the data pool id of the variable. */ - virtual uint32_t getDataPoolId() const = 0; + [[nodiscard]] virtual uint32_t getDataPoolId() const = 0; /** * @brief With this call, the valid information of the * variable is returned. */ - virtual bool isValid() const = 0; + [[nodiscard]] virtual bool isValid() const = 0; /** * @brief With this call, the valid information of the variable is set. */ diff --git a/src/fsfw/datapool/ReadCommitIF.h b/src/fsfw/datapool/ReadCommitIF.h index 08554be10..c154bd658 100644 --- a/src/fsfw/datapool/ReadCommitIF.h +++ b/src/fsfw/datapool/ReadCommitIF.h @@ -12,7 +12,7 @@ class ReadCommitIF { friend class ReadCommitIFAttorney; public: - virtual ~ReadCommitIF() {} + virtual ~ReadCommitIF() = default; virtual ReturnValue_t read(MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) = 0; virtual ReturnValue_t commit(MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) = 0; diff --git a/src/fsfw/datapool/SharedDataSetIF.h b/src/fsfw/datapool/SharedDataSetIF.h index fc3ddcd8a..ce05a965f 100644 --- a/src/fsfw/datapool/SharedDataSetIF.h +++ b/src/fsfw/datapool/SharedDataSetIF.h @@ -5,7 +5,7 @@ class SharedDataSetIF { public: - virtual ~SharedDataSetIF(){}; + virtual ~SharedDataSetIF() = default; private: virtual ReturnValue_t lockDataset(MutexIF::TimeoutType timeoutType, diff --git a/src/fsfw/datapoollocal/AccessLocalPoolF.h b/src/fsfw/datapoollocal/AccessLocalPoolF.h index 4290336ad..4b758cab4 100644 --- a/src/fsfw/datapoollocal/AccessLocalPoolF.h +++ b/src/fsfw/datapoollocal/AccessLocalPoolF.h @@ -9,7 +9,8 @@ class MutexIF; */ class AccessPoolManagerIF { public: - virtual ~AccessPoolManagerIF(){}; + virtual ~AccessPoolManagerIF() = default; + ; virtual MutexIF* getLocalPoolMutex() = 0; diff --git a/src/fsfw/datapoollocal/HasLocalDataPoolIF.h b/src/fsfw/datapoollocal/HasLocalDataPoolIF.h index a2925a46e..4933c6b3f 100644 --- a/src/fsfw/datapoollocal/HasLocalDataPoolIF.h +++ b/src/fsfw/datapoollocal/HasLocalDataPoolIF.h @@ -44,14 +44,15 @@ class HasLocalDataPoolIF { friend class HasLocalDpIFUserAttorney; public: - virtual ~HasLocalDataPoolIF(){}; + virtual ~HasLocalDataPoolIF() = default; + ; static constexpr uint32_t INVALID_LPID = localpool::INVALID_LPID; - virtual object_id_t getObjectId() const = 0; + [[nodiscard]] virtual object_id_t getObjectId() const = 0; /** Command queue for housekeeping messages. */ - virtual MessageQueueId_t getCommandQueue() const = 0; + [[nodiscard]] virtual MessageQueueId_t getCommandQueue() const = 0; /** * Is used by pool owner to initialize the pool map once @@ -66,7 +67,7 @@ class HasLocalDataPoolIF { * usually be the period the pool owner performs its periodic operation. * @return */ - virtual dur_millis_t getPeriodicOperationFrequency() const = 0; + [[nodiscard]] virtual dur_millis_t getPeriodicOperationFrequency() const = 0; /** * @brief This function will be called by the manager if an update diff --git a/src/fsfw/datapoollocal/LocalDataPoolManager.cpp b/src/fsfw/datapoollocal/LocalDataPoolManager.cpp index 215d1753a..c7856d4cf 100644 --- a/src/fsfw/datapoollocal/LocalDataPoolManager.cpp +++ b/src/fsfw/datapoollocal/LocalDataPoolManager.cpp @@ -1,6 +1,5 @@ #include "fsfw/datapoollocal/LocalDataPoolManager.h" -#include #include #include "fsfw/datapoollocal.h" @@ -57,7 +56,7 @@ ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) { } if (defaultHkDestination != objects::NO_OBJECT) { - AcceptsHkPacketsIF* hkPacketReceiver = + auto* hkPacketReceiver = ObjectManager::instance()->get(defaultHkDestination); if (hkPacketReceiver != nullptr) { hkDestinationId = hkPacketReceiver->getHkQueue(); @@ -209,9 +208,9 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei } /* Prepare and send update snapshot */ - timeval now; + timeval now{}; Clock::getClock_timeval(&now); - CCSDSTime::CDS_short cds; + CCSDSTime::CDS_short cds{}; CCSDSTime::convertToCcsds(&cds, &now); HousekeepingSnapshot updatePacket( reinterpret_cast(&cds), sizeof(cds), @@ -245,9 +244,9 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei } /* Prepare and send update snapshot */ - timeval now; + timeval now{}; Clock::getClock_timeval(&now); - CCSDSTime::CDS_short cds; + CCSDSTime::CDS_short cds{}; CCSDSTime::convertToCcsds(&cds, &now); HousekeepingSnapshot updatePacket( reinterpret_cast(&cds), sizeof(cds), @@ -339,8 +338,7 @@ ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid, bool e float collectionInterval, bool isDiagnostics, object_id_t packetDestination) { - AcceptsHkPacketsIF* hkReceiverObject = - ObjectManager::instance()->get(packetDestination); + auto* hkReceiverObject = ObjectManager::instance()->get(packetDestination); if (hkReceiverObject == nullptr) { printWarningOrError(sif::OutputTypes::OUT_WARNING, "subscribeForPeriodicPacket", QUEUE_OR_DESTINATION_INVALID); @@ -368,8 +366,7 @@ ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid, bool e ReturnValue_t LocalDataPoolManager::subscribeForUpdatePacket(sid_t sid, bool isDiagnostics, bool reportingEnabled, object_id_t packetDestination) { - AcceptsHkPacketsIF* hkReceiverObject = - ObjectManager::instance()->get(packetDestination); + auto* hkReceiverObject = ObjectManager::instance()->get(packetDestination); if (hkReceiverObject == nullptr) { printWarningOrError(sif::OutputTypes::OUT_WARNING, "subscribeForPeriodicPacket", QUEUE_OR_DESTINATION_INVALID); @@ -696,7 +693,8 @@ void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) { if (result != HasReturnvaluesIF::RETURN_OK) { /* Configuration error */ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "LocalDataPoolManager::performPeriodicHkOperation: HK generation failed." << std::endl; + sif::warning << "LocalDataPoolManager::performPeriodicHkOperation: HK generation failed." + << std::endl; #else sif::printWarning("LocalDataPoolManager::performPeriodicHkOperation: HK generation failed.\n"); #endif diff --git a/src/fsfw/datapoollocal/LocalDataPoolManager.h b/src/fsfw/datapoollocal/LocalDataPoolManager.h index e7ec0b6fa..a8b488e2f 100644 --- a/src/fsfw/datapoollocal/LocalDataPoolManager.h +++ b/src/fsfw/datapoollocal/LocalDataPoolManager.h @@ -80,7 +80,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces */ LocalDataPoolManager(HasLocalDataPoolIF* owner, MessageQueueIF* queueToUse, bool appendValidityBuffer = true); - virtual ~LocalDataPoolManager(); + ~LocalDataPoolManager() override; /** * Assigns the queue to use. Make sure to call this in the #initialize @@ -151,7 +151,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces * Otherwise, only an notification message is sent. * @return */ - ReturnValue_t subscribeForSetUpdateMessage(const uint32_t setId, object_id_t destinationObject, + ReturnValue_t subscribeForSetUpdateMessage(uint32_t setId, object_id_t destinationObject, MessageQueueId_t targetQueueId, bool generateSnapshot) override; @@ -169,7 +169,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces * Otherwise, only an notification message is sent. * @return */ - ReturnValue_t subscribeForVariableUpdateMessage(const lp_id_t localPoolId, + ReturnValue_t subscribeForVariableUpdateMessage(lp_id_t localPoolId, object_id_t destinationObject, MessageQueueId_t targetQueueId, bool generateSnapshot) override; @@ -252,7 +252,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces */ void clearReceiversList(); - object_id_t getCreatorObjectId() const; + [[nodiscard]] object_id_t getCreatorObjectId() const; /** * Get the pointer to the mutex. Can be used to lock the data pool @@ -262,7 +262,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces */ MutexIF* getMutexHandle(); - virtual LocalDataPoolManager* getPoolManagerHandle() override; + LocalDataPoolManager* getPoolManagerHandle() override; protected: /** Core data structure for the actual pool data */ @@ -306,8 +306,8 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces struct HkUpdateResetHelper { DataType dataType = DataType::DATA_SET; DataId dataId; - uint8_t updateCounter; - uint8_t currentUpdateCounter; + uint8_t updateCounter{}; + uint8_t currentUpdateCounter{}; }; using HkUpdateResetList = std::vector; diff --git a/src/fsfw/osal/linux/FixedTimeslotTask.cpp b/src/fsfw/osal/linux/FixedTimeslotTask.cpp index 775acea88..156413eac 100644 --- a/src/fsfw/osal/linux/FixedTimeslotTask.cpp +++ b/src/fsfw/osal/linux/FixedTimeslotTask.cpp @@ -54,7 +54,7 @@ ReturnValue_t FixedTimeslotTask::sleepFor(uint32_t ms) { // If the deadline was missed, the deadlineMissedFunc is called. if (!PosixThread::delayUntil(&lastWakeTime, interval)) { // No time left on timer -> we missed the deadline - if(dlmFunc != nullptr){ + if (dlmFunc != nullptr) { dlmFunc(); } } diff --git a/src/fsfw/serialize/SerializeIF.h b/src/fsfw/serialize/SerializeIF.h index d806c1615..64deb467f 100644 --- a/src/fsfw/serialize/SerializeIF.h +++ b/src/fsfw/serialize/SerializeIF.h @@ -34,7 +34,7 @@ class SerializeIF { static const ReturnValue_t TOO_MANY_ELEMENTS = MAKE_RETURN_CODE(3); // !< There are too many elements to be deserialized - virtual ~SerializeIF() {} + virtual ~SerializeIF() = default; /** * @brief * Function to serialize the object into a buffer with maxSize. Size represents the written @@ -66,7 +66,7 @@ class SerializeIF { * Gets the size of a object if it would be serialized in a buffer * @return Size of serialized object */ - virtual size_t getSerializedSize() const = 0; + [[nodiscard]] virtual size_t getSerializedSize() const = 0; /** * @brief diff --git a/tests/src/fsfw_tests/unit/hal/testCommandExecutor.cpp b/tests/src/fsfw_tests/unit/hal/testCommandExecutor.cpp index 09d312801..d34f67aae 100644 --- a/tests/src/fsfw_tests/unit/hal/testCommandExecutor.cpp +++ b/tests/src/fsfw_tests/unit/hal/testCommandExecutor.cpp @@ -4,12 +4,12 @@ #include #include -#include "tests/TestsConfig.h" #include "fsfw/container/DynamicFIFO.h" #include "fsfw/container/SimpleRingBuffer.h" #include "fsfw/platform.h" #include "fsfw/serviceinterface.h" #include "fsfw_hal/linux/CommandExecutor.h" +#include "tests/TestsConfig.h" #ifdef PLATFORM_UNIX diff --git a/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp b/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp index 9631de385..7b90c86e9 100644 --- a/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp +++ b/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp @@ -157,7 +157,7 @@ TEST_CASE("New Accessor", "[NewAccessor]") { } } - SECTION("Operators"){ + SECTION("Operators") { result = SimplePool.addData(&testStoreId, testDataArray.data(), size); REQUIRE(result == retval::CATCH_OK); { @@ -173,13 +173,13 @@ TEST_CASE("New Accessor", "[NewAccessor]") { REQUIRE(result == HasReturnvaluesIF::RETURN_OK); CHECK(accessor2.getId() == testStoreId); CHECK(accessor2.size() == 10); - + std::array newData; // Expect data to be invalid so this must return RETURN_FAILED - result = accessor.getDataCopy(newData.data(),newData.size()); + result = accessor.getDataCopy(newData.data(), newData.size()); REQUIRE(result == HasReturnvaluesIF::RETURN_FAILED); - // Expect data to be too small - result = accessor2.getDataCopy(data.data(),data.size()); + // Expect data to be too small + result = accessor2.getDataCopy(data.data(), data.size()); REQUIRE(result == HasReturnvaluesIF::RETURN_FAILED); } } diff --git a/tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp b/tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp index ce1f85181..51130047b 100644 --- a/tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp +++ b/tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp @@ -1,9 +1,9 @@ #include #include +#include #include #include -#include #include "fsfw_tests/unit/CatchDefinitions.h"