LeviLamina
Loading...
Searching...
No Matches
ServiceReference.h
1
#pragma once
2
3
#include "mc/_HeaderOutputPredefine.h"
4
#include "mc/deps/core/utility/NonOwnerPointer.h"
5
#include "mc/platform/threading/PrioritizeSharedOwnership.h"
6
7
template
<
typename
T>
8
class
ServiceReference
{
9
public
:
10
std::shared_lock<Bedrock::Threading::PrioritizeSharedOwnership> mLock;
11
Bedrock::NonOwnerPointer<T>
mService;
12
13
Bedrock::NonOwnerPointer<T>
get()
const
{
return
mService; }
14
15
explicit
operator
bool()
const
{
return
static_cast<
bool
>
(mService); }
16
17
template
<
class
Fn>
18
decltype
(
auto
) doWith(Fn&& fn) {
19
return
(std::invoke(std::forward<Fn>(fn), *mService));
20
}
21
};
Bedrock::NonOwnerPointer
Definition
NonOwnerPointer.h:9
ServiceReference
Definition
ServiceReference.h:8
src
mc
deps
core
utility
ServiceReference.h
Generated on Sat Apr 26 2025 05:55:27 for LeviLamina by
1.12.0