00001 #ifndef SCTCALIBRATIONCONTROLLER_SCTAPICALL_H 00002 #define SCTCALIBRATIONCONTROLLER_SCTAPICALL_H 00003 00004 #include "SctApiException.h" 00005 #include "SctApiAccessException.h" 00006 00007 #ifndef __Sct_SctApi_H_ 00008 #include "Sct_SctApi/Sct_SctApi.hh" 00009 #endif 00010 00011 namespace SctCalibrationController { 00012 00022 inline void raiseSctApiException(ilu_Exception exception, const char* text, const char* file, unsigned int line) { 00023 if (exception == Sct_SctApi_E_SctApiException) 00024 throw SctApiException(exception, text, file, line); 00025 throw SctApiAccessException(exception, text, file, line); 00026 } 00027 00028 #define APICALL( api, call, errorText ) { \ 00029 if (!api) throw InvalidArgumentError("Null pointer to SctApi", __FILE__, __LINE__); \ 00030 Sct_SctApiStatus st; \ 00031 (api)->call; \ 00032 if (st.returnCode != 0) raiseSctApiException(st.returnCode, errorText, __FILE__, __LINE__);\ 00033 } 00034 00035 00036 #define APIRETCALL( api, ret, call, errorText ) { \ 00037 if (!api) throw InvalidArgumentError("Null pointer to SctApi", __FILE__, __LINE__); \ 00038 Sct_SctApiStatus st; \ 00039 ret=(api)->call; \ 00040 if (st.returnCode != 0) \ 00041 raiseSctApiException(st.returnCode, errorText, __FILE__, __LINE__); } 00042 } 00043 00044 #endif //SCTCALIBRATIONCONTROLLER_SCTAPICALL_H