$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r61050 - in branches/release: boost/statechart libs/statechart libs/statechart/doc
From: ahd6974-boostorg_at_[hidden]
Date: 2010-04-04 15:22:09
Author: andreas_huber69
Date: 2010-04-04 15:22:08 EDT (Sun, 04 Apr 2010)
New Revision: 61050
URL: http://svn.boost.org/trac/boost/changeset/61050
Log:
Merged recent statechart trunk changes to the release branch.
Properties modified: 
   branches/release/boost/statechart/   (props changed)
   branches/release/libs/statechart/   (props changed)
Text files modified: 
   branches/release/boost/statechart/result.hpp                 |    18 +++++++++---------                      
   branches/release/boost/statechart/simple_state.hpp           |    11 ++++++-----                             
   branches/release/boost/statechart/state_machine.hpp          |    26 ++++++++++++++++++--------              
   branches/release/libs/statechart/doc/acknowledgments.html    |    23 ++++++++++++-----------                 
   branches/release/libs/statechart/doc/future_and_history.html |    30 +++++++++++++++---------------          
   branches/release/libs/statechart/doc/reference.html          |    34 +++++++++++++++++++++++++++++-----      
   6 files changed, 89 insertions(+), 53 deletions(-)
Modified: branches/release/boost/statechart/result.hpp
==============================================================================
--- branches/release/boost/statechart/result.hpp	(original)
+++ branches/release/boost/statechart/result.hpp	2010-04-04 15:22:08 EDT (Sun, 04 Apr 2010)
@@ -1,7 +1,7 @@
 #ifndef BOOST_STATECHART_RESULT_HPP_INCLUDED
 #define BOOST_STATECHART_RESULT_HPP_INCLUDED
 //////////////////////////////////////////////////////////////////////////////
-// Copyright 2002-2006 Andreas Huber Doenni
+// Copyright 2002-2010 Andreas Huber Doenni
 // Distributed under the Boost Software License, Version 1.0. (See accompany-
 // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //////////////////////////////////////////////////////////////////////////////
@@ -39,13 +39,13 @@
   public:
     //////////////////////////////////////////////////////////////////////////
     safe_reaction_result( const safe_reaction_result & other ) :
-      reactionResult( other.reactionResult )
+      reactionResult_( other.reactionResult_ )
     {
       // This assert fails when an attempt is made to make multiple copies of
       // a result value. This makes little sense, given the requirement that
       // an obtained result value must be returned out of the react function.
-      BOOST_ASSERT( reactionResult != consumed );
-      other.reactionResult = consumed;
+      BOOST_ASSERT( reactionResult_ != consumed );
+      other.reactionResult_ = consumed;
     }
 
     ~safe_reaction_result()
@@ -55,26 +55,26 @@
       // makes more than one call to reaction functions inside react() or
       // accidentally makes one or more calls to reaction functions outside
       // react()
-      BOOST_ASSERT( reactionResult == consumed );
+      BOOST_ASSERT( reactionResult_ == consumed );
     }
 
   private:
     //////////////////////////////////////////////////////////////////////////
     safe_reaction_result( reaction_result reactionResult ) :
-      reactionResult( reactionResult )
+      reactionResult_( reactionResult )
     {
     }
 
     operator reaction_result() const
     {
-      const reaction_result val = reactionResult;
-      reactionResult = consumed;
+      const reaction_result val = reactionResult_;
+      reactionResult_ = consumed;
       return val;
     }
 
     safe_reaction_result & operator=( const safe_reaction_result & );
 
-    mutable reaction_result reactionResult;
+    mutable reaction_result reactionResult_;
 
     friend struct result_utility;
 };
Modified: branches/release/boost/statechart/simple_state.hpp
==============================================================================
--- branches/release/boost/statechart/simple_state.hpp	(original)
+++ branches/release/boost/statechart/simple_state.hpp	2010-04-04 15:22:08 EDT (Sun, 04 Apr 2010)
@@ -1,7 +1,7 @@
 #ifndef BOOST_STATECHART_SIMPLE_STATE_HPP_INCLUDED
 #define BOOST_STATECHART_SIMPLE_STATE_HPP_INCLUDED
 //////////////////////////////////////////////////////////////////////////////
