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