/* * Authors : Kerem Yollu & Edwin Koch * Date : 07.03.2021 * * Description : * TODO : Inplement singleton pattern * TODO : Write description * TODO : Comment the code wiht odxygen * */ #ifndef _ERRORHANDLIG_H_ #define _ERRORHANDLIG_H_ #include #include #include #define MAX_NUMBER_OF_ERRORS 255 #define KILL 1 #define SPARE 0 class ErrorHandler { public: ErrorHandler(); void addNewError(const int& no, const std::string& source, const std::string& message, const unsigned char kill); void handleError(int no, std::string source); private: struct error_t { //Struture of error entry for the errorLookup table int errNo; std::string errMessage; std::string errSource; unsigned char errExit; }; unsigned int emptyIndex; // Indicates the next empty slot in the errorLookup table. std::array errorLookup; // Where the errors go. int getLookUpIndex(int errNo, std::string source); // If error number exists returns the index otherwise -1 }; #endif // _ERRORHANDLIG_H_