AppVerify.h File Reference

Macros which perform verification with logging. More...

Go to the source code of this file.

Defines

#define LogVerificationError(pExpression, pMsg)   LogVerificationErrorProc(pExpression, __FILE__, __LINE__, pMsg)
#define VERIFY_ACTION(expr, action, msg)
#define VERIFY_VALUE(expr, value1, value2, msg)
#define VERIFYRV_MSG(expr, rv, msg)   VERIFY_ACTION(expr, return rv, msg)
#define VERIFYNRV_MSG(expr, msg)   VERIFY_ACTION(expr, return, msg)
#define VERIFYNR_MSG(expr, msg)   VERIFY_VALUE(expr, false, true, msg)
#define VERIFYNR(expr)   VERIFYNR_MSG(expr, NULL)
#define NN(ptr)   VERIFYNR(ptr != NULL)
#define VERIFY_MSG(expr, msg)   VERIFYRV_MSG(expr, false, msg)
#define VERIFYRV(expr, rv)   VERIFYRV_MSG(expr, rv, NULL)
#define VERIFY(expr)   VERIFYRV(expr, false)
#define VERIFYNRV(expr)   VERIFYNRV_MSG(expr, NULL)
#define LOG_IF(expr, action)   VERIFY_ACTION(!(expr), action, NULL)
#define LOG_IF_ELSE(expr, value1, value2)   VERIFY_VALUE(!(expr), value1, value2, NULL)
#define DO_IF(expr, action)
#define VERIFY_DEBUG(s)   VERIFY(s)
#define VERIFYRV_DEBUG(s, rv)   VERIFYRV(s, rv)
#define VERIFYNRV_DEBUG(s)   VERIFYNRV(s)

Functions

void LogVerificationErrorProc (const char *pExpression, const char *pFilename, unsigned int line, const char *pMsg)


Detailed Description

Macros which perform verification with logging.

These macros allow for concise verification of boolean expressions. When an expression is false, they log an error to the message log then return, with an optional return value, or throw an exception.

Definition in file AppVerify.h.


Define Documentation

#define DO_IF ( expr,
action   ) 

Value:

if (expr) \
{ \
   action; \
}
If expr is true, perform the specified action.

This is like LOG_IF without logging.

Definition at line 108 of file AppVerify.h.

#define LOG_IF ( expr,
action   )     VERIFY_ACTION(!(expr), action, NULL)

If expr is true, log msg and perform the specified action.

Definition at line 98 of file AppVerify.h.

#define LOG_IF_ELSE ( expr,
value1,
value2   )     VERIFY_VALUE(!(expr), value1, value2, NULL)

If expr is true, log msg and evaluate to value1, else evaluate to value2.

Definition at line 103 of file AppVerify.h.

#define LogVerificationError ( pExpression,
pMsg   )     LogVerificationErrorProc(pExpression, __FILE__, __LINE__, pMsg)

Add a log message stating that pExpression failed and add pMsg if not NULL.

Definition at line 24 of file AppVerify.h.

#define NN ( ptr   )     VERIFYNR(ptr != NULL)

If ptr is NULL, log a message and evaluate to false, else evaluate to true.

Definition at line 73 of file AppVerify.h.

#define VERIFY ( expr   )     VERIFYRV(expr, false)

If expr is false, log a message and return false from the current function.

Examples:
SampleRasterElementImporter.cpp, Tutorial/Tutorial1.cpp, Tutorial/Tutorial2.cpp, Tutorial/Tutorial3.cpp, Tutorial/Tutorial4.cpp, and Tutorial/Tutorial5.cpp.

Definition at line 88 of file AppVerify.h.

#define VERIFY_ACTION ( expr,
action,
msg   ) 

Value:

if (!(expr)) \
{\
   LogVerificationError(#expr, msg);\
   action;\
}
If expr is false, log msg and perform the specified action.

Definition at line 31 of file AppVerify.h.

#define VERIFY_DEBUG (  )     VERIFY(s)

Definition at line 119 of file AppVerify.h.

#define VERIFY_MSG ( expr,
msg   )     VERIFYRV_MSG(expr, false, msg)

If expr is false, log msg and return false from the current function.

Definition at line 78 of file AppVerify.h.

#define VERIFY_VALUE ( expr,
value1,
value2,
msg   ) 

Value:

( \
   !(expr) ? \
      LogVerificationError(#expr, msg), \
      value1 \
   : \
   value2 \
)
If expr is false, log msg and evaluate to value1, else evaluate to value2.

Definition at line 41 of file AppVerify.h.

#define VERIFYNR ( expr   )     VERIFYNR_MSG(expr, NULL)

If expr is false, log a message and evaluate to false, else evaluate to true.

Definition at line 68 of file AppVerify.h.

#define VERIFYNR_MSG ( expr,
msg   )     VERIFY_VALUE(expr, false, true, msg)

If expr is false, log msg and evaluate to false, else evaluate to true.

Definition at line 63 of file AppVerify.h.

#define VERIFYNRV ( expr   )     VERIFYNRV_MSG(expr, NULL)

If expr is false, log a message and return from the current function.

Examples:
Tutorial/Tutorial5.cpp.

Definition at line 93 of file AppVerify.h.

#define VERIFYNRV_DEBUG (  )     VERIFYNRV(s)

Definition at line 121 of file AppVerify.h.

#define VERIFYNRV_MSG ( expr,
msg   )     VERIFY_ACTION(expr, return, msg)

If expr is false, log msg and return from the current function.

Definition at line 58 of file AppVerify.h.

#define VERIFYRV ( expr,
rv   )     VERIFYRV_MSG(expr, rv, NULL)

If expr is false, log a message and return rv from the current function.

Examples:
SampleRasterElementImporter.cpp.

Definition at line 83 of file AppVerify.h.

#define VERIFYRV_DEBUG ( s,
rv   )     VERIFYRV(s, rv)

Definition at line 120 of file AppVerify.h.

#define VERIFYRV_MSG ( expr,
rv,
msg   )     VERIFY_ACTION(expr, return rv, msg)

If expr is false, log msg and return rv from the current function.

Definition at line 53 of file AppVerify.h.


Function Documentation

void LogVerificationErrorProc ( const char *  pExpression,
const char *  pFilename,
unsigned int  line,
const char *  pMsg 
)


Software Development Kit - Opticks 4.9.0 Build 16218