Initial commit
This commit is contained in:
53
Include/ZUtil/ZAssert.hpp
Normal file
53
Include/ZUtil/ZAssert.hpp
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
ZAssert.hpp
|
||||
Author : Chris Ertel
|
||||
|
||||
Purpose : Asserts for debugging and error checking purposes.
|
||||
|
||||
Changelog
|
||||
8/16/2010 - creation (crertel)
|
||||
12/4/2011 - Updated to use libsst-os asserts (jcrussell)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef _ZASSERT_H
|
||||
#define _ZASSERT_H
|
||||
|
||||
#include <SST/SST_Assert.h>
|
||||
|
||||
/*****************/
|
||||
/* Assert Macros */
|
||||
/*****************/
|
||||
|
||||
//ZASSERT_RUNTIME macro, which will raise an error with debug output if the condition is not true after logging the message
|
||||
#define ZASSERT_RUNTIME(_condition, _message) SST_OS_RuntimeAssert(_condition, _message)
|
||||
|
||||
//ZASSERT_RUNTIME_FAIL macro, which will raise an error with debug output
|
||||
#define ZASSERT_RUNTIME_FAIL(_message) SST_OS_RuntimeError(_message)
|
||||
|
||||
#if ZASSERT_ENABLE
|
||||
|
||||
//ZASSERT macro, which will trigger a breakpoint if the condition is not met
|
||||
#define ZASSERT(_condition, _message) SST_OS_DebugAssert(_condition, _message)
|
||||
|
||||
//ZASSERT_FAIL macro, which triggers a breakpoint
|
||||
#define ZASSERT_FAIL(_message) SST_OS_DebugError(_message)
|
||||
|
||||
#else /* ZASSERT is disabled */
|
||||
#define ZASSERT(_condition, _message)
|
||||
#define ZASSERT_FAIL(_message)
|
||||
#endif //ZASSERT_ENABLE
|
||||
|
||||
#if ZASSERT_UTIL_ENABLE
|
||||
|
||||
//ZASSERT_UTIL macro, which will trigger a breakpoint if the condition is not met
|
||||
//ZASSERT_UTIL is meant to be used within the ZUtil project for internal assertion debugging
|
||||
//ZASSERT should be used when the error condition can be caused by user actions
|
||||
#define ZASSERT_UTIL(_condition, _message) SST_OS_DebugAssert(_condition, _message)
|
||||
|
||||
#else /* ZASSERT_UTIL is disabled */
|
||||
#define ZASSERT_UTIL(_condition, _message) ((void)0)
|
||||
#endif //ZASSERT_UTIL_ENABLE
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user