-// Copyright 2002-2008 Andreas Huber Doenni
+// Copyright 2002-2010 Andreas Huber Doenni
 // Distributed under the Boost Software License, Version 1.0. (See accompany-
 // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 //////////////////////////////////////////////////////////////////////////////
@@ -47,6 +47,7 @@
 #include <boost/get_pointer.hpp>
 #include <boost/intrusive_ptr.hpp>
 #include <boost/assert.hpp>
+#include <boost/type_traits/is_base_of.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/cast.hpp> // boost::polymorphic_downcast
@@ -234,7 +235,7 @@
     OtherContext & context()
     {
       typedef typename mpl::if_<
-        is_same< OtherContext, MostDerived >,
+        is_base_of< OtherContext, MostDerived >,
         context_impl_this_context,
         context_impl_other_context
       >::type impl;
@@ -245,7 +246,7 @@
     const OtherContext & context() const
     {
       typedef typename mpl::if_<
-        is_same< OtherContext, MostDerived >,
+        is_base_of< OtherContext, MostDerived >,
         context_impl_this_context,
         context_impl_other_context
       >::type impl;
@@ -282,12 +283,12 @@
 
     void post_event( const event_base_ptr_type & pEvent )
     {
-      outermost_context_base().post_event( pEvent );
+      outermost_context_base().post_event_impl( pEvent );
     }
 
     void post_event( const event_base & evt )
     {
-      outermost_context_base().post_event( evt );
+      outermost_context_base().post_event_impl( evt );
     }
 
     result discard_event()
Modified: branches/release/boost/statechart/state_machine.hpp
==============================================================================
--- branches/release/boost/statechart/state_machine.hpp	(original)
+++ branches/release/boost/statechart/state_machine.hpp	2010-04-04 15:22:08 EDT (Sun, 04 Apr 2010)
@@ -423,22 +423,21 @@
       terminate_impl( false );
     }
 
-  public:
-    //////////////////////////////////////////////////////////////////////////
-    // The following declarations should be protected.
-    // They are only public because many compilers lack template friends.
-    //////////////////////////////////////////////////////////////////////////
     void post_event( const event_base_ptr_type & pEvent )
     {
-      BOOST_ASSERT( get_pointer( pEvent ) != 0 );
-      eventQueue_.push_back( pEvent );
+      post_event_impl( pEvent );
     }
 
     void post_event( const event_base & evt )
     {
-      post_event( evt.intrusive_from_this() );
+      post_event_impl( evt );
     }
 
+  public:
+    //////////////////////////////////////////////////////////////////////////
+    // The following declarations should be protected.
+    // They are only public because many compilers lack template friends.
+    //////////////////////////////////////////////////////////////////////////
     template<
       class HistoryContext,
       detail::orthogonal_position_type orthogonalPosition >
@@ -515,6 +514,17 @@
     typedef mpl::bool_< false > deep_history;
     typedef mpl::bool_< false > inherited_deep_history;
 
+    void post_event_impl( const event_base_ptr_type & pEvent )
+    {
+      BOOST_ASSERT( get_pointer( pEvent ) != 0 );
+      eventQueue_.push_back( pEvent );
+    }
+
+    void post_event_impl( const event_base & evt )
+    {
+      post_event_impl( evt.intrusive_from_this() );
+    }
+
     detail::reaction_result react_impl(
       const event_base_type &,
       typename rtti_policy_type::id_type )
Modified: branches/release/libs/statechart/doc/acknowledgments.html
==============================================================================
--- branches/release/libs/statechart/doc/acknowledgments.html	(original)
+++ branches/release/libs/statechart/doc/acknowledgments.html	2010-04-04 15:22:08 EDT (Sun, 04 Apr 2010)
@@ -84,24 +84,25 @@
 
   <p>Thanks for feedback and/or encouragement go to:</p>
 
-  <p>Bardur Arantsson, Robert Bell, Bohdan, Wayne Chao, Topher Cooper,
-  Philippe David, Peter Dimov, Reece Dunn, John Fuller, Jeff Garland, Eugene
-  Gladyshev, David A. Greene, Douglas Gregor, Gustavo Guerra, Aleksey
-  Gurtovoy, Federico J. Fernández, Iain K. Hanson, Steve Hawkes,
-  David B. Held, Jürgen Hunold, Sean Kelly, Oliver Kowalke, Simon
-  Meiklejohn, Jiang Miao, Johan Nilsson, Matthieu Paindavoine, Chris Paulse,
-  Yuval Ronen, Chris Russell, Bryan Silverthorn, Rob Stewart, Kwee Heong Tan,
-  Marcin Tustin, Vincent N. Virgilio, Gang Wang, Steven Watanabe, Richard
-  Webb and Scott Woods.</p>
+  <p>Bardur Arantsson, Arne Babnik, Robert Bell, Bohdan, Wayne Chao,
+  Topher Cooper, Philippe David, Peter Dimov, Reece Dunn, Grant Erickson,
+  John Fuller, Jeff Garland, Eugene Gladyshev, David A. Greene, Douglas
+  Gregor, Gustavo Guerra, Aleksey Gurtovoy, Federico J. Fernández,
+  Iain K. Hanson, Steve Hawkes, David B. Held, Jürgen Hunold, Sean
+  Kelly, Oliver Kowalke, Thomas Mathys, Simon Meiklejohn, Jiang Miao, Johan
+  Nilsson, Matthieu Paindavoine, Chris Paulse, Igor R, Yuval Ronen, Chris
+  Russell, Bryan Silverthorn, Rob Stewart, Kwee Heong Tan, Marcin Tustin,
+  Vincent N. Virgilio, Gang Wang, Steven Watanabe, Richard Webb and Scott
+  Woods.</p>
   <hr>
 
   <p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
   "../../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
   height="31" width="88"></a></p>
 
-  <p>Revised 06 July, 2009</p>
+  <p>Revised 04 April, 2010</p>
 
-  <p><i>Copyright © 2003-2008 <a href="contact.html">Andreas Huber
+  <p><i>Copyright © 2003-2010 <a href="contact.html">Andreas Huber
   Dönni</a></i></p>
 
 
Modified: branches/release/libs/statechart/doc/future_and_history.html
==============================================================================
--- branches/release/libs/statechart/doc/future_and_history.html	(original)
+++ branches/release/libs/statechart/doc/future_and_history.html	2010-04-04 15:22:08 EDT (Sun, 04 Apr 2010)
@@ -51,19 +51,6 @@
 
     <li>Optimize state-entry and state-exit for speed and code-size</li>
 
-    <li>Implement <code>simple_state::triggering_event()</code>, which
-    returns a pointer to the event that triggered the action currently being
-    executed. This is useful for the rare cases when an entry or exit action
-    needs to access the event that triggered the execution of the action.
-    <code>triggering_event()</code> returns a <code>const event_base *</code>
-    due to the fact that entry and exit actions can be triggered by events of
-    any type or no event at all
-    (<code>state_machine<>::initiate()</code> &
-    <code>state_machine::terminate()</code>). The caller thus needs to make a
-    type check or cast the return value. The use of
-    <code>triggering_event</code>() therefore often indicates a problem in
-    the state machine design and should be avoided whenever possible</li>
-
     <li>Reimplement <code>fifo_scheduler<>::processor_handle</code> so
     that <code>fifo_scheduler<>::create_processor<>()</code> and
     <code>fifo_scheduler<>::destroy_processor()</code> no longer make
@@ -140,6 +127,19 @@
 
   <p>(<font color="#FF0000">red</font> = points raised during formal
   review)</p>
+  <p>1.43.0</p>
+  <ul>
+    <li>Generalized the context() functions so that they can also return a
+    reference to any public base type of a context. This also makes
+    transition<> & in_state_reaction<> more general, reported
+    by Igor R</li>
+    <li>Added triggering_event()</li>
+    <li>Fixed Bug #3329 (shadow variable warnings), reported by Grant
+    Erickson</li>
+    <li>Fixed Bug #3963 (state_machine<>::post_event() should be
+    protected), reported by Arne Babnik</li>
+  </ul>
+
   <p>1.40.0</p>
   <ul>
     <li>Fixed a bug that prevented the use of boost::ref() with
