Logo Search packages:      
Sourcecode: quantlib version File versions  Download package

void QuantLib::Observable::notifyObservers (  )  [inline, inherited]

This method should be called at the end of non-const methods or when the programmer desires to notify any changes.

Definition at line 114 of file observable.hpp.

References QL_ENSURE.

Referenced by QuantLib::CalibratedModel::calibrate(), QuantLib::Observable::operator=(), QuantLib::LazyObject::recalculate(), QuantLib::InflationTermStructure::setSeasonality(), QuantLib::SimpleQuote::setValue(), QuantLib::RecoveryRateQuote::setValue(), QuantLib::LazyObject::unfreeze(), QuantLib::BootstrapHelper< TS >::update(), QuantLib::TermStructure::update(), QuantLib::StochasticProcess::update(), QuantLib::LastFixingQuote::update(), QuantLib::FuturesConvAdjustmentQuote::update(), QuantLib::ForwardValueQuote::update(), QuantLib::DerivedQuote< UnaryFunction >::update(), QuantLib::CompositeQuote< BinaryFunction >::update(), QuantLib::GenericEngine< OneAssetOption::arguments, QuantLib::OneAssetOption::results >::update(), QuantLib::LazyObject::update(), QuantLib::CalibratedModel::update(), QuantLib::CalibrationHelper::update(), QuantLib::Claim::update(), QuantLib::InterestRateIndex::update(), QuantLib::InflationIndex::update(), QuantLib::SabrVolSurface::update(), QuantLib::ExtendedBlackVarianceSurface::update(), QuantLib::ExtendedBlackVarianceCurve::update(), QuantLib::ConstantRecoveryModel::update(), QuantLib::CommodityIndex::update(), QuantLib::InflationCouponPricer::update(), QuantLib::InflationCoupon::update(), QuantLib::FloatingRateCoupon::update(), QuantLib::DigitalCoupon::update(), QuantLib::FloatingRateCouponPricer::update(), QuantLib::CappedFlooredYoYInflationCoupon::update(), and QuantLib::CappedFlooredCoupon::update().

                                            {
        bool successful = true;
        std::string errMsg;
        for (iterator i=observers_.begin(); i!=observers_.end(); ++i) {
            try {
                (*i)->update();
            } catch (std::exception& e) {
                // quite a dilemma. If we don't catch the exception,
                // other observers will not receive the notification
                // and might be left in an incorrect state. If we do
                // catch it and continue the loop (as we do here) we
                // lose the exception. The least evil might be to try
                // and notify all observers, while raising an
                // exception if something bad happened.
                successful = false;
                errMsg = e.what();
            } catch (...) {
                successful = false;
            }
        }
        QL_ENSURE(successful,
                  "could not notify one or more observers: " << errMsg);
    }


Generated by  Doxygen 1.6.0   Back to index