Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

macros.h

00001 /***************************************************************************
00002                           macros.h  -  description
00003       $Id: macros.h 42 2006-09-10 16:03:31Z neoneurone $
00004                              -------------------
00005     begin                : dim sep 21 2003
00006     copyright            : (C) 2003-2006 by Duong-Khang NGUYEN
00007     email                : neoneurone @ users sourceforge net
00008  ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   any later version.                                                    *
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019 #ifndef _OPENCITY_MACROS_H_
00020 #define _OPENCITY_MACROS_H_ 1
00021 
00022 #include <iostream>
00023 #include <cassert>          // for assert() => ifdef NDEBUG: do nothing
00024 using std::cout;
00025 using std::endl;
00026 using std::cerr;
00027 
00028 // Debug message macro
00029     #ifndef NDEBUG
00030         #define OPENCITY_DEBUG( msg ) { \
00031             cout << "<DEBUG> " << __FILE__ << " " << __LINE__ << " : " << msg << endl; \
00032         }
00033     #else
00034         #define OPENCITY_DEBUG(msg)
00035     #endif
00036 
00037 // Information message macro
00038     #define OPENCITY_INFO( msg ) { \
00039         cout << "<INFO> " << msg << endl; \
00040     }
00041 
00042 // Error message macro
00043     #define OPENCITY_ERROR( msg ) { \
00044         cout << "<ERROR> " << msg << endl; \
00045     }
00046 
00047 // Fatal message macro
00048     #define OPENCITY_FATAL( msg ) { \
00049         cerr << "<FATAL> " << msg << endl; \
00050     }
00051     
00052 // Swap two variables so that a <= b
00053     #define OPENCITY_SWAP( a, b, type ) \
00054     {\
00055         if (a > b) {   \
00056             type c;\
00057             c = a; a = b; b = c;\
00058         }\
00059     }
00060     
00061 // uint for unsigned int
00062    #ifndef uint
00063        typedef unsigned int uint;
00064    #endif
00065 
00066 
00067 #endif
00068 

Generated on Sat Nov 11 10:21:10 2006 for OpenCity by  doxygen 1.4.2