Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages

DefectPrototype.cpp

00001 #include "DefectPrototype.h"
00002 #include "Sct/LogicErrors.h"
00003 #include <sstream>
00004 #include <cstring>
00005 
00006 using namespace std;
00007 using namespace Sct;
00008 
00009 namespace SctData {
00010     
00011 
00012 map <int, DefectPrototype*>& DefectPrototype::getMap() {
00013     static map<int, DefectPrototype*> defectMap;
00014     return defectMap;
00015 }
00016     
00017 DefectPrototype::DefectPrototype(int id, DefectSeverity severity, string name, string d, double parameter) 
00018         :id(id), severity(severity), name(name), description(""), parameter(parameter) {
00019     if (getMap().find(id) != getMap().end()) {
00020     ostringstream oss;
00021     oss << "DefectPrototype already exists with id: " << id << " : " << getMap()[id]->getName();
00022     throw InvalidArgumentError(oss.str(), __FILE__, __LINE__);
00023     }   
00024     
00025     //Add to map
00026     getMap()[id] = this;
00027 
00028     char temp[100];
00029     sprintf(temp, d.c_str(), parameter);
00030     description = temp;
00031 }
00032 
00033 }

Generated on Thu Dec 22 20:16:59 2005 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5