Main Page | Namespace List | Class List | Directories | File List | Namespace Members | Class Members | File Members

error_checker.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 #ifndef _ERRORCHECKER_H_
00018 #define _ERRORCHECKER_H_
00019 
00020 // includes, maya
00021 #include <maya/MStatus.h>
00022 
00023 
00025 class ErrorChecker {
00026 
00027 public:
00028 
00031   static void 
00032   checkErrorGL(const char* file = "-" , const int line = -1);
00033 
00035   static void  
00036   checkFrameBufferStatus();
00037 
00040   //   this version prints an error and terminates the program, no exception is thrown.
00041   inline  static void
00042   condition( bool val, const char* file, const int line);
00043 
00046   inline  static void
00047   mayaStatus( const MStatus& status, const char* file, const int line);
00048 
00049 };
00050 
00051 // includes, system
00052 #include <iostream>
00053 
00057 //   this version prints an error and terminates the program, no exception is thrown.
00059 /* static */ inline void
00060 ErrorChecker::condition( bool val, const char* file, const int line) {
00061 
00062   if ( ! val) {
00063 
00064     std::cerr << "Condition failed: " << file << " in line " << line << std::endl;
00065 
00066     // exit(EXIT_FAILURE);
00067   }
00068 }
00069 
00074 /* static */ inline void
00075 ErrorChecker::mayaStatus( const MStatus& status, const char* file, const int line) {
00076 
00077   if ( MS::kSuccess != status) { 
00078 
00079     std::cerr << "Maya status error: " << file << " in line " << line << std::endl;
00080 
00081     // exit(EXIT_FAILURE);
00082   }
00083 }
00084 
00087 
00088 #define CHECK_ERROR_GL() ErrorChecker::checkErrorGL( __FILE__, __LINE__)
00089 
00090 #define CONDITION( val) ErrorChecker::condition( val, __FILE__, __LINE__)
00091 
00092 #define CHECK_MAYA( val) ErrorChecker::mayaStatus( val, __FILE__, __LINE__)
00093 
00094 #endif // _ERRORCHECKER_H_

Generated on Sat Dec 31 18:07:49 2005 for ICaster by  doxygen 1.4.4