31 lines
866 B
C++
31 lines
866 B
C++
#ifndef CALLBACKMANAGER_H
|
|
#define CALLBACKMANAGER_H
|
|
|
|
#include <functional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "../Interpreter/Instruction.h"
|
|
|
|
struct CallbackManager
|
|
{
|
|
std::vector<std::function<void(const std::string&)>> rom_load_callback;
|
|
std::vector<std::function<void()>> reset_callback;
|
|
std::vector<std::function<void()>> resume_callback;
|
|
std::vector<std::function<void()>> stop_callback;
|
|
std::vector<std::function<void(int)>> step_callback;
|
|
std::vector<std::function<void(int)>> ips_callback;
|
|
std::vector<std::function<void()>> reload_callback;
|
|
|
|
template <typename Func, typename... Args>
|
|
void trigger(const std::vector<Func>& callbacks, Args&&... args)
|
|
{
|
|
for (const auto& callback : callbacks)
|
|
{
|
|
callback(std::forward<Args>(args)...);
|
|
}
|
|
}
|
|
};
|
|
|
|
#endif //CALLBACKMANAGER_H
|