27 #ifndef EMBB_BASE_EXCEPTIONS_H_ 28 #define EMBB_BASE_EXCEPTIONS_H_ 30 #ifdef EMBB_PLATFORM_COMPILER_MSVC 33 #pragma warning(disable : 4530) 34 #endif // EMBB_PLATFORM_COMPILER_MSVC 39 #ifdef EMBB_PLATFORM_COMPILER_MSVC 43 #include <embb/base/internal/cmake_config.h> 44 #include <embb/base/c/errors.h> 75 #ifdef EMBB_USE_EXCEPTIONS 77 #define EMBB_THROW(Type, Message) throw Type(Message); 78 #define EMBB_CATCH(Statement) catch(Statement) 82 #include <embb/base/c/internal/unused.h> 87 #define EMBB_CATCH_VAR_CAT2(X, Y) X##Y 91 #define EMBB_CATCH_VAR_CAT1(X, Y) EMBB_CATCH_VAR_CAT2(X, Y) 97 #define EMBB_CATCH_VAR EMBB_CATCH_VAR_CAT1(embb_catch_var_, __LINE__) 107 #define EMBB_CATCH(Statement) \ 108 int EMBB_CATCH_VAR = false; \ 109 EMBB_UNUSED(EMBB_CATCH_VAR); \ 115 #define EMBB_THROW(Type, Message) \ 119 "Exit program due to (not thrown) " #Type ": %s\n", e.what()); \ 140 ) : message_(message) {}
153 ) : message_(e.message_) {}
164 message_ = e.message_;
173 virtual const char*
What()
const throw() {
182 virtual int Code()
const = 0;
188 const char* message_;
279 #endif // EMBB_BASE_EXCEPTIONS_H_ Definition: lock_free_mpmc_queue.h:40
Indicates lack of memory necessary to allocate a resource.
Definition: exceptions.h:196
virtual int Code() const =0
Returns an integer code representing the exception.
ResourceBusyException(const char *message)
Constructs an exception with the specified message.
Definition: exceptions.h:218
Exception(const Exception &e)
Constructs an exception by copying from an existing one.
Definition: exceptions.h:150
Indicates a general error.
Definition: exceptions.h:264
virtual int Code() const
Returns an integer code representing the exception.
Definition: exceptions.h:256
virtual const char * What() const
Returns the error message.
Definition: exceptions.h:173
virtual ~Exception()
Destructs the exception.
Definition: exceptions.h:145
NoMemoryException(const char *message)
Constructs an exception with the specified message.
Definition: exceptions.h:201
Error, not enough memory.
Definition: errors.h:48
virtual int Code() const
Returns an integer code representing the exception.
Definition: exceptions.h:273
Abstract base class for exceptions.
Definition: exceptions.h:132
virtual int Code() const
Returns an integer code representing the exception.
Definition: exceptions.h:205
UnderflowException(const char *message)
Constructs an exception with the specified message.
Definition: exceptions.h:235
Indicates a numeric underflow.
Definition: exceptions.h:230
virtual int Code() const
Returns an integer code representing the exception.
Definition: exceptions.h:239
Resource busy.
Definition: errors.h:50
Indicates business (unavailability) of a required resource.
Definition: exceptions.h:213
ErrorException(const char *message)
Constructs an exception with the specified message.
Definition: exceptions.h:269
Error, numeric underflow.
Definition: errors.h:52
Exception(const char *message)
Constructs an exception with a custom message.
Definition: exceptions.h:137
Indicates a numeric overflow.
Definition: exceptions.h:247
virtual int Code() const
Returns an integer code representing the exception.
Definition: exceptions.h:222
OverflowException(const char *message)
Constructs an exception with the specified message.
Definition: exceptions.h:252
Error, not further specified.
Definition: errors.h:53
Exception & operator=(const Exception &e)
Assigns an existing exception.
Definition: exceptions.h:160
Error, numeric overflow.
Definition: errors.h:51