The Open Master Hearing Aid (openMHA)  openMHA
Open community platform for hearing aid algorithm research
Error handling in the openMHA

Errors are reported to the user via the MHA_Error exception. More...

Collaboration diagram for Error handling in the openMHA:

Classes

class  MHA_Error
 Error reporting exception class. More...
 

Macros

#define MHA_ErrorMsg(x)   MHA_Error(__FILE__,__LINE__,"%s",x)
 Throw an openMHA error with a text message. More...
 
#define MHA_assert(x)   if(!(x)) throw MHA_Error(__FILE__,__LINE__,"\"%s\" is false.",#x)
 Assertion macro, which throws an MHA_Error. More...
 
#define MHA_assert_equal(a, b)   if( a != b ) throw MHA_Error(__FILE__,__LINE__,"\"%s == %s\" is false (%s = %g, %s = %g).",#a,#b,#a,(double)(a),#b,(double)(b))
 Equality assertion macro, which throws an MHA_Error with the values. More...
 

Functions

void mha_debug (const char *fmt,...) __attribute__((__format__(printf
 Print an info message (stderr on Linux, OutputDebugString in Windows). More...
 

Detailed Description

Errors are reported to the user via the MHA_Error exception.

Macro Definition Documentation

◆ MHA_ErrorMsg

#define MHA_ErrorMsg (   x)    MHA_Error(__FILE__,__LINE__,"%s",x)

Throw an openMHA error with a text message.

Parameters
xText message.

◆ MHA_assert

#define MHA_assert (   x)    if(!(x)) throw MHA_Error(__FILE__,__LINE__,"\"%s\" is false.",#x)

Assertion macro, which throws an MHA_Error.

Parameters
xBoolean expression which should be true.

◆ MHA_assert_equal

#define MHA_assert_equal (   a,
 
)    if( a != b ) throw MHA_Error(__FILE__,__LINE__,"\"%s == %s\" is false (%s = %g, %s = %g).",#a,#b,#a,(double)(a),#b,(double)(b))

Equality assertion macro, which throws an MHA_Error with the values.

Parameters
aNumeric expression which can be converted to double (for printing).
bNumeric expression which should be equal to a

Function Documentation

◆ mha_debug()

void mha_debug ( const char *  fmt,
  ... 
)

Print an info message (stderr on Linux, OutputDebugString in Windows).