LeviLamina
Loading...
Searching...
No Matches
Service.h
1
#pragma once
2
3
#include "ll/api/service/ServiceId.h"
4
5
namespace
ll::service {
6
7
class
Service
:
public
std::enable_shared_from_this<Service> {
8
public
:
9
virtual
~Service
() =
default
;
10
11
[[nodiscard]]
virtual
ServiceId
getServiceId()
const
noexcept
= 0;
12
13
// this is called when the service is removed from the service manager
14
virtual
void
invalidate() = 0;
15
16
static
constexpr
ServiceIdView
ServiceId
{EmptyServiceId};
17
18
Service
() =
default
;
19
Service
(
Service
const
&) =
delete
;
20
Service
(
Service
&&) =
delete
;
21
Service
& operator=(
Service
const
&) =
delete
;
22
Service
& operator=(
Service
&&) =
delete
;
23
};
24
25
template
<
class
T>
26
concept
IsService
= std::is_base_of_v<Service, T> &&
requires
{
27
T::ServiceId;
28
requires
(std::same_as<std::remove_cvref_t<
decltype
((T::ServiceId))>, ServiceId> || std::same_as<std::remove_cvref_t<
decltype
((T::ServiceId))>, ServiceIdView>);
29
};
30
31
template
<
class
T,
size_t
version>
32
class
ServiceImpl
:
public
Service
{
33
public
:
34
[[nodiscard]]
class
ServiceId
getServiceId() const noexcept override {
return
T::ServiceId; }
35
36
static
constexpr
class
ServiceIdView
ServiceId
{
37
auto_name_t<T>
{}, version
38
};
39
};
40
41
}
// namespace ll::service
ll::service::ServiceIdView
Definition
ServiceId.h:24
ll::service::ServiceId
Definition
ServiceId.h:12
ll::service::ServiceImpl::ServiceId
Definition
Service.h:36
ll::service::ServiceImpl
Definition
Service.h:32
ll::service::Service
Definition
Service.h:7
ll::service::IsService
Definition
Service.h:26
ll::service::auto_name_t
Definition
ServiceId.h:9
src
ll
api
service
Service.h
Generated on Sat Apr 26 2025 05:55:20 for LeviLamina by
1.12.0