FUtils/FUAssert.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2005-2007 Feeling Software Inc.
00003     Portions of the code are:
00004     Copyright (C) 2005-2007 Sony Computer Entertainment America
00005     
00006     MIT License: http://www.opensource.org/licenses/mit-license.php
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 // This is unfortunately what we get on non-WIN
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_

Generated on Thu Feb 14 16:58:35 2008 for FCollada by  doxygen 1.4.6-NO