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,24 +1,22 @@
#pragma once
#include "service/Service.h"
#include <string>
namespace tt::service {
// Forward declarations
class ServiceContext;
typedef void (*ServiceOnStart)(ServiceContext& service);
typedef void (*ServiceOnStop)(ServiceContext& service);
typedef std::shared_ptr<Service>(*CreateService)();
/** A ledger that describes the main parts of a service. */
struct ServiceManifest {
/** The identifier by which the app is launched by the system and other apps. */
std::string id {};
/** Non-blocking method to call when service is started. */
const ServiceOnStart onStart = nullptr;
/** Non-blocking method to call when service is stopped. */
const ServiceOnStop onStop = nullptr;
/** Create the instance of the app */
CreateService createService = nullptr;
};
} // namespace