removed duplicate code
Some checks failed
fsfw/fsfw/pipeline/pr-development There was a failure building this commit
Some checks failed
fsfw/fsfw/pipeline/pr-development There was a failure building this commit
This commit is contained in:
parent
e2b3cdd6c4
commit
e90960a7b6
@ -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<uint8_t*>(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<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
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CFDPPacketStored::isSizeCorrect() {
|
||||
const uint8_t* temp_data = nullptr;
|
||||
size_t temp_size;
|
||||
|
@ -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_ */
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user