NGL  6.5
The NCCA Graphics Library
NGLassert.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009 Jon Macey
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17 #ifndef NGLASSERT_H_
18 #define NGLASSERT_H_
19 
20 //----------------------------------------------------------------------------------------------------------------------
23 //----------------------------------------------------------------------------------------------------------------------
33 //----------------------------------------------------------------------------------------------------------------------
34 
35 
36 //----------------------------------------------------------------------------------------------------------------------
37 // now if we are in debug mode use these macros
38 #if defined(NGL_DEBUG)
39 
40  #include <iostream>
41  #define NGL_ASSERT(X) \
42  if(!(X)) \
43  { \
44  std::cerr << "Assertion failed :"<< #X \
45  << "\nFailure occured on line " \
46  << __LINE__ << " of source file :" \
47  << "\n \""<<__FILE__<<"\"" << std::endl; \
48  }
49 
50 
51 //----------------------------------------------------------------------------------------------------------------------
52 #else
53  #define NGL_ASSERT(X)
54 
55 #endif // #if defined(NGL_DEBUG)
56 
57 #endif // __NGLASSERT_H__
58 
59 
60 
61 
62 
63 
64 
65 
66