[QuantLibAddin-cvs] QuantLibAddin/qlo typefactory.hpp,1.9,1.10
Brought to you by:
ericehlers,
nando
|
From: Eric E. <eri...@us...> - 2006-06-30 13:28:30
|
Update of /cvsroot/quantlibaddin/QuantLibAddin/qlo In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv15639/qlo Modified Files: typefactory.hpp Log Message: validation for timeSteps Index: typefactory.hpp =================================================================== RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/typefactory.hpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** typefactory.hpp 29 Jun 2006 16:52:12 -0000 1.9 --- typefactory.hpp 30 Jun 2006 13:28:26 -0000 1.10 *************** *** 83,101 **** const std::string& payoffID, const QuantLib::Option::Type& optionType, ! const double& input1) { boost::shared_ptr<QuantLib::StrikedTypePayoff>(*ctor)(const QuantLib::Option::Type&, const double&) = (boost::shared_ptr<QuantLib::StrikedTypePayoff>(*)(const QuantLib::Option::Type&, const double&)) getType(payoffID); ! return ctor(optionType, input1); } boost::shared_ptr<QuantLib::StrikedTypePayoff> operator()( const std::string& payoffID, const QuantLib::Option::Type& optionType, ! const double& input1, ! const double& input2) { boost::shared_ptr<QuantLib::StrikedTypePayoff>(*ctor)(const QuantLib::Option::Type&, const double&, const double&) = (boost::shared_ptr<QuantLib::StrikedTypePayoff>(*)(const QuantLib::Option::Type&, const double&, const double&)) getType(payoffID); ! return ctor(optionType, input1, input2); } }; --- 83,101 ---- const std::string& payoffID, const QuantLib::Option::Type& optionType, ! const double& strike) { boost::shared_ptr<QuantLib::StrikedTypePayoff>(*ctor)(const QuantLib::Option::Type&, const double&) = (boost::shared_ptr<QuantLib::StrikedTypePayoff>(*)(const QuantLib::Option::Type&, const double&)) getType(payoffID); ! return ctor(optionType, strike); } boost::shared_ptr<QuantLib::StrikedTypePayoff> operator()( const std::string& payoffID, const QuantLib::Option::Type& optionType, ! const double& strike, ! const double& strikeIncrement) { boost::shared_ptr<QuantLib::StrikedTypePayoff>(*ctor)(const QuantLib::Option::Type&, const double&, const double&) = (boost::shared_ptr<QuantLib::StrikedTypePayoff>(*)(const QuantLib::Option::Type&, const double&, const double&)) getType(payoffID); ! return ctor(optionType, strike, strikeIncrement); } }; *************** *** 106,110 **** public: boost::shared_ptr<QuantLib::PricingEngine> operator()(const std::string& engineID, ! const long& timeSteps) { boost::shared_ptr<QuantLib::PricingEngine>(*ctor)(const long&) = (boost::shared_ptr<QuantLib::PricingEngine>(*)(const long&)) getType(engineID); --- 106,111 ---- public: boost::shared_ptr<QuantLib::PricingEngine> operator()(const std::string& engineID, ! const long& timeSteps) { ! QL_REQUIRE(timeSteps>0, "timeSteps must be positive"); // FIXME move this validation into QL boost::shared_ptr<QuantLib::PricingEngine>(*ctor)(const long&) = (boost::shared_ptr<QuantLib::PricingEngine>(*)(const long&)) getType(engineID); *************** *** 118,121 **** --- 119,129 ---- }; + typedef boost::shared_ptr<QuantLib::Extrapolator>(*ExtrapolatorConstructor)( + const std::vector<double>::const_iterator&, + const std::vector<double>::const_iterator&, + const std::vector<double>::const_iterator&, + const std::vector<double>::const_iterator&, + const QuantLib::Matrix&); + template<> class Create<boost::shared_ptr<QuantLib::Extrapolator> > : *************** *** 129,145 **** const std::vector<double>::const_iterator& yEnd, const QuantLib::Matrix& zData) { ! boost::shared_ptr<QuantLib::Extrapolator>(*ctor)( ! const std::vector<double>::const_iterator&, ! const std::vector<double>::const_iterator&, ! const std::vector<double>::const_iterator&, ! const std::vector<double>::const_iterator&, ! const QuantLib::Matrix&) = ! (boost::shared_ptr<QuantLib::Extrapolator>(*)( ! const std::vector<double>::const_iterator&, ! const std::vector<double>::const_iterator&, ! const std::vector<double>::const_iterator&, ! const std::vector<double>::const_iterator&, ! const QuantLib::Matrix&)) getType(extrapolatorID); ! return ctor(xBegin, xEnd, yBegin, yEnd, zData); } }; --- 137,143 ---- const std::vector<double>::const_iterator& yEnd, const QuantLib::Matrix& zData) { ! ExtrapolatorConstructor extrapolatorConstructor = ! static_cast<ExtrapolatorConstructor>(getType(extrapolatorID)); ! return extrapolatorConstructor(xBegin, xEnd, yBegin, yEnd, zData); } }; |