00001
00002
00003
00004
00005
00006
00007
00008
00014 #ifndef _FU_ASSERT_H_
00015 #define _FU_ASSERT_H_
00016
00017 #ifndef _FU_FUNCTOR_H_
00018 #include "FUtils/FUFunctor.h"
00019 #endif // _FU_FUNCTOR_H_
00020
00021 namespace FUAssertion
00022 {
00024 typedef FUStaticFunctor1<const char*, bool> FUAssertCallback;
00025
00029 FCOLLADA_EXPORT void SetAssertionFailedCallback(FUAssertCallback* assertionCallback);
00030
00033 FCOLLADA_EXPORT bool OnAssertionFailed(const char* filename, uint32 line);
00034 };
00035
00036 #ifdef _DEBUG
00037
00038 #ifndef __FILE__
00039
00040 #define __FILE__ "NOT_SET"
00041 #define __LINE__ 0
00042 #endif
00043
00046 #define FUBreak \
00047 static bool ignoreAssert = false; \
00048 if (!ignoreAssert) { ignoreAssert = FUAssertion::OnAssertionFailed(__FILE__, __LINE__); }
00049 #else
00050
00053 #define FUBreak { FUAssertion::OnAssertionFailed(__FILE__, __LINE__); }
00054
00055 #endif // _DEBUG
00056
00059 #define FUFail(command) { FUBreak; command; }
00060
00066 #define FUAssert(condition, fall_back) { if (!(condition)) { FUBreak; fall_back; } }
00067
00068 #endif // _FU_ASSERT_H_