The LastFixingQuote is an implementation of the abstract Quote class. LastFixingQuote represents a quote for the last available fixing of an index. Essentially it is a simple wrapper around the Index class to allow indices to be used as Quotes.
class LastFixingQuote : public Quote, public Observer
The class inherits from Quote but also from Observer. LastFixingQuote has to react to changes in the index value. It does this by observing the Index objects that it wraps.
LastFixingQuote(const boost::shared_ptr<Index>& index);
The constructor takes a shared pointer to an Index object. Once the index is set it cannot be changed again.
Real value() const; bool isValid() const;
The value() method and isValid() method are inherited from Quote and are implemented. value() returns the latest available fixing of the index. isValid() returns true if the index contains any fixings and false if the index does not contain fixings at all.
Date referenceDate() const;
The reference date is the last date in the time series contained in the index. Thus it is the date of the latest available fixing.
The update() method is implemented from the Observer class. It takes no action except calling notifyObservers() of the Observable. This makes sure that any observers of the quote are notified when the underlying index changes.
const boost::shared_ptr<Index>& index() const
Access to the index is granted through the index() method.