VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
PublishedInterfaces.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
VoltMod/Host/IPluginServices.hpp
>
4
#include <string>
5
#include <string_view>
6
#include <vector>
7
8
namespace
VoltMod
9
{
10
11
/** Interfaces plugins publish to each other. Only the publishing owner can refresh or withdraw a name. */
12
class
PublishedInterfaces
13
{
14
public
:
15
using
OwnerId
=
const
void
*;
16
17
/** Add or refresh @p name. A peer's live pointer is never swapped out from under it. */
18
void
Publish
(
OwnerId
owner, std::string_view name,
void
* implementation);
19
void
Unpublish
(
OwnerId
owner, std::string_view name);
20
void
*
Find
(std::string_view name)
const
;
21
22
/** Withdraw everything @p owner published and report the names it was still holding. */
23
std::vector<std::string>
RemoveAll
(
OwnerId
owner);
24
25
private
:
26
struct
Service
27
{
28
std::string
Name
;
29
void
* Implementation =
nullptr
;
30
OwnerId
Owner =
nullptr
;
31
};
32
33
std::vector<Service> _services;
34
};
35
36
}
// namespace VoltMod
IPluginServices.hpp
VoltMod::PublishedInterfaces
Definition
PublishedInterfaces.hpp:13
VoltMod::PublishedInterfaces::Publish
void Publish(OwnerId owner, std::string_view name, void *implementation)
Definition
PublishedInterfaces.cpp:9
VoltMod::PublishedInterfaces::Find
void * Find(std::string_view name) const
Definition
PublishedInterfaces.cpp:38
VoltMod::PublishedInterfaces::OwnerId
const void * OwnerId
Definition
PublishedInterfaces.hpp:15
VoltMod::PublishedInterfaces::RemoveAll
std::vector< std::string > RemoveAll(OwnerId owner)
Definition
PublishedInterfaces.cpp:44
VoltMod::PublishedInterfaces::Unpublish
void Unpublish(OwnerId owner, std::string_view name)
Definition
PublishedInterfaces.cpp:27
VoltMod
Definition
Options.hpp:13
VoltMod::Name
constexpr std::string_view Name(E value) noexcept
Definition
EnumNames.hpp:33
src
Host
Plugins
PublishedInterfaces.hpp
Generated by
1.15.0