getter function for object iD

This commit is contained in:
Robin Müller 2021-01-11 16:33:02 +01:00
parent af7def3368
commit 5e251705f6
2 changed files with 24 additions and 7 deletions

View File

@ -23,13 +23,15 @@ LocalPoolDataSetBase::LocalPoolDataSetBase(HasLocalDataPoolIF *hkOwner,
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
return; return;
} }
LocalDataPoolManager* hkManager = hkOwner->getHkManagerHandle(); hkManager = hkOwner->getHkManagerHandle();
mutexIfSingleDataCreator = hkManager->getMutexHandle();
if(hkManager != nullptr) {
mutexIfSingleDataCreator = hkManager->getMutexHandle();
}
this->sid.objectId = hkOwner->getObjectId(); this->sid.objectId = hkOwner->getObjectId();
this->sid.ownerSetId = setId; this->sid.ownerSetId = setId;
//mutex = MutexFactory::instance()->createMutex();
// Data creators get a periodic helper for periodic HK data generation. // Data creators get a periodic helper for periodic HK data generation.
if(periodicHandling) { if(periodicHandling) {
periodicHelper = new PeriodicHousekeepingHelper(this); periodicHelper = new PeriodicHousekeepingHelper(this);
@ -42,8 +44,13 @@ LocalPoolDataSetBase::LocalPoolDataSetBase(sid_t sid,
PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) { PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) {
HasLocalDataPoolIF* hkOwner = objectManager->get<HasLocalDataPoolIF>( HasLocalDataPoolIF* hkOwner = objectManager->get<HasLocalDataPoolIF>(
sid.objectId); sid.objectId);
LocalDataPoolManager* hkManager = hkOwner->getHkManagerHandle(); if(hkOwner != nullptr) {
mutexIfSingleDataCreator = hkManager->getMutexHandle(); hkManager = hkOwner->getHkManagerHandle();
}
if(hkManager != nullptr) {
mutexIfSingleDataCreator = hkManager->getMutexHandle();
}
this->sid = sid; this->sid = sid;
} }
@ -301,4 +308,12 @@ void LocalPoolDataSetBase::setValidity(bool valid, bool setEntriesRecursively) {
this->valid = valid; this->valid = valid;
} }
object_id_t LocalPoolDataSetBase::getCreatorObjectId(object_id_t objectId) {
if(hkManager != nullptr) {
HasLocalDataPoolIF* owner = hkManager->getOwner();
if(owner != nullptr) {
return owner->getObjectId();
}
}
return objects::NO_OBJECT;
}

View File

@ -145,6 +145,7 @@ public:
void setChanged(bool changed) override; void setChanged(bool changed) override;
bool hasChanged() const override; bool hasChanged() const override;
object_id_t getCreatorObjectId(object_id_t objectId);
protected: protected:
sid_t sid; sid_t sid;
//! This mutex is used if the data is created by one object only. //! This mutex is used if the data is created by one object only.
@ -211,6 +212,7 @@ protected:
bool bitGetter(const uint8_t* byte, uint8_t position) const; bool bitGetter(const uint8_t* byte, uint8_t position) const;
PeriodicHousekeepingHelper* periodicHelper = nullptr; PeriodicHousekeepingHelper* periodicHelper = nullptr;
LocalDataPoolManager* hkManager = nullptr;
}; };