Refactor services into classes (#183)

This commit is contained in:
Ken Van Hoeylandt
2025-01-24 18:21:47 +01:00
committed by GitHub
parent bb7e79886f
commit 3be251d8fb
20 changed files with 382 additions and 373 deletions
@@ -1,26 +1,14 @@
#include <utility>
#include "service/ServiceInstance.h"
#include "service/ServiceInstancePaths.h"
namespace tt::service {
ServiceInstance::ServiceInstance(const service::ServiceManifest&manifest) : manifest(manifest) {}
ServiceInstance::ServiceInstance(std::shared_ptr<const service::ServiceManifest> manifest) :
manifest(manifest),
service(manifest->createService())
{}
const service::ServiceManifest& ServiceInstance::getManifest() const { return manifest; }
std::shared_ptr<void> ServiceInstance::getData() const {
mutex.acquire(TtWaitForever);
std::shared_ptr<void> result = data;
mutex.release();
return result;
}
void ServiceInstance::setData(std::shared_ptr<void> newData) {
mutex.acquire(TtWaitForever);
data = std::move(newData);
mutex.release();
}
const service::ServiceManifest& ServiceInstance::getManifest() const { return *manifest; }
std::unique_ptr<Paths> ServiceInstance::getPaths() const {
return std::make_unique<ServiceInstancePaths>(manifest);