diff --git a/src/fsfw/tmtcpacket/cfdp/CFDPPacketStored.cpp b/src/fsfw/tmtcpacket/cfdp/CFDPPacketStored.cpp index 2828f377..6cff8de2 100644 --- a/src/fsfw/tmtcpacket/cfdp/CFDPPacketStored.cpp +++ b/src/fsfw/tmtcpacket/cfdp/CFDPPacketStored.cpp @@ -2,8 +2,6 @@ #include "fsfw/objectmanager/ObjectManager.h" -StorageManagerIF* CFDPPacketStored::STORE = nullptr; - CFDPPacketStored::CFDPPacketStored() : CFDPPacket(nullptr) {} CFDPPacketStored::CFDPPacketStored(store_address_t setAddress) : CFDPPacket(nullptr) { @@ -40,8 +38,8 @@ void CFDPPacketStored::setStoreAddress(store_address_t 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); + if (CFDPPacketStored::checkAndSetStore()) { + status = CFDPPacketStored::STORE->getData(this->storeAddress, &tempData, &tempSize); } if (status == StorageManagerIF::RETURN_OK) { this->setData(const_cast(tempData), tempSize); @@ -54,29 +52,12 @@ void CFDPPacketStored::setStoreAddress(store_address_t setAddress, store_address_t CFDPPacketStored::getStoreAddress() { return this->storeAddress; } -CFDPPacketStored::~CFDPPacketStored() {} +CFDPPacketStored::~CFDPPacketStored() = default; ReturnValue_t CFDPPacketStored::getData(const uint8_t** dataPtr, size_t* dataSize) { return HasReturnvaluesIF::RETURN_OK; } -// ReturnValue_t CFDPPacketStored::setData(const uint8_t *data) { -// return HasReturnvaluesIF::RETURN_OK; -// } - -bool CFDPPacketStored::checkAndSetStore() { - if (CFDPPacketStored::STORE == nullptr) { - CFDPPacketStored::STORE = ObjectManager::instance()->get(objects::TC_STORE); - if (CFDPPacketStored::STORE == nullptr) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "CFDPPacketStored::CFDPPacketStored: TC Store not found!" << std::endl; -#endif - return false; - } - } - return true; -} - bool CFDPPacketStored::isSizeCorrect() { const uint8_t* temp_data = nullptr; size_t temp_size; diff --git a/src/fsfw/tmtcpacket/cfdp/CFDPPacketStored.h b/src/fsfw/tmtcpacket/cfdp/CFDPPacketStored.h index 6a02c865..4ab42ee6 100644 --- a/src/fsfw/tmtcpacket/cfdp/CFDPPacketStored.h +++ b/src/fsfw/tmtcpacket/cfdp/CFDPPacketStored.h @@ -39,25 +39,10 @@ class CFDPPacketStored : public CFDPPacket, public TcPacketStoredBase { bool isSizeCorrect() override; protected: - /** - * This is a pointer to the store all instances of the class use. - * If the store is not yet set (i.e. @c store is NULL), every constructor - * call tries to set it and throws an error message in case of failures. - * The default store is objects::TC_STORE. - */ - static StorageManagerIF* STORE; /** * 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() override; }; #endif /* FSFW_INC_FSFW_TMTCPACKET_CFDP_CFDPPACKETSTORED_H_ */ diff --git a/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h b/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h index 294683dc..b5629a2a 100644 --- a/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h +++ b/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h @@ -28,7 +28,7 @@ class TcPacketStoredBase : public TcPacketStoredIF { */ TcPacketStoredBase(const uint8_t* data, uint32_t size); - virtual ~TcPacketStoredBase(); + ~TcPacketStoredBase() override; /** * Getter function for the raw data.