#include "service.h" #include "objects/datamodel.h" #include "logger.h" #include "panic.h" #include Service::Service(const InstanceType* type) : Instance(type) {} // Fail if parented to non-datamodel, otherwise lock parent void Service::OnParentUpdated(std::optional> oldParent, std::optional> newParent) { if (!newParent || newParent.value()->GetClass() != &DataModel::TYPE) { Logger::fatalErrorf("Service %s was parented to object of type %s", GetClass()->className.c_str(), newParent ? newParent.value()->GetClass()->className.c_str() : "NULL"); panic(); } // Prevent parent from being updated parentLocked = true; } void Service::InitService() { } void Service::OnRun() { }