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 * Mayaエラー出力ヘッダ 00022 * @author Junpee 00023 */ 00024 00025 #ifndef MAYA_ERROR_H_ 00026 #define MAYA_ERROR_H_ 00027 00028 /** 00029 * Mayaメッセージ出力 00030 * @param mayaMessage メッセージ 00031 */ 00032 #define MayaMessageOut(mayaMessage) \ 00033 (MayaErrorOutput::mayaMessageOutput(mayaMessage)) 00034 00035 /** 00036 * Mayaエラー出力 00037 * @param mayaErrorMessage エラーメッセージ 00038 */ 00039 #define MayaErrorOut(mayaErrorMessage) \ 00040 (MayaErrorOutput::mayaErrorOutput((mayaErrorMessage), __FILE__, __LINE__)) 00041 00042 /** 00043 * Mayaステータスチェック 00044 * @param mayaStatusCheck チェックするステータス 00045 * @return ステータスが正常ならtrue 00046 */ 00047 #define MayaStatusCheck(mayaStatusCheck) \ 00048 (MayaErrorOutput::mayaErrorCheck(\ 00049 MStatus(mayaStatusCheck), __FILE__, __LINE__)) 00050 00051 /** 00052 * MayaOpenGLエラーチェック 00053 * @return ステータスが正常ならtrue 00054 */ 00055 #define MayaOpenGLCheck() \ 00056 (MayaErrorOutput::mayaOpenGLErrorCheck(__FILE__, __LINE__)) 00057 00058 namespace LampForMaya{ 00059 00060 //------------------------------------------------------------------------------ 00061 /** 00062 * Mayaエラー出力 00063 */ 00064 class MayaErrorOutput{ 00065 public: 00066 /** 00067 * 初期化 00068 */ 00069 static void initialize(); 00070 00071 /** 00072 * メッセージ出力 00073 * @param message メッセージ 00074 */ 00075 static void mayaMessageOutput(const char* message); 00076 00077 /** 00078 * メッセージ出力 00079 * @param message メッセージ 00080 */ 00081 static void mayaMessageOutput(const String& message); 00082 00083 /** 00084 * メッセージ出力 00085 * @param message メッセージ 00086 */ 00087 static void mayaMessageOutput(const MString& message); 00088 00089 /** 00090 * エラー出力 00091 * @param message エラーメッセージ 00092 * @param fileName ファイル名 00093 * @param lineNumber ライン番号 00094 */ 00095 static void mayaErrorOutput( 00096 const char* message, const char* fileName, int lineNumber); 00097 00098 /** 00099 * エラー出力 00100 * @param message エラーメッセージ 00101 * @param fileName ファイル名 00102 * @param lineNumber ライン番号 00103 */ 00104 static void mayaErrorOutput( 00105 const String& message, const char* fileName, int lineNumber); 00106 00107 /** 00108 * エラー出力 00109 * @param message エラーメッセージ 00110 * @param fileName ファイル名 00111 * @param lineNumber ライン番号 00112 */ 00113 static void mayaErrorOutput( 00114 const MString& message, const char* fileName, int lineNumber); 00115 00116 /** 00117 * エラーチェック 00118 * @param status ステータス 00119 * @param fileName ファイル名 00120 * @param lineNumber ライン番号 00121 * @return エラーでなければtrue 00122 */ 00123 static bool mayaErrorCheck( 00124 const MStatus& status, const char* fileName, int lineNumber); 00125 00126 /** 00127 * OpenGLエラーチェック 00128 * @param fileName ファイル名 00129 * @param lineNumber ライン番号 00130 * @return エラーでなければtrue 00131 */ 00132 static bool mayaOpenGLErrorCheck(const char* fileName, int lineNumber); 00133 00134 /** 00135 * Maya用エラーハンドラ 00136 * @param message エラーメッセージ 00137 */ 00138 static void errorHandler(const char* message); 00139 00140 private: 00141 // コンストラクタの隠蔽 00142 MayaErrorOutput(); 00143 00144 }; 00145 00146 //------------------------------------------------------------------------------ 00147 } // End of namespace LampForMaya 00148 #endif // End of MAYA_ERROR_H_ 00149 //------------------------------------------------------------------------------