Refactor services into classes (#183)
This commit is contained in:
committed by
GitHub
parent
bb7e79886f
commit
3be251d8fb
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace tt::service {
|
||||
|
||||
// Forward declaration
|
||||
class ServiceContext;
|
||||
|
||||
class Service {
|
||||
|
||||
public:
|
||||
|
||||
Service() = default;
|
||||
virtual ~Service() = default;
|
||||
|
||||
virtual void onStart(ServiceContext& serviceContext) {}
|
||||
virtual void onStop(ServiceContext& serviceContext) {}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
std::shared_ptr<Service> create() { return std::shared_ptr<T>(new T); }
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user