00001 00002 #include "cob_sick_s300/Errors.hpp" 00003 namespace brics_oodl { 00004 00005 Errors::Errors() { 00006 // Bouml preserved body begin 000211F1 00007 iter = this->occurredErrors.begin(); 00008 // Bouml preserved body end 000211F1 00009 } 00010 00011 Errors::~Errors() { 00012 // Bouml preserved body begin 00021271 00013 this->occurredErrors.clear(); 00014 // Bouml preserved body end 00021271 00015 } 00016 00017 void Errors::getNextError(std::string& name, std::string& description) { 00018 // Bouml preserved body begin 00022AFC 00019 if(iter == this->occurredErrors.end()){ 00020 iter = this->occurredErrors.begin(); 00021 }else{ 00022 iter++; 00023 } 00024 name = iter->first; 00025 description = iter->second; 00026 // Bouml preserved body end 00022AFC 00027 } 00028 00029 void Errors::getAllErrors(map<std::string, std::string>& allErrors) { 00030 // Bouml preserved body begin 00022B7C 00031 allErrors = this->occurredErrors; 00032 // Bouml preserved body end 00022B7C 00033 } 00034 00035 unsigned int Errors::getAmountOfErrors() { 00036 // Bouml preserved body begin 00021171 00037 return this->occurredErrors.size(); 00038 // Bouml preserved body end 00021171 00039 } 00040 00041 void Errors::addError(std::string name, std::string description) { 00042 // Bouml preserved body begin 000212F1 00043 this->occurredErrors[name] = description; 00044 // std::cout << "ERROR: " << name << " " << description << std::endl; 00045 00046 00047 LOG(error) << name << ": " << description; 00048 00049 // Bouml preserved body end 000212F1 00050 } 00051 00052 void Errors::deleteAllErrors() { 00053 // Bouml preserved body begin 00021371 00054 this->occurredErrors.clear(); 00055 // Bouml preserved body end 00021371 00056 } 00057 00058 void Errors::printErrorsToConsole() { 00059 // Bouml preserved body begin 0002FA71 00060 map<std::string,std::string>::iterator iterator;; 00061 for(iterator = this->occurredErrors.begin();iterator != this->occurredErrors.end(); iterator++){ 00062 std::cout << iterator->first << ": " << iterator->second << std::endl; 00063 } 00064 00065 // Bouml preserved body end 0002FA71 00066 } 00067 00068 00069 } // namespace brics_oodl