Mercurial > hg > vamp-build-and-test
annotate DEPENDENCIES/generic/include/boost/statechart/exception_translator.hpp @ 133:4acb5d8d80b6 tip
Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author | Chris Cannam |
---|---|
date | Tue, 30 Jul 2019 12:25:44 +0100 |
parents | 2665513ce2d3 |
children |
rev | line source |
---|---|
Chris@16 | 1 #ifndef BOOST_STATECHART_EXCEPTION_TRANSLATOR_HPP_INCLUDED |
Chris@16 | 2 #define BOOST_STATECHART_EXCEPTION_TRANSLATOR_HPP_INCLUDED |
Chris@16 | 3 ////////////////////////////////////////////////////////////////////////////// |
Chris@16 | 4 // Copyright 2002-2006 Andreas Huber Doenni |
Chris@16 | 5 // Distributed under the Boost Software License, Version 1.0. (See accompany- |
Chris@16 | 6 // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
Chris@16 | 7 ////////////////////////////////////////////////////////////////////////////// |
Chris@16 | 8 |
Chris@16 | 9 |
Chris@16 | 10 |
Chris@16 | 11 #include <boost/statechart/event.hpp> |
Chris@16 | 12 #include <boost/statechart/result.hpp> |
Chris@16 | 13 |
Chris@16 | 14 |
Chris@16 | 15 |
Chris@16 | 16 namespace boost |
Chris@16 | 17 { |
Chris@16 | 18 namespace statechart |
Chris@16 | 19 { |
Chris@16 | 20 |
Chris@16 | 21 |
Chris@16 | 22 |
Chris@16 | 23 ////////////////////////////////////////////////////////////////////////////// |
Chris@16 | 24 class exception_thrown : public event< exception_thrown > {}; |
Chris@16 | 25 |
Chris@16 | 26 |
Chris@16 | 27 |
Chris@16 | 28 ////////////////////////////////////////////////////////////////////////////// |
Chris@16 | 29 template< class ExceptionEvent = exception_thrown > |
Chris@16 | 30 class exception_translator |
Chris@16 | 31 { |
Chris@16 | 32 public: |
Chris@16 | 33 ////////////////////////////////////////////////////////////////////////// |
Chris@16 | 34 // The following declarations should be private. |
Chris@16 | 35 // They are only public because many compilers lack template friends. |
Chris@16 | 36 ////////////////////////////////////////////////////////////////////////// |
Chris@16 | 37 template< class Action, class ExceptionEventHandler > |
Chris@16 | 38 result operator()( Action action, ExceptionEventHandler eventHandler ) |
Chris@16 | 39 { |
Chris@16 | 40 try |
Chris@16 | 41 { |
Chris@16 | 42 return action(); |
Chris@16 | 43 } |
Chris@16 | 44 catch ( ... ) |
Chris@16 | 45 { |
Chris@16 | 46 return eventHandler( ExceptionEvent() ); |
Chris@16 | 47 } |
Chris@16 | 48 } |
Chris@16 | 49 }; |
Chris@16 | 50 |
Chris@16 | 51 |
Chris@16 | 52 |
Chris@16 | 53 } // namespace statechart |
Chris@16 | 54 } // namespace boost |
Chris@16 | 55 |
Chris@16 | 56 |
Chris@16 | 57 |
Chris@16 | 58 #endif |