annotate src/share/vm/utilities/ostream.hpp @ 1941:79d04223b8a5

Added caching for resolved types and resolved fields. This is crucial, because the local load elimination will lead to wrong results, if field equality (of two RiField objects with the same object and the same RiType) is not given. The caching makes sure that the default equals implementation is sufficient.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Tue, 28 Dec 2010 18:33:26 +0100
parents c18cbe5936b8
children f95d63e2154a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 356
diff changeset
2 * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 356
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 356
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 356
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 // Output streams for printing
a61af66fc99e Initial load
duke
parents:
diff changeset
26 //
a61af66fc99e Initial load
duke
parents:
diff changeset
27 // Printing guidelines:
a61af66fc99e Initial load
duke
parents:
diff changeset
28 // Where possible, please use tty->print() and tty->print_cr().
a61af66fc99e Initial load
duke
parents:
diff changeset
29 // For product mode VM warnings use warning() which internally uses tty.
a61af66fc99e Initial load
duke
parents:
diff changeset
30 // In places where tty is not initialized yet or too much overhead,
a61af66fc99e Initial load
duke
parents:
diff changeset
31 // we may use jio_printf:
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // jio_fprintf(defaultStream::output_stream(), "Message");
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // This allows for redirection via -XX:+DisplayVMOutputToStdout and
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // -XX:+DisplayVMOutputToStderr
a61af66fc99e Initial load
duke
parents:
diff changeset
35 class outputStream : public ResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
36 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
37 int _indentation; // current indentation
a61af66fc99e Initial load
duke
parents:
diff changeset
38 int _width; // width of the page
a61af66fc99e Initial load
duke
parents:
diff changeset
39 int _position; // position on the current line
a61af66fc99e Initial load
duke
parents:
diff changeset
40 int _newlines; // number of '\n' output so far
a61af66fc99e Initial load
duke
parents:
diff changeset
41 julong _precount; // number of chars output, less _position
a61af66fc99e Initial load
duke
parents:
diff changeset
42 TimeStamp _stamp; // for time stamps
a61af66fc99e Initial load
duke
parents:
diff changeset
43
a61af66fc99e Initial load
duke
parents:
diff changeset
44 void update_position(const char* s, size_t len);
a61af66fc99e Initial load
duke
parents:
diff changeset
45 static const char* do_vsnprintf(char* buffer, size_t buflen,
a61af66fc99e Initial load
duke
parents:
diff changeset
46 const char* format, va_list ap,
a61af66fc99e Initial load
duke
parents:
diff changeset
47 bool add_cr,
a61af66fc99e Initial load
duke
parents:
diff changeset
48 size_t& result_len);
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
51 // creation
a61af66fc99e Initial load
duke
parents:
diff changeset
52 outputStream(int width = 80);
a61af66fc99e Initial load
duke
parents:
diff changeset
53 outputStream(int width, bool has_time_stamps);
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // indentation
a61af66fc99e Initial load
duke
parents:
diff changeset
56 void indent();
a61af66fc99e Initial load
duke
parents:
diff changeset
57 void inc() { _indentation++; };
a61af66fc99e Initial load
duke
parents:
diff changeset
58 void dec() { _indentation--; };
a61af66fc99e Initial load
duke
parents:
diff changeset
59 int indentation() const { return _indentation; }
a61af66fc99e Initial load
duke
parents:
diff changeset
60 void set_indentation(int i) { _indentation = i; }
a61af66fc99e Initial load
duke
parents:
diff changeset
61 void fill_to(int col);
100
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 0
diff changeset
62 void move_to(int col, int slop = 6, int min_space = 2);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
63
a61af66fc99e Initial load
duke
parents:
diff changeset
64 // sizing
a61af66fc99e Initial load
duke
parents:
diff changeset
65 int width() const { return _width; }
a61af66fc99e Initial load
duke
parents:
diff changeset
66 int position() const { return _position; }
a61af66fc99e Initial load
duke
parents:
diff changeset
67 int newlines() const { return _newlines; }
a61af66fc99e Initial load
duke
parents:
diff changeset
68 julong count() const { return _precount + _position; }
a61af66fc99e Initial load
duke
parents:
diff changeset
69 void set_count(julong count) { _precount = count - _position; }
a61af66fc99e Initial load
duke
parents:
diff changeset
70 void set_position(int pos) { _position = pos; }
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 // printing
a61af66fc99e Initial load
duke
parents:
diff changeset
73 void print(const char* format, ...);
a61af66fc99e Initial load
duke
parents:
diff changeset
74 void print_cr(const char* format, ...);
a61af66fc99e Initial load
duke
parents:
diff changeset
75 void vprint(const char *format, va_list argptr);
a61af66fc99e Initial load
duke
parents:
diff changeset
76 void vprint_cr(const char* format, va_list argptr);
a61af66fc99e Initial load
duke
parents:
diff changeset
77 void print_raw(const char* str) { write(str, strlen(str)); }
a61af66fc99e Initial load
duke
parents:
diff changeset
78 void print_raw(const char* str, int len) { write(str, len); }
a61af66fc99e Initial load
duke
parents:
diff changeset
79 void print_raw_cr(const char* str) { write(str, strlen(str)); cr(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
80 void print_raw_cr(const char* str, int len){ write(str, len); cr(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
81 void put(char ch);
100
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 0
diff changeset
82 void sp(int count = 1);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
83 void cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
84 void bol() { if (_position > 0) cr(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
85
a61af66fc99e Initial load
duke
parents:
diff changeset
86 // Time stamp
a61af66fc99e Initial load
duke
parents:
diff changeset
87 TimeStamp& time_stamp() { return _stamp; }
a61af66fc99e Initial load
duke
parents:
diff changeset
88 void stamp();
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 100
diff changeset
89 void stamp(bool guard, const char* prefix, const char* suffix);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 100
diff changeset
90 void stamp(bool guard) {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 100
diff changeset
91 stamp(guard, "", ": ");
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 100
diff changeset
92 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
93 // Date stamp
a61af66fc99e Initial load
duke
parents:
diff changeset
94 void date_stamp(bool guard, const char* prefix, const char* suffix);
a61af66fc99e Initial load
duke
parents:
diff changeset
95 // A simplified call that includes a suffix of ": "
a61af66fc99e Initial load
duke
parents:
diff changeset
96 void date_stamp(bool guard) {
a61af66fc99e Initial load
duke
parents:
diff changeset
97 date_stamp(guard, "", ": ");
a61af66fc99e Initial load
duke
parents:
diff changeset
98 }
a61af66fc99e Initial load
duke
parents:
diff changeset
99
a61af66fc99e Initial load
duke
parents:
diff changeset
100 // portable printing of 64 bit integers
a61af66fc99e Initial load
duke
parents:
diff changeset
101 void print_jlong(jlong value);
a61af66fc99e Initial load
duke
parents:
diff changeset
102 void print_julong(julong value);
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 // flushing
a61af66fc99e Initial load
duke
parents:
diff changeset
105 virtual void flush() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
106 virtual void write(const char* str, size_t len) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
107 virtual ~outputStream() {} // close properly on deletion
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 void dec_cr() { dec(); cr(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
110 void inc_cr() { inc(); cr(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
111 };
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 // standard output
a61af66fc99e Initial load
duke
parents:
diff changeset
114 // ANSI C++ name collision
a61af66fc99e Initial load
duke
parents:
diff changeset
115 extern outputStream* tty; // tty output
a61af66fc99e Initial load
duke
parents:
diff changeset
116 extern outputStream* gclog_or_tty; // stream for gc log if -Xloggc:<f>, or tty
a61af66fc99e Initial load
duke
parents:
diff changeset
117
a61af66fc99e Initial load
duke
parents:
diff changeset
118 // advisory locking for the shared tty stream:
a61af66fc99e Initial load
duke
parents:
diff changeset
119 class ttyLocker: StackObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
120 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
121 intx _holder;
a61af66fc99e Initial load
duke
parents:
diff changeset
122
a61af66fc99e Initial load
duke
parents:
diff changeset
123 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
124 static intx hold_tty(); // returns a "holder" token
a61af66fc99e Initial load
duke
parents:
diff changeset
125 static void release_tty(intx holder); // must witness same token
a61af66fc99e Initial load
duke
parents:
diff changeset
126 static void break_tty_lock_for_safepoint(intx holder);
a61af66fc99e Initial load
duke
parents:
diff changeset
127
a61af66fc99e Initial load
duke
parents:
diff changeset
128 ttyLocker() { _holder = hold_tty(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
129 ~ttyLocker() { release_tty(_holder); }
a61af66fc99e Initial load
duke
parents:
diff changeset
130 };
a61af66fc99e Initial load
duke
parents:
diff changeset
131
a61af66fc99e Initial load
duke
parents:
diff changeset
132 // for writing to strings; buffer will expand automatically
a61af66fc99e Initial load
duke
parents:
diff changeset
133 class stringStream : public outputStream {
a61af66fc99e Initial load
duke
parents:
diff changeset
134 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
135 char* buffer;
a61af66fc99e Initial load
duke
parents:
diff changeset
136 size_t buffer_pos;
a61af66fc99e Initial load
duke
parents:
diff changeset
137 size_t buffer_length;
a61af66fc99e Initial load
duke
parents:
diff changeset
138 bool buffer_fixed;
a61af66fc99e Initial load
duke
parents:
diff changeset
139 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
140 stringStream(size_t initial_bufsize = 256);
a61af66fc99e Initial load
duke
parents:
diff changeset
141 stringStream(char* fixed_buffer, size_t fixed_buffer_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
142 ~stringStream();
a61af66fc99e Initial load
duke
parents:
diff changeset
143 virtual void write(const char* c, size_t len);
a61af66fc99e Initial load
duke
parents:
diff changeset
144 size_t size() { return buffer_pos; }
a61af66fc99e Initial load
duke
parents:
diff changeset
145 const char* base() { return buffer; }
a61af66fc99e Initial load
duke
parents:
diff changeset
146 void reset() { buffer_pos = 0; _precount = 0; _position = 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
147 char* as_string();
a61af66fc99e Initial load
duke
parents:
diff changeset
148 };
a61af66fc99e Initial load
duke
parents:
diff changeset
149
a61af66fc99e Initial load
duke
parents:
diff changeset
150 class fileStream : public outputStream {
a61af66fc99e Initial load
duke
parents:
diff changeset
151 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
152 FILE* _file;
a61af66fc99e Initial load
duke
parents:
diff changeset
153 bool _need_close;
a61af66fc99e Initial load
duke
parents:
diff changeset
154 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
155 fileStream(const char* file_name);
a61af66fc99e Initial load
duke
parents:
diff changeset
156 fileStream(FILE* file) { _file = file; _need_close = false; }
a61af66fc99e Initial load
duke
parents:
diff changeset
157 ~fileStream();
a61af66fc99e Initial load
duke
parents:
diff changeset
158 bool is_open() const { return _file != NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
159 virtual void write(const char* c, size_t len);
a61af66fc99e Initial load
duke
parents:
diff changeset
160 void flush();
a61af66fc99e Initial load
duke
parents:
diff changeset
161 };
a61af66fc99e Initial load
duke
parents:
diff changeset
162
a61af66fc99e Initial load
duke
parents:
diff changeset
163 // unlike fileStream, fdStream does unbuffered I/O by calling
a61af66fc99e Initial load
duke
parents:
diff changeset
164 // open() and write() directly. It is async-safe, but output
a61af66fc99e Initial load
duke
parents:
diff changeset
165 // from multiple thread may be mixed together. Used by fatal
a61af66fc99e Initial load
duke
parents:
diff changeset
166 // error handler.
a61af66fc99e Initial load
duke
parents:
diff changeset
167 class fdStream : public outputStream {
a61af66fc99e Initial load
duke
parents:
diff changeset
168 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
169 int _fd;
a61af66fc99e Initial load
duke
parents:
diff changeset
170 bool _need_close;
a61af66fc99e Initial load
duke
parents:
diff changeset
171 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
172 fdStream(const char* file_name);
a61af66fc99e Initial load
duke
parents:
diff changeset
173 fdStream(int fd = -1) { _fd = fd; _need_close = false; }
a61af66fc99e Initial load
duke
parents:
diff changeset
174 ~fdStream();
a61af66fc99e Initial load
duke
parents:
diff changeset
175 bool is_open() const { return _fd != -1; }
a61af66fc99e Initial load
duke
parents:
diff changeset
176 void set_fd(int fd) { _fd = fd; _need_close = false; }
a61af66fc99e Initial load
duke
parents:
diff changeset
177 int fd() const { return _fd; }
a61af66fc99e Initial load
duke
parents:
diff changeset
178 virtual void write(const char* c, size_t len);
a61af66fc99e Initial load
duke
parents:
diff changeset
179 void flush() {};
a61af66fc99e Initial load
duke
parents:
diff changeset
180 };
a61af66fc99e Initial load
duke
parents:
diff changeset
181
a61af66fc99e Initial load
duke
parents:
diff changeset
182 void ostream_init();
a61af66fc99e Initial load
duke
parents:
diff changeset
183 void ostream_init_log();
a61af66fc99e Initial load
duke
parents:
diff changeset
184 void ostream_exit();
a61af66fc99e Initial load
duke
parents:
diff changeset
185 void ostream_abort();
a61af66fc99e Initial load
duke
parents:
diff changeset
186
a61af66fc99e Initial load
duke
parents:
diff changeset
187 // staticBufferStream uses a user-supplied buffer for all formatting.
a61af66fc99e Initial load
duke
parents:
diff changeset
188 // Used for safe formatting during fatal error handling. Not MT safe.
a61af66fc99e Initial load
duke
parents:
diff changeset
189 // Do not share the stream between multiple threads.
a61af66fc99e Initial load
duke
parents:
diff changeset
190 class staticBufferStream : public outputStream {
a61af66fc99e Initial load
duke
parents:
diff changeset
191 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
192 char* _buffer;
a61af66fc99e Initial load
duke
parents:
diff changeset
193 size_t _buflen;
a61af66fc99e Initial load
duke
parents:
diff changeset
194 outputStream* _outer_stream;
a61af66fc99e Initial load
duke
parents:
diff changeset
195 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
196 staticBufferStream(char* buffer, size_t buflen,
a61af66fc99e Initial load
duke
parents:
diff changeset
197 outputStream *outer_stream);
a61af66fc99e Initial load
duke
parents:
diff changeset
198 ~staticBufferStream() {};
a61af66fc99e Initial load
duke
parents:
diff changeset
199 virtual void write(const char* c, size_t len);
a61af66fc99e Initial load
duke
parents:
diff changeset
200 void flush();
a61af66fc99e Initial load
duke
parents:
diff changeset
201 void print(const char* format, ...);
a61af66fc99e Initial load
duke
parents:
diff changeset
202 void print_cr(const char* format, ...);
a61af66fc99e Initial load
duke
parents:
diff changeset
203 void vprint(const char *format, va_list argptr);
a61af66fc99e Initial load
duke
parents:
diff changeset
204 void vprint_cr(const char* format, va_list argptr);
a61af66fc99e Initial load
duke
parents:
diff changeset
205 };
a61af66fc99e Initial load
duke
parents:
diff changeset
206
a61af66fc99e Initial load
duke
parents:
diff changeset
207 // In the non-fixed buffer case an underlying buffer will be created and
a61af66fc99e Initial load
duke
parents:
diff changeset
208 // managed in C heap. Not MT-safe.
a61af66fc99e Initial load
duke
parents:
diff changeset
209 class bufferedStream : public outputStream {
a61af66fc99e Initial load
duke
parents:
diff changeset
210 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
211 char* buffer;
a61af66fc99e Initial load
duke
parents:
diff changeset
212 size_t buffer_pos;
222
2a1a77d3458f 6718676: putback for 6604014 is incomplete
never
parents: 100
diff changeset
213 size_t buffer_max;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
214 size_t buffer_length;
a61af66fc99e Initial load
duke
parents:
diff changeset
215 bool buffer_fixed;
a61af66fc99e Initial load
duke
parents:
diff changeset
216 public:
222
2a1a77d3458f 6718676: putback for 6604014 is incomplete
never
parents: 100
diff changeset
217 bufferedStream(size_t initial_bufsize = 256, size_t bufmax = 1024*1024*10);
2a1a77d3458f 6718676: putback for 6604014 is incomplete
never
parents: 100
diff changeset
218 bufferedStream(char* fixed_buffer, size_t fixed_buffer_size, size_t bufmax = 1024*1024*10);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
219 ~bufferedStream();
a61af66fc99e Initial load
duke
parents:
diff changeset
220 virtual void write(const char* c, size_t len);
a61af66fc99e Initial load
duke
parents:
diff changeset
221 size_t size() { return buffer_pos; }
a61af66fc99e Initial load
duke
parents:
diff changeset
222 const char* base() { return buffer; }
a61af66fc99e Initial load
duke
parents:
diff changeset
223 void reset() { buffer_pos = 0; _precount = 0; _position = 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
224 char* as_string();
a61af66fc99e Initial load
duke
parents:
diff changeset
225 };
a61af66fc99e Initial load
duke
parents:
diff changeset
226
a61af66fc99e Initial load
duke
parents:
diff changeset
227 #define O_BUFLEN 2000 // max size of output of individual print() methods
a61af66fc99e Initial load
duke
parents:
diff changeset
228
a61af66fc99e Initial load
duke
parents:
diff changeset
229 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
230
a61af66fc99e Initial load
duke
parents:
diff changeset
231 class networkStream : public bufferedStream {
a61af66fc99e Initial load
duke
parents:
diff changeset
232
a61af66fc99e Initial load
duke
parents:
diff changeset
233 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
234 int _socket;
a61af66fc99e Initial load
duke
parents:
diff changeset
235
a61af66fc99e Initial load
duke
parents:
diff changeset
236 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
237 networkStream();
a61af66fc99e Initial load
duke
parents:
diff changeset
238 ~networkStream();
a61af66fc99e Initial load
duke
parents:
diff changeset
239
a61af66fc99e Initial load
duke
parents:
diff changeset
240 bool connect(const char *host, short port);
a61af66fc99e Initial load
duke
parents:
diff changeset
241 bool is_open() const { return _socket != -1; }
a61af66fc99e Initial load
duke
parents:
diff changeset
242 int read(char *buf, size_t len);
a61af66fc99e Initial load
duke
parents:
diff changeset
243 void close();
a61af66fc99e Initial load
duke
parents:
diff changeset
244 virtual void flush();
a61af66fc99e Initial load
duke
parents:
diff changeset
245 };
a61af66fc99e Initial load
duke
parents:
diff changeset
246
a61af66fc99e Initial load
duke
parents:
diff changeset
247 #endif