#include #include #include using namespace std; static map callbacks; void trigger_callback(callback_t type) { map::iterator it; it=callbacks.find(type); if (it != callbacks.end()) it->second(); } void register_callback(callback_t type, void (* func)()) { callbacks[type] = func; }