basic functionality
This commit is contained in:
24
src/ClusterContext.cpp
Normal file
24
src/ClusterContext.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "ClusterContext.h"
|
||||
|
||||
ClusterContext::ClusterContext() {
|
||||
scheduler = new Scheduler();
|
||||
udp = new WiFiUDP();
|
||||
memberList = new std::vector<NodeInfo>();
|
||||
hostname = "";
|
||||
}
|
||||
|
||||
ClusterContext::~ClusterContext() {
|
||||
delete scheduler;
|
||||
delete udp;
|
||||
delete memberList;
|
||||
}
|
||||
|
||||
void ClusterContext::registerEvent(const std::string& event, EventCallback cb) {
|
||||
eventRegistry[event].push_back(cb);
|
||||
}
|
||||
|
||||
void ClusterContext::triggerEvent(const std::string& event, void* data) {
|
||||
for (auto& cb : eventRegistry[event]) {
|
||||
cb(data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user