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 */
return;
}
LocalDataPoolManager* hkManager = hkOwner->getHkManagerHandle();
mutexIfSingleDataCreator = hkManager->getMutexHandle();
hkManager = hkOwner->getHkManagerHandle();
if(hkManager != nullptr) {
mutexIfSingleDataCreator = hkManager->getMutexHandle();
}
this->sid.objectId = hkOwner->getObjectId();
this->sid.ownerSetId = setId;
//mutex = MutexFactory::instance()->createMutex();
// Data creators get a periodic helper for periodic HK data generation.
if(periodicHandling) {
periodicHelper = new PeriodicHousekeepingHelper(this);
@ -42,8 +44,13 @@ LocalPoolDataSetBase::LocalPoolDataSetBase(sid_t sid,
PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) {
HasLocalDataPoolIF* hkOwner = objectManager->get<HasLocalDataPoolIF>(
sid.objectId);
LocalDataPoolManager* hkManager = hkOwner->getHkManagerHandle();
mutexIfSingleDataCreator = hkManager->getMutexHandle();
if(hkOwner != nullptr) {
hkManager = hkOwner->getHkManagerHandle();
}
if(hkManager != nullptr) {
mutexIfSingleDataCreator = hkManager->getMutexHandle();
}
this->sid = sid;
}
@ -301,4 +308,12 @@ void LocalPoolDataSetBase::setValidity(bool valid, bool setEntriesRecursively) {
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;
bool hasChanged() const override;
object_id_t getCreatorObjectId(object_id_t objectId);
protected:
sid_t sid;
//! 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;
PeriodicHousekeepingHelper* periodicHelper = nullptr;
LocalDataPoolManager* hkManager = nullptr;
};