Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

Assert.h

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------
00002 // Lamp : Open source game middleware
00003 // Copyright (C) 2004  Junpei Ohtani ( Email : junpee@users.sourceforge.jp )
00004 //
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 //------------------------------------------------------------------------------
00019 
00020 /** @file
00021  * アサートヘッダ
00022  * @author Junpee
00023  */
00024 #ifndef ASSERT_H_
00025 #define ASSERT_H_
00026 //------------------------------------------------------------------------------
00027 // デバッグ時
00028 #ifdef _DEBUG
00029 
00030 /**
00031  * アサート
00032  * @param expression falseだとアサートが発生します
00033  *
00034  * アサートの引数がfalseの場合、アサートが発生しデバッガがブレークします。
00035  * そしてアサートが発生したファイル名と行数をデバッグ出力に出力します。
00036  */
00037 #define Assert(expression) \
00038     if(!(expression)){\
00039         DebugOut("Assert %s %d\n", __FILE__, __LINE__);\
00040         _asm{ int 3 }\
00041     }
00042 
00043 /**
00044  * メッセージ付アサート
00045  * @param expression falseだとアサートが発生します
00046  * @param message アサート時に出力するメッセージ
00047  *
00048  * アサートの引数がfalseの場合、アサートが発生しデバッガがブレークします。
00049  * そしてメッセージと、アサートが発生したファイル名と行数をデバッグ出力に出力します。
00050  */
00051 #define AssertMessage(expression, message) \
00052     if(!(expression)){\
00053         DebugOut("Assert %s\n%s %d\n", message, __FILE__, __LINE__);\
00054         _asm{ int 3 }\
00055     }
00056 
00057 //------------------------------------------------------------------------------
00058 // 非デバッグ時
00059 #else // _DEBUG
00060 
00061 /// アサートダミー
00062 #define Assert(expression)
00063 
00064 /// メッセージ付アサートダミー
00065 #define AssertMessage(expression, message)
00066 
00067 #endif// End of _DEBUG
00068 
00069 //------------------------------------------------------------------------------
00070 #endif // End of ASSERT_H_
00071 //------------------------------------------------------------------------------

Generated on Wed Mar 16 10:29:27 2005 for Lamp by doxygen 1.3.2