@@ -703,9 +703,9 @@
   "../../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
   height="31" width="88"></a></p>
 
-  <p>Revised 27 June, 2009</p>
+  <p>Revised 04 April, 2010</p>
 
-  <p><i>Copyright © 2003-2009 <a href="contact.html">Andreas Huber
+  <p><i>Copyright © 2003-2010 <a href="contact.html">Andreas Huber
   Dönni</a></i></p>
 
   <p><i>Distributed under the Boost Software License, Version 1.0. (See
Modified: branches/release/libs/statechart/doc/reference.html
==============================================================================
--- branches/release/libs/statechart/doc/reference.html	(original)
+++ branches/release/libs/statechart/doc/reference.html	2010-04-04 15:22:08 EDT (Sun, 04 Apr 2010)
@@ -759,6 +759,8 @@
 "#Classevent_base">event_base</a> > & );
       void post_event( const <a href=
 "#Classevent_base">event_base</a> & );
+
+      const event_base * triggering_event() const;
   };
 }
 }
@@ -1202,6 +1204,15 @@
   <b>Note</b>: The position of a given innermost state in the range is
   arbitrary. It may change with each call to a modifier function. Moreover,
   all iterators are invalidated whenever a modifier function is called</p>
+  <pre>
+const event_base * <a name="triggering_event1" id="triggering_event1">triggering_event</a>();
+</pre>
+
+  <p><b>Returns</b>: A pointer to the event that triggered the reaction that is currently
+  being executed. Returns <code>0</code> if no reaction is being executed or if the current
+  reaction was triggered by either <code>initiate()</code> or
+  <code>terminate()</code>
+  </p>
 
   <h1>Header <boost/statechart/<br>
   <a name="asynchronous_state_machine.hpp" id=
