Loading...
Searching...
No Matches
ocsd_error.h
Go to the documentation of this file.
/*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ARM_OCSD_ERROR_H_INCLUDED
#define ARM_OCSD_ERROR_H_INCLUDED
#include "opencsd/ocsd_if_types.h"
#include <string>
class ocsdError {
public:
ocsdError(const ocsd_err_severity_t sev_type, const ocsd_err_t code);
ocsdError(const ocsd_err_severity_t sev_type, const ocsd_err_t code, const ocsd_trc_index_t idx);
ocsdError(const ocsd_err_severity_t sev_type, const ocsd_err_t code, const ocsd_trc_index_t idx, const uint8_t chan_id);
ocsdError(const ocsd_err_severity_t sev_type, const ocsd_err_t code, const std::string &msg);
ocsdError(const ocsd_err_severity_t sev_type, const ocsd_err_t code, const ocsd_trc_index_t idx, const std::string &msg);
ocsdError(const ocsd_err_severity_t sev_type, const ocsd_err_t code, const ocsd_trc_index_t idx, const uint8_t chan_id, const std::string &msg);
ocsdError(const ocsdError *pError);
ocsdError(const ocsdError &Error);
~ocsdError();
ocsdError& operator=(const ocsdError *p_err);
ocsdError& operator=(const ocsdError &err);
void setMessage(const std::string &msg) { m_err_message = msg; };
const std::string &getMessage() const { return m_err_message; };
const ocsd_err_t getErrorCode() const { return m_error_code; };
const ocsd_err_severity_t getErrorSeverity() const { return m_sev; };
const ocsd_trc_index_t getErrorIndex() const { return m_idx; };
const uint8_t getErrorChanID() const { return m_chan_ID; };
static const std::string getErrorString(const ocsdError &error);
private:
static void appendErrorDetails(std::string &errStr, const ocsdError &error);
ocsdError();
ocsd_err_t m_error_code;
ocsd_err_severity_t m_sev;
ocsd_trc_index_t m_idx;
uint8_t m_chan_ID;
std::string m_err_message;
};
inline ocsdError& ocsdError::operator=(const ocsdError *p_err)
{
this->m_error_code = p_err->getErrorCode();
this->m_sev = p_err->getErrorSeverity();
this->m_idx = p_err->getErrorIndex();
this->m_chan_ID = p_err->getErrorChanID();
this->m_err_message = p_err->getMessage();
return *this;
}
inline ocsdError& ocsdError::operator=(const ocsdError &err)
{
return (*this = &err);
}
/* class to get data path response values as strings */
class ocsdDataRespStr
{
public:
ocsdDataRespStr(ocsd_datapath_resp_t type) { m_type = type; }
~ocsdDataRespStr() {};
const char* getStr();
private:
ocsd_datapath_resp_t m_type;
};
#endif // ARM_OCSD_ERROR_H_INCLUDED
/* End of File ocsd_error.h */
ocsdDataRespStr
Definition ocsd_error.h:113
ocsdDataRespStr::getStr
const char * getStr()
ocsdDataRespStr::ocsdDataRespStr
ocsdDataRespStr(ocsd_datapath_resp_t type)
Definition ocsd_error.h:115
ocsdDataRespStr::~ocsdDataRespStr
~ocsdDataRespStr()
Definition ocsd_error.h:116
ocsdError
Definition ocsd_error.h:58
ocsdError::getErrorString
static const std::string getErrorString(const ocsdError &error)
ocsdError::getMessage
const std::string & getMessage() const
Definition ocsd_error.h:75
ocsdError::getErrorChanID
const uint8_t getErrorChanID() const
Definition ocsd_error.h:80
ocsdError::operator=
ocsdError & operator=(const ocsdError *p_err)
Definition ocsd_error.h:96
ocsdError::ocsdError
ocsdError(const ocsd_err_severity_t sev_type, const ocsd_err_t code)
ocsdError::getErrorCode
const ocsd_err_t getErrorCode() const
Definition ocsd_error.h:77
ocsdError::~ocsdError
~ocsdError()
ocsdError::getErrorSeverity
const ocsd_err_severity_t getErrorSeverity() const
Definition ocsd_error.h:78
ocsdError::ocsdError
ocsdError(const ocsd_err_severity_t sev_type, const ocsd_err_t code, const ocsd_trc_index_t idx, const uint8_t chan_id)
ocsdError::ocsdError
ocsdError(const ocsd_err_severity_t sev_type, const ocsd_err_t code, const std::string &msg)
ocsdError::getErrorIndex
const ocsd_trc_index_t getErrorIndex() const
Definition ocsd_error.h:79
ocsdError::ocsdError
ocsdError(const ocsd_err_severity_t sev_type, const ocsd_err_t code, const ocsd_trc_index_t idx)
ocsdError::setMessage
void setMessage(const std::string &msg)
Definition ocsd_error.h:74
ocsdError::ocsdError
ocsdError(const ocsdError &Error)
ocsdError::ocsdError
ocsdError(const ocsdError *pError)
ocsdError::ocsdError
ocsdError(const ocsd_err_severity_t sev_type, const ocsd_err_t code, const ocsd_trc_index_t idx, const std::string &msg)
ocsdError::ocsdError
ocsdError(const ocsd_err_severity_t sev_type, const ocsd_err_t code, const ocsd_trc_index_t idx, const uint8_t chan_id, const std::string &msg)
ocsd_trc_index_t
uint32_t ocsd_trc_index_t
Definition ocsd_if_types.h:67
ocsd_datapath_resp_t
enum _ocsd_datapath_resp_t ocsd_datapath_resp_t
ocsd_err_severity_t
enum _ocsd_err_severity_t ocsd_err_severity_t
ocsd_err_t
enum _ocsd_err_t ocsd_err_t
ocsd_if_types.h
OpenCSD : Standard Types used in the library interfaces.