Changeset 86799


Ignore:
Timestamp:
Nov 23, 2013, 8:49:36 PM (4 years ago)
Author:
Christophe Henry
Message:

trac 9280: moved handling of deferred events to history policy

Location:
trunk/boost/msm/back
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/boost/msm/back/history_policies.hpp

    r71881 r86799  
    5050         return *this;
    5151    }
     52    // this policy deletes all waiting deferred events
     53    template <class Event>
     54    bool process_deferred_events(Event const&)const
     55    {
     56        return false;
     57    }
    5258    template<class Archive>
    5359    void serialize(Archive & ar, const unsigned int)
     
    9197         return *this;
    9298    }
     99    // the history policy keeps all deferred events until next reentry
     100    template <class Event>
     101    bool process_deferred_events(Event const&)const
     102    {
     103        return true;
     104    }
     105
    93106    template<class Archive>
    94107    void serialize(Archive & ar, const unsigned int)
     
    140153         return *this;
    141154    }
     155    // the history policy keeps deferred events until next reentry if coming from our history event
     156    template <class Event>
     157    bool process_deferred_events(Event const&)const
     158    {
     159        return ::boost::mpl::contains<Events,Event>::value;
     160    }
    142161    template<class Archive>
    143162    void serialize(Archive & ar, const unsigned int)
  • trunk/boost/msm/back/state_machine.hpp

    r86759 r86799  
    26152615        // give the history a chance to handle this (or not).
    26162616        m_history.history_exit(this->m_states);
     2617        // history decides what happens with deferred events
     2618        if (!m_history.process_deferred_events(incomingEvent))
     2619        {
     2620            get_deferred_queue().clear();
     2621        }
    26172622     }
    26182623
Note: See TracChangeset for help on using the changeset viewer.