• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2016 Klemens D. Morgenstern
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #ifndef BOOST_PROCESS_DETAIL_POSIX_HANDLER_HPP_
7 #define BOOST_PROCESS_DETAIL_POSIX_HANDLER_HPP_
8 
9 #include <boost/process/detail/handler_base.hpp>
10 
11 namespace boost { namespace process { namespace detail { namespace posix {
12 
13 //does not extend anything.
14 struct handler_base_ext : handler_base
15 {
16     template<typename Executor>
on_fork_errorboost::process::detail::posix::handler_base_ext17     void on_fork_error  (Executor &, const std::error_code&) const {}
18 
19     template<typename Executor>
on_exec_setupboost::process::detail::posix::handler_base_ext20     void on_exec_setup  (Executor &) const {}
21 
22     template<typename Executor>
on_exec_errorboost::process::detail::posix::handler_base_ext23     void on_exec_error  (Executor &, const std::error_code&) const {}
24 };
25 
26 
27 template <class Handler>
28 struct on_fork_error_ : handler_base_ext
29 {
on_fork_error_boost::process::detail::posix::on_fork_error_30     explicit on_fork_error_(Handler handler) : handler_(handler) {}
31 
32     template <class Executor>
on_fork_errorboost::process::detail::posix::on_fork_error_33     void on_fork_error(Executor &e, const std::error_code &ec) const
34     {
35         handler_(e, ec);
36     }
37 private:
38     Handler handler_;
39 };
40 
41 
42 template <class Handler>
43 struct on_exec_setup_ : handler_base_ext
44 {
on_exec_setup_boost::process::detail::posix::on_exec_setup_45     explicit on_exec_setup_(Handler handler) : handler_(handler) {}
46 
47     template <class Executor>
on_exec_setupboost::process::detail::posix::on_exec_setup_48     void on_exec_setup(Executor &e) const
49     {
50         handler_(e);
51     }
52 private:
53     Handler handler_;
54 };
55 
56 template <class Handler>
57 struct on_exec_error_ : handler_base_ext
58 {
on_exec_error_boost::process::detail::posix::on_exec_error_59     explicit on_exec_error_(Handler handler) : handler_(handler) {}
60 
61     template <class Executor>
on_exec_errorboost::process::detail::posix::on_exec_error_62     void on_exec_error(Executor &e, const std::error_code &ec) const
63     {
64         handler_(e, ec);
65     }
66 private:
67     Handler handler_;
68 };
69 
70 }}}}
71 
72 
73 
74 #endif /* BOOST_PROCESS_DETAIL_POSIX_HANDLER_HPP_ */
75