00001 #ifndef SCTAPIIPC_LOCALUTILS_H 00002 #define SCTAPIIPC_LOCALUTILS_H 00003 00004 static Sct_SctApi::SctApiException myRaise( ::SctApi::SctApiException &s); 00005 static inline SctApi::BankType myTranslateBank(Sct_SctApi::BankType bank); 00006 static inline SctApi::RunType myTranslateRun(Sct_SctApi::RunType mode); 00007 00008 Sct_SctApi::SctApiException myRaise( ::SctApi::SctApiException &c) 00009 { 00010 cout << "Raising exception " << c.what() << endl; 00011 return Sct_SctApi::SctApiException(c.what()); 00012 } 00013 00014 00015 SctApi::BankType myTranslateBank(Sct_SctApi::BankType bank) { 00016 00017 SctApi::BankType result; 00018 switch(bank) { 00019 case Sct_SctApi::PHYSICS_CONFIG: 00020 result = ::SctApi::SCTAPI_BANK_PHYSICS; 00021 break; 00022 case Sct_SctApi::CALIBRATION_CONFIG: 00023 result = SctApi::SCTAPI_BANK_CALIBRATION; 00024 break; 00025 case Sct_SctApi::SCAN_CONFIG: 00026 result = SctApi::SCTAPI_BANK_SCAN; 00027 break; 00028 default: 00029 result = SctApi::SCTAPI_BANK_PHYSICS; 00030 break; 00031 } 00032 return result; 00033 } 00034 00035 static inline 00036 std::list<SctApi::BankType> myTranslateBanks(const Sct_SctApi::BankList& banks){ 00037 std::list<SctApi::BankType> copied; 00038 for (unsigned i=0; i<banks.length(); ++i){ 00039 copied.push_back(myTranslateBank(banks[i])); 00040 } 00041 return copied; 00042 } 00043 00044 SctApi::RunType myTranslateRun(Sct_SctApi::RunType mode) { 00045 SctApi::RunType result; 00046 switch(mode) { 00047 case Sct_SctApi::PHYSICS_RUN_TYPE: 00048 result = ::SctApi::SCTAPI_RUN_PHYSICS; 00049 break; 00050 case Sct_SctApi::CALIBRATION_RUN_TYPE: 00051 result = SctApi::SCTAPI_RUN_CALIBRATION; 00052 break; 00053 } 00054 return result; 00055 } 00056 00057 SctApi::EventFormatType myTranslateEventFormat(Sct_SctApi::EventFormatType format) { 00058 SctApi::EventFormatType result; 00059 switch(format) { 00060 case Sct_SctApi::NORMAL_EVENT_FORMAT: 00061 result = ::SctApi::SCTAPI_EVENT_FORMAT_NORMAL; 00062 break; 00063 case Sct_SctApi::EXPANDED_EVENT_FORMAT: 00064 result = SctApi::SCTAPI_EVENT_FORMAT_EXPANDED; 00065 break; 00066 case Sct_SctApi::RAW_EVENT_FORMAT: 00067 result = SctApi::SCTAPI_EVENT_FORMAT_RAW; 00068 break; 00069 } 00070 return result; 00071 } 00072 00073 #endif