00001 #include "ISUtilities.h" 00002 #include "SctNames.h" 00003 #include "IoExceptions.h" 00004 00005 namespace Sct{ 00006 00007 void ISUtilities::addOrUpdateOrThrow(std::string& name, ISInfo& info, const std::string& file, int line, severity sev){ 00008 ISInfoDictionary& is = SctNames::getISDictionary(); 00009 ISInfo::Status st=is.contains(name); 00010 if ( st==ISInfo::Success ) { 00011 st = is.update(name, info); 00012 } else if ( st==ISInfo::NotFound ) { 00013 st = is.insert(name, info); 00014 } 00015 if (st != ISInfo::Success) { 00016 throw IsException(st, "ISUtilities: can't update status", file, line); 00017 } 00018 } 00019 00020 void ISUtilities::addNoUpdateOrThrow(std::string& name, ISInfo& info, const std::string& file, int line, severity sev){ 00021 ISInfoDictionary& is = SctNames::getISDictionary(); 00022 ISInfo::Status st=is.insert(name, info); 00023 if (st != ISInfo::Success) { 00024 throw IsException(st, "ISUtilities can't update status", file, line); 00025 } 00026 } 00027 00028 void ISUtilities::addOrUpdateOrMessage(std::string& name, ISInfo& info, const std::string& file, int line, severity sev){ 00029 try { 00030 addOrUpdateOrThrow(name, info, file, line, sev); 00031 }catch(Throwable& e){ 00032 e.sendToMrs(sev); 00033 } 00034 } 00035 00036 void ISUtilities::addNoUpdateOrMessage(std::string& name, ISInfo& info, const std::string& file, int line, severity sev){ 00037 try { 00038 addNoUpdateOrThrow(name, info, file, line, sev); 00039 }catch(Throwable& e){ 00040 e.sendToMrs(sev); 00041 } 00042 } 00043 00044 } 00045