Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Patterns/Cacheable.hpp

    rc72112 radc42b  
    2828        owner(_owner)
    2929        {}
    30       virtual T& getValue()=0;
     30      virtual T getValue()=0;
    3131      virtual void invalidate()=0;
    3232      virtual bool isValid()=0;
     
    4646        {}
    4747
    48       virtual T& getValue(){
     48      virtual T getValue(){
    4949        // set the state to valid
    5050        State::owner->switchState(State::owner->validState);
     
    7272        {}
    7373
    74       virtual T& getValue(){
     74      virtual T getValue(){
    7575        return content;
    7676      }
     
    100100        {}
    101101
    102       virtual T& getValue(){
     102      virtual T getValue(){
    103103        ASSERT(0,"Cannot get a value from a Cacheable after it's Observable has died");
    104104        // we have to return a grossly invalid reference, because no value can be produced anymore
     
    134134    void subjectKilled(Observable *subject);
    135135  private:
     136
    136137    void switchState(state_ptr newState);
    137138
     
    143144
    144145    Observable *owner;
     146
    145147    boost::function<T()> recalcMethod;
    146148
     
    219221
    220222    const bool isValid() const;
    221     const T& operator*() const;
     223    const T operator*() const;
    222224
    223225    // methods implemented for base-class Observer
     
    235237
    236238  template<typename T>
    237   const T& Cacheable<T>::operator*() const{
     239  const T Cacheable<T>::operator*() const{
    238240    return recalcMethod();
    239241  }
Note: See TracChangeset for help on using the changeset viewer.