00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "FunctionFactory.h"
00032
00033 #include "AIDA_FML/IFitter_impl.h"
00034
00035 #include "Function.h"
00036 #include "FitFunction.h"
00037
00038 #include <memory>
00039
00040 FunctionFactory::FunctionFactory()
00041 {
00042 }
00043
00044 FunctionFactory::~FunctionFactory()
00045 {
00046 }
00047
00048 FunctionFactory::FunctionFactory(const FunctionFactory &)
00049 {
00050 }
00051
00052 FunctionFactory & FunctionFactory::operator = (const FunctionFactory &rhs)
00053 {
00054 if (this == &rhs) return *this;
00055
00056 return *this;
00057 }
00058
00059 IFunction * FunctionFactory::create(const std::string & name,
00060 const std::string & label,
00061 const std::string & type,
00062 const std::vector<double> & parameterValues,
00063 const std::string & parameterNames)
00064 {
00065
00066 std::auto_ptr<Anaphe::IModelFunction> newmodel(FML::newModelFunction(type));
00067
00068 if(!newmodel.get()) return 0;
00069
00070
00071 std::auto_ptr<Function_impl_owner> newfun(new Function_impl_owner(label,newmodel));
00072
00073 if(!newfun.get()) return 0;
00074
00075 newfun->setParameterValues(parameterValues);
00076
00077 return newfun.release();
00078 }
00079
00080 IFunction * FunctionFactory::createScripted(const std::string & name,
00081 const std::string & label,
00082 const std::string & script)
00083 {
00084 cerr << "FunctionFactory: createScripted not implemented" << endl;
00085 return 0;
00086 }
00087
00088 IFitFunction * FunctionFactory::createFit(const std::string & name,
00089 const std::string & label,
00090 const std::string & type,
00091 const std::string & options)
00092 {
00093 std::auto_ptr<FitFunction> fitfun(new FitFunction(label, type,options));
00094
00095 if(!fitfun.get()) return 0;
00096 else
00097 return fitfun.release();
00098 }
00099