Refactor services into classes (#183)
This commit is contained in:
committed by
GitHub
parent
bb7e79886f
commit
3be251d8fb
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user