|
||||
File indexing completed on 2025-01-18 09:52:31
0001 #ifndef BOOST_STATECHART_EXCEPTION_TRANSLATOR_HPP_INCLUDED 0002 #define BOOST_STATECHART_EXCEPTION_TRANSLATOR_HPP_INCLUDED 0003 ////////////////////////////////////////////////////////////////////////////// 0004 // Copyright 2002-2006 Andreas Huber Doenni 0005 // Distributed under the Boost Software License, Version 1.0. (See accompany- 0006 // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 0007 ////////////////////////////////////////////////////////////////////////////// 0008 0009 0010 0011 #include <boost/statechart/event.hpp> 0012 #include <boost/statechart/result.hpp> 0013 0014 0015 0016 namespace boost 0017 { 0018 namespace statechart 0019 { 0020 0021 0022 0023 ////////////////////////////////////////////////////////////////////////////// 0024 class exception_thrown : public event< exception_thrown > {}; 0025 0026 0027 0028 ////////////////////////////////////////////////////////////////////////////// 0029 template< class ExceptionEvent = exception_thrown > 0030 class exception_translator 0031 { 0032 public: 0033 ////////////////////////////////////////////////////////////////////////// 0034 // The following declarations should be private. 0035 // They are only public because many compilers lack template friends. 0036 ////////////////////////////////////////////////////////////////////////// 0037 template< class Action, class ExceptionEventHandler > 0038 result operator()( Action action, ExceptionEventHandler eventHandler ) 0039 { 0040 try 0041 { 0042 return action(); 0043 } 0044 catch ( ... ) 0045 { 0046 return eventHandler( ExceptionEvent() ); 0047 } 0048 } 0049 }; 0050 0051 0052 0053 } // namespace statechart 0054 } // namespace boost 0055 0056 0057 0058 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |