a lot of clang improvements

This commit is contained in:
Robin Müller 2022-05-02 10:43:04 +02:00
parent fea301bcc9
commit b904d33cfe
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
26 changed files with 101 additions and 107 deletions

View File

@ -17,8 +17,6 @@ MgmLIS3MDLHandler::MgmLIS3MDLHandler(object_id_t objectId, object_id_t deviceCom
registers[4] = MGMLIS3MDL::CTRL_REG5_DEFAULT;
}
MgmLIS3MDLHandler::~MgmLIS3MDLHandler() {}
void MgmLIS3MDLHandler::doStartUp() {
switch (internalState) {
case (InternalState::STATE_NONE): {
@ -90,7 +88,7 @@ ReturnValue_t MgmLIS3MDLHandler::buildTransitionDeviceCommand(DeviceCommandId_t
uint8_t MgmLIS3MDLHandler::readCommand(uint8_t command, bool continuousCom) {
command |= (1 << MGMLIS3MDL::RW_BIT);
if (continuousCom == true) {
if (continuousCom) {
command |= (1 << MGMLIS3MDL::MS_BIT);
}
return command;
@ -98,7 +96,7 @@ uint8_t MgmLIS3MDLHandler::readCommand(uint8_t command, bool continuousCom) {
uint8_t MgmLIS3MDLHandler::writeCommand(uint8_t command, bool continuousCom) {
command &= ~(1 << MGMLIS3MDL::RW_BIT);
if (continuousCom == true) {
if (continuousCom) {
command |= (1 << MGMLIS3MDL::MS_BIT);
}
return command;

View File

@ -28,7 +28,7 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
MgmLIS3MDLHandler(uint32_t objectId, object_id_t deviceCommunication, CookieIF *comCookie,
uint32_t transitionDelay);
virtual ~MgmLIS3MDLHandler();
~MgmLIS3MDLHandler() override = default;
void enablePeriodicPrintouts(bool enable, uint8_t divider);
/**
@ -46,7 +46,7 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
void doShutDown() override;
void doStartUp() override;
void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override;
virtual uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override;
uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override;
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData,
size_t commandDataLen) override;
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
@ -60,9 +60,9 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
* @param packet
* @return
*/
virtual ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
void fillCommandAndReplyMap() override;
void modeChanged(void) override;
void modeChanged() override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) override;
@ -72,8 +72,6 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
static const uint8_t SINGLE_COMMAND_ANSWER_LEN = 2;
uint32_t transitionDelay;
// Single SPI command has 2 bytes, first for adress, second for content
size_t singleComandSize = 2;
// Has the size for all adresses of the lis3mdl + the continous write bit
uint8_t commandBuffer[MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1];
@ -88,7 +86,6 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
*/
uint8_t registers[MGMLIS3MDL::NR_OF_CTRL_REGISTERS];
uint8_t statusRegister = 0;
bool goToNormalMode = false;
enum class InternalState {
@ -111,14 +108,14 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
* @param single command to set the read-bit at
* @param boolean to select a continuous read bit, default = false
*/
uint8_t readCommand(uint8_t command, bool continuousCom = false);
static uint8_t readCommand(uint8_t command, bool continuousCom = false);
/**
* Sets the write bit for the command
* @param single command to set the write-bit at
* @param boolean to select a continuous write bit, default = false
*/
uint8_t writeCommand(uint8_t command, bool continuousCom = false);
static uint8_t writeCommand(uint8_t command, bool continuousCom = false);
/**
* This Method gets the full scale for the measurement range

View File

@ -329,9 +329,9 @@ ReturnValue_t MgmRM3100Handler::handleDataReadout(const uint8_t *packet) {
int32_t fieldStrengthRawZ = ((packet[7] << 24) | (packet[8] << 16) | (packet[3] << 8)) >> 8;
// Now scale to physical value in microtesla
float fieldStrengthX = fieldStrengthRawX * scaleFactorX;
float fieldStrengthY = fieldStrengthRawY * scaleFactorX;
float fieldStrengthZ = fieldStrengthRawZ * scaleFactorX;
float fieldStrengthX = static_cast<float>(fieldStrengthRawX) * scaleFactorX;
float fieldStrengthY = static_cast<float>(fieldStrengthRawY) * scaleFactorY;
float fieldStrengthZ = static_cast<float>(fieldStrengthRawZ) * scaleFactorZ;
if (periodicPrintout) {
if (debugDivider.checkAndIncrement()) {

View File

@ -72,7 +72,6 @@ class MgmRM3100Handler : public DeviceHandlerBase {
RM3100::Rm3100PrimaryDataset primaryDataset;
uint8_t commandBuffer[10];
uint8_t commandBufferLen = 0;
uint8_t cmmRegValue = RM3100::CMM_VALUE;
uint8_t tmrcRegValue = RM3100::TMRC_DEFAULT_VALUE;
@ -100,4 +99,4 @@ class MgmRM3100Handler : public DeviceHandlerBase {
PeriodicOperationDivider debugDivider = PeriodicOperationDivider(3);
};
#endif /* MISSION_DEVICEHANDLING_MGMRM3100HANDLER_H_ */
#endif /* MISSION_DEVICES_MGMRM3100HANDLER_H_ */

View File

@ -314,7 +314,7 @@ void UartComIF::configureBaudrate(struct termios* options, UartCookie* uartCooki
cfsetispeed(options, B4000000);
cfsetospeed(options, B4000000);
break;
#endif // ! __APPLE__
#endif // ! __APPLE__
default:
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "UartComIF::configureBaudrate: Baudrate not supported" << std::endl;

View File

@ -80,10 +80,10 @@ class ControllerBase : public HasModesIF,
/** Mode helpers */
virtual void modeChanged(Mode_t mode, Submode_t submode);
virtual void startTransition(Mode_t mode, Submode_t submode) override;
virtual void getMode(Mode_t *mode, Submode_t *submode) override;
virtual void setToExternalControl() override;
virtual void announceMode(bool recursive);
void startTransition(Mode_t mode, Submode_t submode) override;
void getMode(Mode_t *mode, Submode_t *submode) override;
void setToExternalControl() override;
void announceMode(bool recursive) override;
/** HK helpers */
virtual void changeHK(Mode_t mode, Submode_t submode, bool enable);
};

View File

@ -39,12 +39,12 @@ class ExtendedControllerBase : public ControllerBase,
* @param message
* @return
*/
virtual ReturnValue_t handleCommandMessage(CommandMessage* message) = 0;
virtual ReturnValue_t handleCommandMessage(CommandMessage* message) override = 0;
/**
* Periodic helper from ControllerBase, implemented by child class.
*/
virtual void performControlOperation() = 0;
virtual void performControlOperation() override = 0;
/* Handle the four messages mentioned above */
void handleQueue() override;

View File

@ -207,13 +207,11 @@ class DeviceHandlerBase : public DeviceHandlerIF,
Mode_t getTransitionSourceMode() const;
Submode_t getTransitionSourceSubMode() const;
virtual void getMode(Mode_t *mode, Submode_t *submode);
HealthState getHealth();
ReturnValue_t setHealth(HealthState health);
virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId,
ParameterWrapper *parameterWrapper,
const ParameterWrapper *newValues,
uint16_t startAtIndex) override;
void getMode(Mode_t *mode, Submode_t *submode) override;
HealthState getHealth() override;
ReturnValue_t setHealth(HealthState health) override;
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper *parameterWrapper,
const ParameterWrapper *newValues, uint16_t startAtIndex) override;
protected:
/**
@ -1042,11 +1040,9 @@ class DeviceHandlerBase : public DeviceHandlerIF,
bool isAwaitingReply();
void handleDeviceTM(SerializeIF *dataSet, DeviceCommandId_t replyId, bool forceDirectTm = false);
// void handleDeviceTM(uint8_t* data, size_t dataSize, DeviceCommandId_t replyId,
// bool forceDirectTm);
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode);
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode) override;
virtual ReturnValue_t letChildHandleMessage(CommandMessage *message);
@ -1062,7 +1058,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
/**
* Same as triggerEvent, but for forwarding if object is used as proxy.
*/
virtual void forwardEvent(Event event, uint32_t parameter1 = 0, uint32_t parameter2 = 0) const override;
void forwardEvent(Event event, uint32_t parameter1 = 0, uint32_t parameter2 = 0) const override;
/**
* Checks if current mode is transitional mode.

View File

@ -36,7 +36,7 @@ class HasHealthIF {
12,
severity::MEDIUM); //!< Recovery was completed. Not necessarily successful. No parameters.
virtual ~HasHealthIF() {}
virtual ~HasHealthIF() = default;
virtual MessageQueueId_t getCommandQueue() const = 0;

View File

@ -17,8 +17,8 @@ class AbsLimitMonitor : public MonitorBase<T> {
limit(limit),
violationEvent(violationEvent),
aboveIsViolation(aboveIsViolation) {}
virtual ~AbsLimitMonitor() {}
virtual ReturnValue_t checkSample(T sample, T *crossedLimit) {
virtual ~AbsLimitMonitor() = default;
ReturnValue_t checkSample(T sample, T *crossedLimit) override {
*crossedLimit = limit;
if (aboveIsViolation) {
if ((std::abs(sample) > limit)) {
@ -32,9 +32,9 @@ class AbsLimitMonitor : public MonitorBase<T> {
return HasReturnvaluesIF::RETURN_OK; // We're not out of range.
}
virtual ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
ParameterWrapper *parameterWrapper,
const ParameterWrapper *newValues, uint16_t startAtIndex) {
ReturnValue_t getParameter(uint8_t domainId, uint8_t parameterId,
ParameterWrapper *parameterWrapper, const ParameterWrapper *newValues,
uint16_t startAtIndex) override {
ReturnValue_t result = this->MonitorBase<T>::getParameter(
domainId, parameterId, parameterWrapper, newValues, startAtIndex);
// We'll reuse the DOMAIN_ID of MonitorReporter,
@ -61,7 +61,7 @@ class AbsLimitMonitor : public MonitorBase<T> {
void setLimit(T value) { limit = value; }
protected:
void sendTransitionEvent(T currentValue, ReturnValue_t state) {
void sendTransitionEvent(T currentValue, ReturnValue_t state) override {
switch (state) {
case MonitoringIF::OUT_OF_RANGE:
EventManagerIF::triggerEvent(this->reportingId, violationEvent, this->globalPoolId.objectId,

View File

@ -51,9 +51,8 @@ class MonitorReporter : public HasParametersIF {
return state;
}
virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId,
ParameterWrapper *parameterWrapper,
const ParameterWrapper *newValues, uint16_t startAtIndex) {
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper *parameterWrapper,
const ParameterWrapper *newValues, uint16_t startAtIndex) override {
if (domainId != monitorId) {
return INVALID_DOMAIN_ID;
}

View File

@ -50,7 +50,8 @@ class SystemObject : public SystemObjectIF {
virtual ReturnValue_t initialize() override;
virtual ReturnValue_t checkObjectConnections() override;
virtual void forwardEvent(Event event, uint32_t parameter1 = 0, uint32_t parameter2 = 0) const override;
virtual void forwardEvent(Event event, uint32_t parameter1 = 0,
uint32_t parameter2 = 0) const override;
};
#endif /* FSFW_OBJECTMANAGER_SYSTEMOBJECT_H_ */

View File

@ -154,7 +154,7 @@ void UdpTcPollingTask::setTimeout(double timeoutSeconds) {
#endif
}
#elif defined(PLATFORM_UNIX)
timeval tval {};
timeval tval{};
tval = timevalOperations::toTimeval(timeoutSeconds);
int result = setsockopt(serverSocket, SOL_SOCKET, SO_RCVTIMEO, &tval, sizeof(receptionTimeout));
if (result == -1) {

View File

@ -20,7 +20,7 @@
const std::string UdpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT;
UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
const std::string& udpServerPort_, object_id_t tmStoreId,
const std::string &udpServerPort_, object_id_t tmStoreId,
object_id_t tcStoreId)
: TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
if (udpServerPort_.empty()) {
@ -118,7 +118,7 @@ ReturnValue_t UdpTmTcBridge::sendTm(const uint8_t *data, size_t dataLen) {
#endif
ssize_t bytesSent = sendto(serverSocket, reinterpret_cast<const char *>(data), dataLen, flags,
&clientAddress, clientAddressLen);
&clientAddress, clientAddressLen);
if (bytesSent == SOCKET_ERROR) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "TmTcUdpBridge::sendTm: Send operation failed." << std::endl;

View File

@ -29,8 +29,8 @@ class UdpTmTcBridge : public TmTcBridge, public TcpIpBase {
/* The ports chosen here should not be used by any other process. */
static const std::string DEFAULT_SERVER_PORT;
UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination, const std::string& udpServerPort = "",
object_id_t tmStoreId = objects::TM_STORE,
UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
const std::string& udpServerPort = "", object_id_t tmStoreId = objects::TM_STORE,
object_id_t tcStoreId = objects::TC_STORE);
~UdpTmTcBridge() override;

View File

@ -51,7 +51,7 @@ class HasParametersIF {
return (domainId << 24) + (uniqueId << 16) + linearIndex;
}
virtual ~HasParametersIF() {}
virtual ~HasParametersIF() = default;
/**
* This is the generic function overriden by child classes to set

View File

@ -63,13 +63,13 @@ class Fuse : public SystemObject,
SerializeIF::Endianness streamEndianness) override;
void setAllMonitorsToUnchecked();
ReturnValue_t performOperation(uint8_t opCode);
MessageQueueId_t getCommandQueue() const;
MessageQueueId_t getCommandQueue() const override;
void setDataPoolEntriesInvalid();
ReturnValue_t setHealth(HealthState health);
HasHealthIF::HealthState getHealth();
ReturnValue_t setHealth(HealthState health) override;
HasHealthIF::HealthState getHealth() override;
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper *parameterWrapper,
const ParameterWrapper *newValues, uint16_t startAtIndex);
const ParameterWrapper *newValues, uint16_t startAtIndex) override;
private:
uint8_t oldFuseState;
@ -81,7 +81,7 @@ class Fuse : public SystemObject,
template <typename... Args>
PowerMonitor(Args... args) : MonitorReporter<float>(std::forward<Args>(args)...) {}
ReturnValue_t checkPower(float sample, float lowerLimit, float upperLimit);
void sendTransitionEvent(float currentValue, ReturnValue_t state) {}
void sendTransitionEvent(float currentValue, ReturnValue_t state_) override {}
};
PowerMonitor powerMonitor;
StaticLocalDataSet<3> set;

View File

@ -10,15 +10,15 @@ class PowerComponent : public PowerComponentIF {
PowerComponent(object_id_t setId, uint8_t moduleId, float minPower, float maxPower,
uint8_t switchId1, bool twoSwitches = false, uint8_t switchId2 = 0xFF);
virtual object_id_t getDeviceObjectId();
object_id_t getDeviceObjectId() override;
virtual uint8_t getSwitchId1();
virtual uint8_t getSwitchId2();
uint8_t getSwitchId1() override;
uint8_t getSwitchId2() override;
bool hasTwoSwitches();
bool hasTwoSwitches() override;
float getMin();
float getMax();
float getMin() override;
float getMax() override;
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const override;
@ -29,7 +29,7 @@ class PowerComponent : public PowerComponentIF {
Endianness streamEndianness) override;
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper* parameterWrapper,
const ParameterWrapper* newValues, uint16_t startAtIndex);
const ParameterWrapper* newValues, uint16_t startAtIndex) override;
private:
const object_id_t deviceObjectId = objects::NO_OBJECT;

View File

@ -7,7 +7,7 @@
class PowerComponentIF : public SerializeIF, public HasParametersIF {
public:
virtual ~PowerComponentIF() {}
~PowerComponentIF() override = default;
virtual object_id_t getDeviceObjectId() = 0;

View File

@ -29,11 +29,11 @@ CFDPDistributor::TcMqMapIter CFDPDistributor::selectDestination() {
storeId.packetIndex);
#endif
#endif
TcMqMapIter queueMapIt = this->queueMap.end();
auto queueMapIt = this->queueMap.end();
if (this->currentPacket == nullptr) {
return queueMapIt;
}
this->currentPacket->setStoreAddress(this->currentMessage.getStorageId());
this->currentPacket->setStoreAddress(this->currentMessage.getStorageId(), currentPacket);
if (currentPacket->getWholeData() != nullptr) {
tcStatus = checker.checkPacket(currentPacket);
if (tcStatus != HasReturnvaluesIF::RETURN_OK) {

View File

@ -190,13 +190,13 @@ ReturnValue_t Heater::performOperation(uint8_t opCode) {
}
void Heater::setSwitch(uint8_t number, ReturnValue_t state, uint32_t* uptimeOfSwitching) {
if (powerSwitcher == NULL) {
if (powerSwitcher == nullptr) {
return;
}
if (powerSwitcher->getSwitchState(number) == state) {
*uptimeOfSwitching = INVALID_UPTIME;
} else {
if ((*uptimeOfSwitching == INVALID_UPTIME)) {
if (*uptimeOfSwitching == INVALID_UPTIME) {
powerSwitcher->sendSwitchCommand(number, state);
Clock::getUptime(uptimeOfSwitching);
} else {

View File

@ -11,11 +11,11 @@ class CFDPPacket : public SpacePacketBase {
* forwards the data pointer to the parent SpacePacketBase class.
* @param setData The position where the packet data lies.
*/
CFDPPacket(const uint8_t* setData);
explicit CFDPPacket(const uint8_t* setData);
/**
* This is the empty default destructor.
*/
virtual ~CFDPPacket();
~CFDPPacket() override;
/**
* This is a debugging helper method that prints the whole packet content

View File

@ -2,48 +2,46 @@
#include "fsfw/objectmanager/ObjectManager.h"
StorageManagerIF* CFDPPacketStored::store = nullptr;
StorageManagerIF* CFDPPacketStored::STORE = nullptr;
CFDPPacketStored::CFDPPacketStored() : CFDPPacket(nullptr) {}
CFDPPacketStored::CFDPPacketStored(store_address_t setAddress) : CFDPPacket(nullptr) {
this->setStoreAddress(setAddress);
CFDPPacketStored::setStoreAddress(setAddress, this);
}
CFDPPacketStored::CFDPPacketStored(const uint8_t* data, size_t size) : CFDPPacket(data) {
if (this->getFullSize() != size) {
return;
}
if (this->checkAndSetStore()) {
ReturnValue_t status = store->addData(&storeAddress, data, size);
if (CFDPPacketStored::checkAndSetStore()) {
ReturnValue_t status = STORE->addData(&storeAddress, data, size);
if (status != HasReturnvaluesIF::RETURN_OK) {
this->setData(nullptr, -1);
}
const uint8_t* storePtr = nullptr;
// Repoint base data pointer to the data in the store.
store->getData(storeAddress, &storePtr, &size);
STORE->getData(storeAddress, &storePtr, &size);
this->setData(const_cast<uint8_t*>(storePtr), size);
}
}
ReturnValue_t CFDPPacketStored::deletePacket() {
ReturnValue_t result = this->store->deleteData(this->storeAddress);
ReturnValue_t result = CFDPPacketStored::STORE->deleteData(this->storeAddress);
this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS;
// To circumvent size checks
this->setData(nullptr, -1);
return result;
}
// CFDPPacket* CFDPPacketStored::getPacketBase() {
// return this;
// }
void CFDPPacketStored::setStoreAddress(store_address_t setAddress) {
void CFDPPacketStored::setStoreAddress(store_address_t setAddress,
RedirectableDataPointerIF* packet) {
this->storeAddress = setAddress;
const uint8_t* tempData = nullptr;
size_t tempSize;
ReturnValue_t status = StorageManagerIF::RETURN_FAILED;
if (this->checkAndSetStore()) {
status = this->store->getData(this->storeAddress, &tempData, &tempSize);
status = this->STORE->getData(this->storeAddress, &tempData, &tempSize);
}
if (status == StorageManagerIF::RETURN_OK) {
this->setData(const_cast<uint8_t*>(tempData), tempSize);
@ -67,9 +65,9 @@ ReturnValue_t CFDPPacketStored::getData(const uint8_t** dataPtr, size_t* dataSiz
// }
bool CFDPPacketStored::checkAndSetStore() {
if (this->store == nullptr) {
this->store = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
if (this->store == nullptr) {
if (CFDPPacketStored::STORE == nullptr) {
CFDPPacketStored::STORE = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
if (CFDPPacketStored::STORE == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "CFDPPacketStored::CFDPPacketStored: TC Store not found!" << std::endl;
#endif
@ -82,7 +80,8 @@ bool CFDPPacketStored::checkAndSetStore() {
bool CFDPPacketStored::isSizeCorrect() {
const uint8_t* temp_data = nullptr;
size_t temp_size;
ReturnValue_t status = this->store->getData(this->storeAddress, &temp_data, &temp_size);
ReturnValue_t status =
CFDPPacketStored::STORE->getData(this->storeAddress, &temp_data, &temp_size);
if (status == StorageManagerIF::RETURN_OK) {
if (this->getFullSize() == temp_size) {
return true;

View File

@ -16,10 +16,10 @@ class CFDPPacketStored : public CFDPPacket, public TcPacketStoredBase {
* Create stored packet from existing packet in store
* @param setAddress
*/
CFDPPacketStored(store_address_t setAddress);
explicit CFDPPacketStored(store_address_t setAddress);
CFDPPacketStored();
virtual ~CFDPPacketStored();
~CFDPPacketStored() override;
/**
* Getter function for the raw data.
@ -27,16 +27,16 @@ class CFDPPacketStored : public CFDPPacket, public TcPacketStoredBase {
* @param dataSize [out] Address of size to set.
* @return -@c RETURN_OK if data was retrieved successfully.
*/
ReturnValue_t getData(const uint8_t** dataPtr, size_t* dataSize);
ReturnValue_t getData(const uint8_t** dataPtr, size_t* dataSize) override;
void setStoreAddress(store_address_t setAddress);
void setStoreAddress(store_address_t setAddress, RedirectableDataPointerIF* packet) override;
store_address_t getStoreAddress();
store_address_t getStoreAddress() override;
ReturnValue_t deletePacket();
ReturnValue_t deletePacket() override;
private:
bool isSizeCorrect();
bool isSizeCorrect() override;
protected:
/**
@ -45,7 +45,7 @@ class CFDPPacketStored : public CFDPPacket, public TcPacketStoredBase {
* call tries to set it and throws an error message in case of failures.
* The default store is objects::TC_STORE.
*/
static StorageManagerIF* store;
static StorageManagerIF* STORE;
/**
* The address where the packet data of the object instance is stored.
*/
@ -57,7 +57,7 @@ class CFDPPacketStored : public CFDPPacket, public TcPacketStoredBase {
* @return @li @c true if the store is linked or could be created.
* @li @c false otherwise.
*/
bool checkAndSetStore();
bool checkAndSetStore() override;
};
#endif /* FSFW_INC_FSFW_TMTCPACKET_CFDP_CFDPPACKETSTORED_H_ */

View File

@ -19,7 +19,7 @@ class TcPacketStoredBase : public TcPacketStoredIF {
* Constructor to set to an existing store address.
* @param setAddress
*/
TcPacketStoredBase(store_address_t setAddress);
explicit TcPacketStoredBase(store_address_t setAddress);
/**
* Another constructor to create a TcPacket from a raw packet stream.
* Takes the data and adds it unchecked to the TcStore.
@ -70,14 +70,16 @@ class TcPacketStoredBase : public TcPacketStoredIF {
* The address where the packet data of the object instance is stored.
*/
store_address_t storeAddress;
/**
* A helper method to check if a store is assigned to the class.
* If not, the method tries to retrieve the store from the global
* ObjectManager.
* @return @li @c true if the store is linked or could be created.
* @li @c false otherwise.
*/
bool checkAndSetStore();
virtual /**
* A helper method to check if a store is assigned to the class.
* If not, the method tries to retrieve the store from the global
* ObjectManager.
* @return @li @c true if the store is linked or could be created.
* @li @c false otherwise.
*/
bool
checkAndSetStore();
};
#endif /* TMTCPACKET_PUS_TcPacketStoredBase_H_ */

View File

@ -9,12 +9,15 @@
class TcPacketStoredIF {
public:
virtual ~TcPacketStoredIF(){};
virtual ~TcPacketStoredIF() = default;
;
/**
* With this call, the stored packet can be set to another packet in a store. This is useful
* if the packet is a class member and used for more than one packet.
* @param setAddress The new packet id to link to.
* @param packet Explicit packet instance. The setData function should be called on this
* pointer
*/
virtual void setStoreAddress(store_address_t setAddress, RedirectableDataPointerIF* packet) = 0;