40 using Lock = std::recursive_mutex;
41 using Locker = std::lock_guard<Lock>;
47 std::map<RE::VMHandle, EventName>
_regs;
51 template <
class Enable,
class... Args>
54 template <
class... Args>
58 RE::BSScript::is_return_convertible<Args>...>>,
75 for (
auto& reg : _regs) {
77 vm->SendEvent(reg.first, reg.second.c_str(), args);
83 std::tuple args(
VMArg(std::forward<Args>(a_args))...);
87 task->AddTask([args,
this]()
mutable {
94 template <
class Tuple, std::size_t... I>
95 inline void SendEvent_Tuple(Tuple&& a_tuple, std::index_sequence<I...>)
97 SendEvent(std::get<I>(std::forward<Tuple>(a_tuple)).Unpack()...);
118 for (
auto& reg : _regs) {
120 vm->SendEvent(reg.first, reg.second.c_str(), args);
129 task->AddTask([
this]() {
136 template <
class... Args>
Definition: BGSBaseAlias.h:12
static VirtualMachine * GetSingleton()
RegistrationMap(const RegistrationMap &)=default
RegistrationMap()=default
RegistrationMap(RegistrationMap &&)=default
void SendEvent(Args... a_args)
Definition: RegistrationMap.h:72
RegistrationMap & operator=(RegistrationMap &&a_rhs)=default
void QueueEvent(Args... a_args)
Definition: RegistrationMap.h:81
RegistrationMap & operator=(const RegistrationMap &a_rhs)=default
~RegistrationMap()=default
RegistrationMap()=default
~RegistrationMap()=default
RegistrationMap(const RegistrationMap &)=default
RegistrationMap(RegistrationMap &&)=default
void SendEvent()
Definition: RegistrationMap.h:114
RegistrationMap & operator=(const RegistrationMap &)=default
RegistrationMap & operator=(RegistrationMap &&)=default
void QueueEvent()
Definition: RegistrationMap.h:125
Definition: RegistrationMap.h:20
bool Register(const void *a_object, RE::BSFixedString a_callback, RE::VMTypeID a_typeID)
bool Save(SerializationInterface *a_intfc, std::uint32_t a_type, std::uint32_t a_version)
bool Unregister(const RE::BGSBaseAlias *a_alias)
Lock _lock
Definition: RegistrationMap.h:48
RegistrationMapBase(const RegistrationMapBase &a_rhs)
RegistrationMapBase & operator=(const RegistrationMapBase &a_rhs)
std::string EventName
Definition: RegistrationMap.h:42
RegistrationMapBase & operator=(RegistrationMapBase &&a_rhs)
std::map< RE::VMHandle, EventName > _regs
Definition: RegistrationMap.h:47
RegistrationMapBase(RegistrationMapBase &&a_rhs)
bool Register(const RE::TESForm *a_form, RE::BSFixedString a_callback)
bool Unregister(const void *a_object, RE::VMTypeID a_typeID)
bool Unregister(const RE::TESForm *a_form)
bool Save(SerializationInterface *a_intfc)
bool Load(SerializationInterface *a_intfc)
std::recursive_mutex Lock
Definition: RegistrationMap.h:40
std::lock_guard< Lock > Locker
Definition: RegistrationMap.h:41
bool Register(const RE::BGSBaseAlias *a_alias, RE::BSFixedString a_callback)
Definition: RegistrationMap.h:52
Definition: RegistrationTraits.h:45
Definition: Interfaces.h:71
BSScript::IFunctionArguments * MakeFunctionArguments()
Definition: FunctionArguments.h:86
std::uint32_t VMTypeID
Definition: BSCoreTypes.h:9
const TaskInterface * GetTaskInterface() noexcept
Definition: NiBinaryStream.h:94
Definition: RegistrationTraits.h:40