Line data Source code
1 : // Copyright (c) 2013-2022 Made to Order Software Corp. All Rights Reserved
2 : //
3 : // https://snapwebsites.org/project/eventdispatcher
4 : // contact@m2osw.com
5 : //
6 : // This program is free software; you can redistribute it and/or modify
7 : // it under the terms of the GNU General Public License as published by
8 : // the Free Software Foundation; either version 2 of the License, or
9 : // (at your option) any later version.
10 : //
11 : // This program is distributed in the hope that it will be useful,
12 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : // GNU General Public License for more details.
15 : //
16 : // You should have received a copy of the GNU General Public License along
17 : // with this program; if not, write to the Free Software Foundation, Inc.,
18 : // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 : #pragma once
20 :
21 : // self
22 : //
23 : #include <cppprocess/io.h>
24 :
25 :
26 : // eventdispatcher
27 : //
28 : #include <eventdispatcher/pipe_connection.h>
29 :
30 :
31 :
32 : namespace cppprocess
33 : {
34 :
35 :
36 :
37 : // base pipe
38 7 : class io_pipe
39 : : public io
40 : , public ed::pipe_connection
41 : {
42 : public:
43 : io_pipe(io_flags_t flags);
44 :
45 : // pipe_connection implementation
46 : //
47 : virtual void process_error() override;
48 : virtual void process_invalid() override;
49 : virtual void process_hup() override;
50 :
51 : // io implementation
52 : //
53 : virtual int get_fd() override;
54 : virtual int get_other_fd() override;
55 : virtual void close_both() override;
56 : virtual void close_other() override;
57 : virtual void process_starting() override;
58 : virtual bool process_done(done_reason_t reason) override;
59 :
60 : static ed::pipe_t flags_to_pipe_mode(io_flags_t flags);
61 :
62 : private:
63 : };
64 :
65 :
66 :
67 : } // namespace cppprocess
68 : // vim: ts=4 sw=4 et
|