Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
StreamPipe.h
1 /*
2  * io::StreamPipe class interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2013, IRIT UPS.
6  *
7  * OTAWA is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * OTAWA is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OTAWA; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef ELM_IO_STREAMPIPE_H_
23 #define ELM_IO_STREAMPIPE_H_
24 
25 #include <elm/string.h>
26 
27 namespace elm { namespace io {
28 
29 class InStream;
30 class OutStream;
31 
32 class StreamPipe {
33 public:
34  StreamPipe(InStream& in, OutStream& out, int buffer_size = 1 << 16);
35  ~StreamPipe(void);
36  int proceed(void);
37  string lastErrorMessage(void) const;
38 private:
39  InStream& _in;
40  OutStream& _out;
41  enum {
42  OK = 0,
43  IN_ERROR,
44  OUT_ERROR
45  } state;
46  int bufs;
47  char *buf;
48 };
49 
50 } } // elm::io
51 
52 #endif /* ELM_IO_STREAMPIPE_H_ */
elm::io::StreamPipe::lastErrorMessage
string lastErrorMessage(void) const
Definition: io_StreamPipe.cpp:89
elm::io::out
sys::SystemOutStream & out
Definition: system_SystemIO.cpp:122
elm::io::StreamPipe
Definition: StreamPipe.h:32
elm
Definition: adapter.h:26
elm::io::OutStream
Definition: OutStream.h:30
elm::io::StreamPipe::proceed
int proceed(void)
Definition: io_StreamPipe.cpp:60
elm::io::StreamPipe::StreamPipe
StreamPipe(InStream &in, OutStream &out, int buffer_size=1<< 16)
Definition: io_StreamPipe.cpp:44
elm::io::StreamPipe::~StreamPipe
~StreamPipe(void)
Definition: io_StreamPipe.cpp:51
elm::io::in
sys::SystemInStream & in
Definition: system_SystemIO.cpp:116
elm::io::InStream
Definition: InStream.h:29