vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HelperMacros.h
Go to the documentation of this file.
1 #ifndef HELPER_MACROS_H
2 #define HELPER_MACROS_H
3 
4 #include <vrecko/Logger.h>
5 
6 // Macros for error handling:
7 //
8 
9 #define BFAILGOTO(Function) { if (!(Function)) { OUTPUTSTR3("\n%s(%d): An error occured!", __FILE__, __LINE__); goto FuncFailed; } }
10 #define BFAILGOTO_TEXT(Function, TextFunc) { if (!(Function)) { { OUTPUTSTR3("\n%s(%d): Following error occured:", __FILE__, __LINE__); TextFunc; } goto FuncFailed; } }
11 #define BFAILRET(Function) { if (!(Function)) { OUTPUTSTR3("\n%s(%d): An error occured!", __FILE__, __LINE__); return false; } }
12 #define BFAILRET_TEXT(Function, TextFunc) { if (!(Function)) { { OUTPUTSTR3("\n%s(%d): Following error occured:", __FILE__, __LINE__); TextFunc; } return false; } }
13 
14 
15 #ifndef SAFE_DELETE
16  #define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
17 #endif
18 
19 #ifndef SAFE_FREE
20  #define SAFE_FREE(p) { if(p) { free (p); (p)=NULL; } }
21 #endif
22 
23 
24 #endif