#ifndef _ERROR_HANDLER_H_ #define _ERROR_HANDLER_H_ #include "global.h" /* * ErrorHandler Class * * This class takes care of registering & unregistering functions and * providing feedback to the programmer when errors occur. * * Here are the debug levels: * * 0 - The class does nothing. * 1 - The class outputs error messages on fatal errors. * 2 - The class also outputs where a fatal error occurred. * 3 - The class also outputs logged event messages. * 4 - The class also outputs a full rundown of where an error occurred * or where an event occurred * 5 - The class also outputs on each function call and return. * */ typedef struct _function_registry { char *function_name; struct _function_registry *next; } function_registry; class ErrorHandler { public: ErrorHandler(int debug_level); ~ErrorHandler(); // It's like a stack machine, so here we have push and pop respectively. void Register(char *func_name); void Unregister(); void Error(char *error_string); void LogEvent(char *event); private: void print_registry(); int depth; int debug; function_registry *reg; }; #endif /* _ERROR_HANDLER_H_ */