With the saved files

master
Kerem Yollu 4 years ago
parent 3baf93742c
commit fb1198e20e

@ -0,0 +1,10 @@
/*
* Authors : Kerem Yollu & Edwin Koch
* Date : 07.03.2021
*
* Description :
* TODO : Inplement singleton pattern
* TODO : Write description
* TODO : Comment the code wiht odxygen
*
*/

@ -1,6 +1,5 @@
#include "errorHandling.h" #include "errorHandling.h"
ErrorHandler::ErrorHandler(): emptyIndex(0) ErrorHandler::ErrorHandler(): emptyIndex(0)
{ {
} }

@ -1,15 +1,12 @@
/* /*
* Authors : Kerem Yollu & Edwin Koch
* Date : 07.03.2021
* *
* Description :
* TODO : Inplement singleton pattern
* TODO : Write description
* TODO : Comment the code wiht odxygen
* *
*
*
*
*
*
*
*
*
* TODO : IMplement it as singleton
*/ */
@ -23,11 +20,6 @@
#define MAX_NUMBER_OF_ERRORS 255 #define MAX_NUMBER_OF_ERRORS 255
/*
* Singleton Pattern based on : https://stackoverflow.com/questions/1008019/c-singleton-design-pattern/1008289
*
*/
class ErrorHandler class ErrorHandler
{ {
public: public:
@ -36,14 +28,13 @@ class ErrorHandler
void handleError(int no); void handleError(int no);
private: private:
struct error_t { struct error_t { //Struture of error entry for the errorLookup table
int errNo; int errNo;
std::string errMessage; std::string errMessage;
}; };
unsigned int emptyIndex; unsigned int emptyIndex; // Indicates the next empty slot in the errorLookup table.
std::array <error_t,MAX_NUMBER_OF_ERRORS> errorLookup; 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 int getLookUpIndex(int errNo); // If error number exists returns the index otherwise -1
}; };

@ -1,14 +1,9 @@
/* /*
* Authors : Kerem Yollu & Edwin Koch
* Date : 07.03.2021
* *
* * Description :
* * TODO : Write description or doxygene
*
*
*
*
*
*
*
* *
*/ */
@ -27,16 +22,10 @@ int initPlatform()
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
errorHandle.addNewError(-34,"Test eroor 1"); errorHandle.addNewError(-34,"Test eroor 1");
errorHandle.addNewError(-33,"Test eroor 2");
errorHandle.addNewError(-23,"Test eroor 3");
errorHandle.addNewError(-1,"Test eroor 4");
errorHandle.addNewError(-34, "Test eroor 5");
errorHandle.addNewError(-34,"Test eroor 6");
// errorHandle.handleError(-34); // errorHandle.handleError(-34);
errorHandle.addNewError(-34,"Test eroor"); errorHandle.addNewError(-34,"Test eroor");

Binary file not shown.
Loading…
Cancel
Save