GPL v2.
[metaproxy-moved-to-github.git] / src / pipe.hpp
1 /* $Id: pipe.hpp,v 1.7 2007-05-09 21:23:09 adam Exp $
2    Copyright (c) 2005-2007, Index Data.
3
4 This file is part of Metaproxy.
5
6 Metaproxy is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
9 version.
10
11 Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Metaproxy; see the file LICENSE.  If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA.
20  */
21
22 #ifndef YP2_PIPE_HPP
23 #define YP2_PIPE_HPP
24
25 #include <stdexcept>
26 #include <string>
27 #include <boost/scoped_ptr.hpp>
28
29 #include <yaz/yconfig.h>
30
31 namespace metaproxy_1 {
32     class Pipe {
33         class Error : public std::runtime_error {
34         public:
35             Error(const std::string msg) 
36                 : std::runtime_error("Pipe error: " + msg) {};
37         };
38         class Rep;
39     public:
40         Pipe(int port_to_use);
41         ~Pipe();
42         int &read_fd() const;
43         int &write_fd() const;
44     private:
45         boost::scoped_ptr<Rep> m_p;
46     };
47 }
48 #endif
49 /*
50  * Local variables:
51  * c-basic-offset: 4
52  * indent-tabs-mode: nil
53  * c-file-style: "stroustrup"
54  * End:
55  * vim: shiftwidth=4 tabstop=8 expandtab
56  */
57