/* * 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 class ErrorHandler { public: ErrorHandler(); void addNewError(const int& no, const std::string& message); void handleError(int no); private: struct error_t { //Struture of error entry for the errorLookup table int errNo; std::string errMessage; }; unsigned int emptyIndex; // Indicates the next empty slot in the errorLookup table. std::array errorLookup; // Where the errors go. int getLookUpIndex(int errNo); // If error number exists returns the index otherwise -1 }; #endif // _ERRORHANDLIG_H_