From c91690b4dc12c0950113ca51bc2d0cb61f48b93d Mon Sep 17 00:00:00 2001 From: Sergi Hernandez <shernand@iri.upc.edu> Date: Fri, 19 Feb 2021 13:05:34 +0100 Subject: [PATCH] Removed the exceptions module because it was not used. --- include/model_car_exceptions.h | 81 ---------------------------------- src/model_car_exceptions.cpp | 22 --------- 2 files changed, 103 deletions(-) delete mode 100644 include/model_car_exceptions.h delete mode 100644 src/model_car_exceptions.cpp diff --git a/include/model_car_exceptions.h b/include/model_car_exceptions.h deleted file mode 100644 index af42da1..0000000 --- a/include/model_car_exceptions.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef MODEL_CAR_EXCEPTIONS -#define MODEL_CAR_EXCEPTIONS - -#include "exceptions.h" -#include <stdint.h> - -/** - * \brief CModel_Car_Drivers_Base exception class - * - * This class implements the exceptions for the CModel_Car_Drivers_Base class. - * - * Similarly to other exception classes, it appends a class identifer - * string ("[CModel_Car_Drivers_Base] - ") to the error message in order to identify the - * class that generated the exception. - * - * The base class can be used to catch any exception thrown by the application - * or also, this class can be used in order to catch only exceptions generated - * by CModel_Car_Drivers_Base objects. - * - */ -class CModelCarException : public CException -{ - public: - /** - * \brief Constructor - * - * The constructor calls the base class constructor to add the general - * exception identifier and then adds the class identifier string - * "[CModel_Car_Drivers_Base class]" and the supplied error message. - * - * - * \verbatim - * [Exception caught] - <where> - * [CModel_Car_Drivers_Base class] - <error message> - * \endverbatim - * - * \param where a null terminated string with the information about the name - * of the function, the source code filename and the line where - * the exception was generated. This string must be generated - * by the _HERE_ macro. - * - * \param error_msg a null terminated string that contains the error message. - * This string may have any valid character and there is no - * limit on its length. - * - * - */ - CModelCarException(const std::string& where, const std::string& error_msg); - - /** - * \brief Constructor - * - * The constructor calls the base class constructor to add the general - * exception identifier and then adds the class identifier string - * "[CModel_Car_Drivers_Base class]", the supplied error message and the hexadecimal message received. - * - * - * \verbatim - * [Exception caught] - <where> - * [CModel_Car_Drivers_Base class] - <error message> - * [Serial message] - <serial_msg> - * \endverbatim - * - * \param where a null terminated string with the information about the name - * of the function, the source code filename and the line where - * the exception was generated. This string must be generated - * by the _HERE_ macro. - * - * \param error_msg a null terminated string that contains the error message. - * This string may have any valid character and there is no - * limit on its length. - * - * \param serial_msg Pointer to the message received by Serial port. - * - * \param msg_length Serial message length. - * - */ - CModelCarException(const std::string& where, const std::string& error_msg, const uint8_t *serial_msg, uint8_t msg_length); -}; - -#endif diff --git a/src/model_car_exceptions.cpp b/src/model_car_exceptions.cpp deleted file mode 100644 index 9f38a1c..0000000 --- a/src/model_car_exceptions.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "model_car_exceptions.h" -#include <string.h> -#include <stdio.h> -#include <iomanip> - -const std::string model_car_driver_base_exception_msg="[CModel_Car_Drivers_Base class] - "; - -CModelCarException::CModelCarException(const std::string& where, const std::string& error_msg):CException(where, model_car_driver_base_exception_msg) -{ - this->error_msg+=error_msg; -} - -CModelCarException::CModelCarException(const std::string& where, const std::string& error_msg, const uint8_t *serial_msg, uint8_t msg_length):CException(where, model_car_driver_base_exception_msg) -{ - this->error_msg += error_msg; - std::ostringstream ss; - for (uint8_t i = 0; i < msg_length; i++) - ss << "0x" << std::hex << std::setw(2) << std::setfill('0') << (int)serial_msg[i]; - std::string msg_string(ss.str()); - this->error_msg += "\n[Serial message] - "; - this->error_msg += msg_string; -} -- GitLab