some re-ordering

This commit is contained in:
Robin Müller 2022-08-03 11:36:56 +02:00
parent b0c479cab9
commit df690b9628
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 10 additions and 4 deletions

View File

@ -16,7 +16,11 @@ CcsdsDistributor::CcsdsDistributor(uint16_t setDefaultApid, object_id_t setObjec
tcStore(tcStore),
packetChecker(packetChecker) {}
CcsdsDistributor::~CcsdsDistributor() = default;
CcsdsDistributor::~CcsdsDistributor() {
if (ownedPacketChecker) {
delete packetChecker;
}
}
ReturnValue_t CcsdsDistributor::selectDestination(MessageQueueId_t& destId) {
#if CCSDS_DISTRIBUTOR_DEBUGGING == 1
@ -123,13 +127,14 @@ ReturnValue_t CcsdsDistributor::registerApplication(DestInfo info) {
uint32_t CcsdsDistributor::getIdentifier() const { return 0; }
ReturnValue_t CcsdsDistributor::initialize() {
if (packetChecker == nullptr) {
packetChecker = new CcsdsPacketChecker(ccsds::PacketType::TC);
}
ReturnValue_t result = TcDistributorBase::initialize();
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
if (packetChecker == nullptr) {
ownedPacketChecker = true;
packetChecker = new CcsdsPacketChecker(ccsds::PacketType::TC);
}
if (tcStore == nullptr) {
tcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
if (tcStore == nullptr) {

View File

@ -78,6 +78,7 @@ class CcsdsDistributor : public TcDistributorBase,
*/
StorageManagerIF* tcStore = nullptr;
bool ownedPacketChecker = false;
CcsdsPacketCheckIF* packetChecker = nullptr;
};