#include "HousekeepingHelper.h" #include #include "GeneratesHousekeepingIF.h" HousekeepingHelper::HousekeepingHelper(GeneratesHousekeepingIF* owner) : owner(owner) {} ReturnValue_t HousekeepingHelper::initialize() { tmManager = ObjectManager::instance()->get(objects::TM_MANAGER); if (tmManager == nullptr) { return returnvalue::FAILED; } return returnvalue::OK; } const HousekeepingSet* HousekeepingHelper::getHousekeepingSet(HousekeepingSetId_t id) { auto iter = housekeepingSets.find(id); if (iter == housekeepingSets.end()) { return nullptr; } return iter->second; } void HousekeepingHelper::registerSet(HousekeepingSet* set) { auto id = set->getId(); housekeepingSets.emplace(id, set); } ReturnValue_t HousekeepingHelper::reportHousekeeping(HousekeepingSet* set, const Action* action) { SystemObjectIF* ownerAsObject = dynamic_cast(owner); if (ownerAsObject == nullptr) { sif::error << "Duuuuuuuude, what the hell?" << std::endl; return returnvalue::FAILED; } store_address_t tc; size_t tcOffset = 0; if (action != nullptr) { tc = action->tc; tcOffset = action->tcOffset; } return tmManager->sendTmPacket(ownerAsObject->getObjectId(), GeneratesHousekeepingIF::INTERFACE_ID, GeneratesHousekeepingIF::Functions::REPORT, set, tc, tcOffset); }