@@ -1934,6 +1945,8 @@
 
 state_iterator <b>state_begin</b>() const;
 state_iterator <b>state_end</b>() const;
+
+const event_base * <b>triggering_event</b>() const;
 </pre>
 
   <p>States that need to call any of these member functions from their
@@ -2077,6 +2090,8 @@
       state_iterator <a href=
 "#simple_state::state_end">state_end</a>() const;
 
+      const event_base * triggering_event() const;
+
       void post_event(
         const intrusive_ptr< const <a href=
 "#Classevent_base">event_base</a> > & );
@@ -2552,7 +2567,8 @@
   direct or indirect subtype with a <code>state_machine<></code> subtype as
   argument then the <code>state_machine<></code> subclass portion must still
   exist<br>
-  <b>Returns</b>: A reference to a direct or indirect context</p>
+  <b>Returns</b>: A reference to a direct or indirect context or any public base
+  type of the contexts</p>
   <pre>
 template< class OtherContext >
 const OtherContext & <a name="contextconst" id=
@@ -2565,7 +2581,8 @@
   direct or indirect subtype with a <code>state_machine<></code> subtype as
   argument then the <code>state_machine<></code> subclass portion must still
   exist<br>
-  <b>Returns</b>: A reference to a const direct or indirect context</p>
+  <b>Returns</b>: A reference to a const direct or indirect context or any public
+  base type of the contexts</p>
   <pre>
 template< class Target >
 Target <a name="simple_state::state_cast" id=
@@ -2621,6 +2638,12 @@
   <b>Note</b>: The result is <b>unspecified</b> if these functions are called
   when the machine is <a href=
   "definitions.html#UnstableStateMachine">unstable</a></p>
+  <pre>
+const event_base * <a name="triggering_event0" id="triggering_event0">triggering_event</a>();
+</pre>
+
+  <p><b>Returns</b>: Has exactly the same semantics as
+  <code>state_machine<>::triggering_event()</code></p>
 
   <h3>Class template <code>simple_state</code> static functions</h3>
   <pre>
@@ -2701,6 +2724,7 @@
 
 state_iterator <b>state_begin</b>() const;
 state_iterator <b>state_end</b>() const;
+const event_base * <b>triggering_event</b>() const;
 </pre>
 
   <p>States that do not need to call any of these member functions from their
@@ -3138,7 +3162,7 @@
       <td><code>Destination</code></td>
 
       <td>A model of the SimpleState
-      or State concepts or an instantiation of the
+      or State concepts, any of their public base types or an instantiation of the
       <code><a href=
       "#ClassTemplateshallow_history">shallow_history</a></code> or
       <code>deep_history</code>
@@ -3255,8 +3279,8 @@
     <tr>
       <td><code>ReactionContext</code></td>
 
-      <td>Either the state defining the in-state reaction itself
-      or one of it direct or indirect contexts</td>
+      <td>Either the state defining the in-state reaction itself, one of its direct or indirect contexts 
+          or any of their public base types</td>
 
       <td>The state of which the action is a member</td>