| THM1176InstrumentDriver 1.2 C++ API for Metrolab THM1176

Loading...
Searching...
No Matches
Exception.h
Go to the documentation of this file.
1
4
5#pragma once
6
7// Standard includes
8#include <exception>
9#include <string>
10
11 namespace MTL
12{
15 template<class A>
16 class CException : public std::exception
17 {
18 protected:
19 std::string m_Message;
20 std::string m_ThrownLocation;
21 std::string m_What;
22
23 public:
27 CException(std::string const & rMessage, std::string const & rThrownLocation)
28 : m_Message(rMessage), m_ThrownLocation(rThrownLocation)
29 {
30 m_What = m_ThrownLocation + " : " + m_Message + "\n";
31 }
32
34 virtual const char * what() const noexcept
35 {
36 return m_What.c_str();
37 }
38
40 const char * message() const noexcept
41 {
42 return m_Message.c_str();
43 }
44
46 const char * context() const noexcept
47 {
48 return m_ThrownLocation.c_str();
49 }
50 };
51} // namespace MTL
MTL::CException::message
const char * message() const noexcept
Return the message.
Definition Exception.h:40
MTL::CException::CException
CException(std::string const &rMessage, std::string const &rThrownLocation)
Constructor.
Definition Exception.h:27
MTL::CException::what
virtual const char * what() const noexcept
Return string describing what happened.
Definition Exception.h:34
MTL::CException::context
const char * context() const noexcept
Return the context.
Definition Exception.h:46
MTL::CException::m_What
std::string m_What
Debugging output, with message and location.
Definition Exception.h:21
MTL::CException::m_ThrownLocation
std::string m_ThrownLocation
Context in which exception was thrown.
Definition Exception.h:20
MTL::CException::m_Message
std::string m_Message
Message describing the exception.
Definition Exception.h:19
MTL
Definition THM1176.h:73