DefaultProbabilityTermStructure::DefaultProbabilityTermStructure( const DayCounter& dc, const std::vector<Handle<Quote> >& jumps, const std::vector<Date>& jumpDates) : TermStructure(dc), jumps_(jumps), jumpDates_(jumpDates), jumpTimes_(jumpDates.size()), nJumps_(jumps_.size()) { setJumps(); for (Size i=0; i<nJumps_; ++i) registerWith(jumps_[i]); }
YieldTermStructure::YieldTermStructure( Natural settlementDays, const Calendar& cal, const DayCounter& dc, const std::vector<Handle<Quote> >& jumps, const std::vector<Date>& jumpDates) : TermStructure(settlementDays, cal, dc), jumps_(jumps), jumpDates_(jumpDates), jumpTimes_(jumpDates.size()), nJumps_(jumps_.size()) { setJumps(); for (Size i=0; i<nJumps_; ++i) registerWith(jumps_[i]); }
void YieldTermStructure::update() { TermStructure::update(); Date newReference = Date(); try { newReference = referenceDate(); if (newReference != latestReference_) setJumps(); } catch (Error&) { if (newReference == Date()) { // the curve couldn't calculate the reference // date. Most of the times, this is because some // underlying handle wasn't set, so we can just absorb // the exception and continue; the jumps will be set // correctly when a valid underlying is set. return; } else { // something else happened during the call to // setJumps(), so we let the exception bubble up. throw; } } }