My Project
exception_translator.hpp
Go to the documentation of this file.
1 #ifndef BOOST_STATECHART_EXCEPTION_TRANSLATOR_HPP_INCLUDED
2 #define BOOST_STATECHART_EXCEPTION_TRANSLATOR_HPP_INCLUDED
3 // Copyright 2002-2006 Andreas Huber Doenni
5 // Distributed under the Boost Software License, Version 1.0. (See accompany-
6 // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 
9 
10 
13 
14 
15 
16 namespace boost
17 {
18 namespace statechart
19 {
20 
21 
22 
24 class exception_thrown : public event< exception_thrown > {};
25 
26 
27 
29 template< class ExceptionEvent = exception_thrown >
31 {
32  public:
34  // The following declarations should be private.
35  // They are only public because many compilers lack template friends.
37  template< class Action, class ExceptionEventHandler >
38  result operator()( Action action, ExceptionEventHandler eventHandler )
39  {
40  try
41  {
42  return action();
43  }
44  catch ( ... )
45  {
46  return eventHandler( ExceptionEvent() );
47  }
48  }
49 };
50 
51 
52 
53 } // namespace statechart
54 } // namespace boost
55 
56 
57 
58 #endif
boost::statechart::detail::safe_reaction_result
Definition: result.hpp:38
event.hpp
boost
Definition: asynchronous_state_machine.hpp:20
boost::statechart::exception_thrown
Definition: exception_translator.hpp:24
boost::statechart::event
Definition: event.hpp:32
boost::statechart::exception_translator
Definition: exception_translator.hpp:31
result.hpp
boost::statechart::exception_translator::operator()
result operator()(Action action, ExceptionEventHandler eventHandler)
Definition: exception_translator.hpp:38