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

FitAlgorithmMap.cpp

Go to the documentation of this file.
00001 #include "FitAlgorithmMap.h"
00002 #include "FitAlgorithm.h"
00003 #include "SctData/ConfigurationVariable.h"
00004 
00005 #include <iostream>
00006 using namespace std;
00007 
00008 namespace SctFitter {
00009 
00010 FitAlgorithmMap& FitAlgorithmMap::instance() {
00011     static FitAlgorithmMap* map = new FitAlgorithmMap();
00012     return *map;
00013 }
00014     
00015 const FitAlgorithm& FitAlgorithmMap::getAlgorithm(const ConfigurationVariable& variable) const throw(Sct::InvalidArgument) {
00016     if (algMap.count(variable.getVariableName()) == 0) {
00017     Sct::InvalidArgumentError iae("No map for ConfigurationVariable: " + variable.getVariableName(), __FILE__, __LINE__ );
00018     iae.setSeverity(MRS_DIAGNOSTIC);
00019     throw iae;
00020     }
00021     return *(*algMap.find(variable.getVariableName())).second;
00022 }
00023     
00024 bool FitAlgorithmMap::setAlgorithm(string variableName, auto_ptr<FitAlgorithm> alg) throw() {
00025     algMap[variableName] = shared_ptr<FitAlgorithm>(alg);
00026     return true;
00027 }
00028     
00029 }

Generated on Mon Dec 15 19:36:01 2003 for SCT DAQ/DCS Software by doxygen1.3-rc3