You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
KED/oldDevFiles/depricated/training/cpp/management/errorHandling.h

42 lines
916 B

/*
* 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 <iostream>
#include <array>
#include <string>
#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 <error_t,MAX_NUMBER_OF_ERRORS> errorLookup; // Where the errors go.
int getLookUpIndex(int errNo); // If error number exists returns the index otherwise -1
};
#endif // _ERRORHANDLIG_H_