Imported Upstream version 1.64.0
[platform/upstream/boost.git] / boost / process / detail / posix / handler.hpp
1 // Copyright (c) 2016 Klemens D. Morgenstern\r
2 //\r
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying\r
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r
5
6 #ifndef BOOST_PROCESS_DETAIL_POSIX_HANDLER_HPP_\r
7 #define BOOST_PROCESS_DETAIL_POSIX_HANDLER_HPP_\r
8
9 #include <boost/process/detail/handler_base.hpp>\r
10
11 namespace boost { namespace process { namespace detail { namespace posix {\r
12
13 //does not extend anything.\r
14 struct handler_base_ext : handler_base \r
15 {\r
16     template<typename Executor>\r
17     void on_fork_error  (Executor &, const std::error_code&) const {}\r
18
19     template<typename Executor>\r
20     void on_exec_setup  (Executor &) const {}\r
21
22     template<typename Executor>\r
23     void on_exec_error  (Executor &, const std::error_code&) const {}\r
24 };\r
25
26
27 template <class Handler>\r
28 struct on_fork_error_ : handler_base_ext\r
29 {\r
30     explicit on_fork_error_(Handler handler) : handler_(handler) {}\r
31
32     template <class Executor>\r
33     void on_fork_error(Executor &e, const std::error_code &ec) const\r
34     {\r
35         handler_(e, ec);\r
36     }\r
37 private:\r
38     Handler handler_;\r
39 };\r
40
41
42 template <class Handler>\r
43 struct on_exec_setup_ : handler_base_ext\r
44 {\r
45     explicit on_exec_setup_(Handler handler) : handler_(handler) {}\r
46
47     template <class Executor>\r
48     void on_exec_setup(Executor &e) const\r
49     {\r
50         handler_(e);\r
51     }\r
52 private:\r
53     Handler handler_;\r
54 };\r
55
56 template <class Handler>\r
57 struct on_exec_error_ : handler_base_ext\r
58 {\r
59     explicit on_exec_error_(Handler handler) : handler_(handler) {}\r
60
61     template <class Executor>\r
62     void on_exec_error(Executor &e, const std::error_code &ec) const\r
63     {\r
64         handler_(e, ec);\r
65     }\r
66 private:\r
67     Handler handler_;\r
68 };\r
69
70 }}}}\r
71
72
73
74 #endif /* BOOST_PROCESS_DETAIL_POSIX_HANDLER_HPP_ */\r