mirror of
https://gitlab.com/voidframe/voidframe-cpp.git
synced 2026-10-12 02:10:08 -04:00
Implement a simple function register manager (SysReg)
This commit is contained in:
1 parent
70df396822
commit
e1fce167e2
2 files changed
+36
No files matched your search
@@ -0,0 +1,18 @@
|
||||
#include "../include/sysreg.h"
|
||||
|
||||
using namespace VoidFrame;
|
||||
|
||||
std::function<void(void)> *
|
||||
SysReg::RegisterCallback(const std::string &&name,
|
||||
std::function<void(void)> &callback) {
|
||||
callbacks[name] =
|
||||
std::make_unique<std::function<void(void)>>(std::move(callback));
|
||||
|
||||
return callbacks[name].get();
|
||||
}
|
||||
|
||||
const std::function<void(void)> *SysReg::GetCallback(std::string &&name) {
|
||||
return callbacks[name].get();
|
||||
}
|
||||
|
||||
void SysReg::DeleteCallback(std::string &&name) { callbacks.erase(name); }
|
||||
Reference in new issue
Block a user