HART  0.2.0
High level Audio Regression and Testing
Loading...
Searching...
No Matches
hart_exceptions.hpp File Reference
#include <iostream>
#include <stdexcept>
Include dependency graph for hart_exceptions.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  TestAssertException
 Thrown by test asserts like HART_ASSERT_TRUE() and AudioTestBuilder::assertFalse() More...
 
class  IOError
 Thrown when some I/O operation fails. More...
 
class  StateError
 Thrown when some unexpected state is encountered. More...
 
class  SizeError
 Thrown when an unexpected container size is encountered. More...
 
class  ValueError
 Thrown when an inappropriate value is encountered. More...
 
class  SampleRateError
 Thrown when sample rate is mismatched. More...
 
class  ChannelLayoutError
 Thrown when a numbers of channels is mismatched. More...
 
class  HartAssertException
 Thrown when hassert() or hassertfalse are triggered. More...
 
class  UnsupportedError
 Thrown when some parameter has an unsupported value. More...
 
class  ConfigurationError
 Thrown when the test runner is misconfigured. More...
 
class  IndexError
 Thrown when a container index is out of range. More...
 
class  NullPointerError
 Thrown when a nullptr could be handled gracefully. More...
 

Namespaces

namespace  hart
 

Macros

#define HART_STRINGIFY(x)   HART_STRINGIFY2(x)
 
#define HART_STRINGIFY2(x)   #x
 
#define HART_LINE_STRING   HART_STRINGIFY(__LINE__)
 
#define HART_THROW_IMPL(ExceptionType, message)   throw ExceptionType (std::string (message) + ", file: " __FILE__ ", line: " HART_LINE_STRING)
 
#define HART_THROW(ExceptionType, message)   do { HART_THROW_IMPL(ExceptionType, message); } while (0)
 Throws an exception if HART_DO_NOT_THROW_EXCEPTIONS is set, prints a message otherwise.
 
#define HART_THROW_OR_RETURN(ExceptionType, message, returnValue)   HART_THROW (ExceptionType, message)
 Throws an exception if HART_DO_NOT_THROW_EXCEPTIONS is set, prints a message and returns a specified value otherwise.
 
#define HART_THROW_OR_RETURN_VOID(ExceptionType, message)   HART_THROW (ExceptionType, message)
 Throws an exception if HART_DO_NOT_THROW_EXCEPTIONS is set, prints a message and returns otherwise.
 
#define HART_THROW_OR_CONTINUE(ExceptionType, message)   HART_THROW (ExceptionType, message)
 Throws an exception if HART_DO_NOT_THROW_EXCEPTIONS is set, prints a message and jumps to the next iteration (via continue) otherwise.
 
#define hassertfalse   HART_THROW (hart::HartAssertException, "hassertfalse failed")
 Triggers a HartAssertException
 
#define hassert(condition)   if (! (condition)) { HART_THROW (hart::HartAssertException, std::string ("hassert failed:") + #condition); }
 Triggers a HartAssertException if the condition is false
 
#define HART_WARNING(message)   std::cout << "Warning: " << message << ", file: " << __FILE__ << ", line: " << __LINE__ << std::endl
 Prints a warning message.
 

Macro Definition Documentation

◆ HART_STRINGIFY

#define HART_STRINGIFY (   x)    HART_STRINGIFY2(x)

Definition at line 109 of file hart_exceptions.hpp.

◆ HART_STRINGIFY2

#define HART_STRINGIFY2 (   x)    #x

Definition at line 110 of file hart_exceptions.hpp.

◆ HART_LINE_STRING

#define HART_LINE_STRING   HART_STRINGIFY(__LINE__)

Definition at line 113 of file hart_exceptions.hpp.

◆ HART_THROW_IMPL

#define HART_THROW_IMPL (   ExceptionType,
  message 
)    throw ExceptionType (std::string (message) + ", file: " __FILE__ ", line: " HART_LINE_STRING)

Definition at line 137 of file hart_exceptions.hpp.