/[eiffelstudio]/FreeELKS/trunk/library/kernel/io_medium.e
ViewVC logotype

Contents of /FreeELKS/trunk/library/kernel/io_medium.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 91477 - (show annotations)
Sun Jan 14 09:47:13 2007 UTC (13 years ago) by ericb
File size: 10011 byte(s)
Synchronized with ISE 6.0.65740
1 indexing
2 description: "Any medium that can perform input and/or output"
3 library: "Free implementation of ELKS library"
4 copyright: "Copyright (c) 1986-2004, Eiffel Software and others"
5 license: "Eiffel Forum License v2 (see forum.txt)"
6 date: "$Date$"
7 revision: "$Revision$"
8
9 deferred class IO_MEDIUM
10
11 inherit
12 DISPOSABLE
13 export
14 {NONE} all
15 end
16
17 STRING_HANDLER
18
19 feature -- Access
20
21 name: STRING is
22 -- Medium name
23 deferred
24 end
25
26 retrieved: ANY is
27 -- Retrieved object structure
28 -- To access resulting object under correct type,
29 -- use assignment attempt.
30 -- Will raise an exception (code `Retrieve_exception')
31 -- if content is not a stored Eiffel structure.
32 require
33 is_readable: readable
34 support_storable: support_storable
35 deferred
36 ensure
37 Result_exists: Result /= Void
38 end
39
40 feature -- Element change
41
42 basic_store (object: ANY) is
43 -- Produce an external representation of the
44 -- entire object structure reachable from `object'.
45 -- Retrievable within current system only.
46 require
47 object_not_void: object /= Void
48 extendible: extendible
49 support_storable: support_storable
50 deferred
51 end
52
53 general_store (object: ANY) is
54 -- Produce an external representation of the
55 -- entire object structure reachable from `object'.
56 -- Retrievable from other systems for same platform
57 -- (machine architecture).
58 --| This feature may use a visible name of a class written
59 --| in the `visible' clause of the Ace file. This makes it
60 --| possible to overcome class name clashes.
61 require
62 object_not_void: object /= Void
63 extendible: extendible
64 support_storable: support_storable
65 deferred
66 end
67
68 independent_store (object: ANY) is
69 -- Produce an external representation of the
70 -- entire object structure reachable from `object'.
71 -- Retrievable from other systems for the same or other
72 -- platform (machine architecture).
73 require
74 object_not_void: object /= Void
75 extendible: extendible
76 support_storable: support_storable
77 deferred
78 end
79
80 feature -- Status report
81
82 handle: INTEGER is
83 -- Handle to medium
84 require
85 valid_handle: handle_available
86 deferred
87 end
88
89 handle_available: BOOLEAN is
90 -- Is the handle available after class has been
91 -- created?
92 deferred
93 end
94
95 is_plain_text: BOOLEAN is
96 -- Is file reserved for text (character sequences)?
97 do
98 end
99
100 last_character: CHARACTER
101 -- Last character read by `read_character'
102
103 last_string: STRING
104 -- Last string read
105
106 last_integer: INTEGER
107 -- Last integer read by `read_integer'
108
109 last_integer_32: INTEGER is
110 -- Synonymy of `last_integer'
111 do
112 Result := last_integer
113 end
114
115 last_integer_64: INTEGER_64
116 -- Last 64-bit integer read by `read_integer_64'
117
118 last_integer_16: INTEGER_16
119 -- Last 16-bit integer read by `read_integer_16'
120
121 last_integer_8: INTEGER_8
122 -- Last 8-bit integer read by `read_integer_8'
123
124 last_natural_64: NATURAL_64
125 -- Last 64-bit natural read by `read_natural_64'
126
127 last_natural: NATURAL_32
128 -- Last 32-bit natural read by `read_natural'
129
130 last_natural_32: NATURAL_32 is
131 -- Synonymy of `last_natural'
132 do
133 Result := last_natural
134 end
135
136 last_natural_16: NATURAL_16
137 -- Last 16-bit natural read by `read_natural_16'
138
139 last_natural_8: NATURAL_8
140 -- Last 8-bit natural read by `read_natural_8'
141
142 last_real: REAL
143 -- Last real read by `read_real'
144
145 last_double: DOUBLE
146 -- Last double read by `read_double'
147
148 bytes_read: INTEGER
149 -- Last number of bytes read by `read_to_managed_pointer'.
150
151 exists: BOOLEAN is
152 -- Does medium exist?
153 deferred
154 end
155
156 is_open_read: BOOLEAN is
157 -- Is this medium opened for input
158 deferred
159 end
160
161 is_open_write: BOOLEAN is
162 -- Is this medium opened for output
163 deferred
164 end
165
166 is_readable: BOOLEAN is
167 -- Is medium readable?
168 require
169 handle_exists: exists
170 deferred
171 end
172
173 is_executable: BOOLEAN is
174 -- Is medium executable?
175 require
176 handle_exists: exists
177 deferred
178 end
179
180 is_writable: BOOLEAN is
181 -- Is medium writable?
182 require
183 handle_exists: exists
184 deferred
185 end
186
187 readable: BOOLEAN is
188 -- Is there a current item that may be read?
189 require
190 handle_exists: exists
191 deferred
192 end
193
194 extendible: BOOLEAN is
195 -- May new items be added?
196 deferred
197 end
198
199 is_closed: BOOLEAN is
200 -- Is the I/O medium open
201 deferred
202 end
203
204 support_storable: BOOLEAN is
205 -- Can medium be used to store an Eiffel object?
206 deferred
207 end
208
209 feature -- Status setting
210
211 close is
212 -- Close medium.
213 require
214 medium_is_open: not is_closed
215 deferred
216 end
217
218 feature -- Removal
219
220 dispose is
221 -- Ensure this medium is closed when garbage collected.
222 do
223 if not is_closed then
224 close
225 end
226 end
227
228 feature -- Output
229
230 put_new_line, new_line is
231 -- Write a new line character to medium
232 require
233 extendible: extendible
234 deferred
235 end
236
237 put_string, putstring (s: STRING) is
238 -- Write `s' to medium.
239 require
240 extendible: extendible
241 non_void: s /= Void
242 deferred
243 end
244
245 put_character, putchar (c: CHARACTER) is
246 -- Write `c' to medium.
247 require
248 extendible: extendible
249 deferred
250 end
251
252 put_real, putreal (r: REAL) is
253 -- Write `r' to medium.
254 require
255 extendible: extendible
256 deferred
257 end
258
259 put_integer, putint, put_integer_32 (i: INTEGER) is
260 -- Write `i' to medium.
261 require
262 extendible: extendible
263 deferred
264 end
265
266 put_integer_8 (i: INTEGER_8) is
267 -- Write `i' to medium.
268 require
269 extendible: extendible
270 deferred
271 end
272
273 put_integer_16 (i: INTEGER_16) is
274 -- Write `i' to medium.
275 require
276 extendible: extendible
277 deferred
278 end
279
280 put_integer_64 (i: INTEGER_64) is
281 -- Write `i' to medium.
282 require
283 extendible: extendible
284 deferred
285 end
286
287 put_natural_8 (i: NATURAL_8) is
288 -- Write `i' to medium.
289 require
290 extendible: extendible
291 deferred
292 end
293
294 put_natural_16 (i: NATURAL_16) is
295 -- Write `i' to medium.
296 require
297 extendible: extendible
298 deferred
299 end
300
301 put_natural, put_natural_32 (i: NATURAL_32) is
302 -- Write `i' to medium.
303 require
304 extendible: extendible
305 deferred
306 end
307
308 put_natural_64 (i: NATURAL_64) is
309 -- Write `i' to medium.
310 require
311 extendible: extendible
312 deferred
313 end
314
315 put_boolean, putbool (b: BOOLEAN) is
316 -- Write `b' to medium.
317 require
318 extendible: extendible
319 deferred
320 end
321
322 put_double, putdouble (d: DOUBLE) is
323 -- Write `d' to medium.
324 require
325 extendible: extendible
326 deferred
327 end
328
329 put_managed_pointer (p: MANAGED_POINTER; start_pos, nb_bytes: INTEGER) is
330 -- Put data of length `nb_bytes' pointed by `start_pos' index in `p' at
331 -- current position.
332 require
333 p_not_void: p /= Void
334 p_large_enough: p.count >= nb_bytes + start_pos
335 nb_bytes_non_negative: nb_bytes >= 0
336 extendible: extendible
337 deferred
338 end
339
340 feature -- Input
341
342 read_real, readreal is
343 -- Read a new real.
344 -- Make result available in `last_real'.
345 require
346 is_readable: readable
347 deferred
348 end
349
350 read_double, readdouble is
351 -- Read a new double.
352 -- Make result available in `last_double'.
353 require
354 is_readable: readable
355 deferred
356 end
357
358 read_character, readchar is
359 -- Read a new character.
360 -- Make result available in `last_character'.
361 require
362 is_readable: readable
363 deferred
364 end
365
366 read_integer, readint, read_integer_32 is
367 -- Read a new 32-bit integer.
368 -- Make result available in `last_integer'.
369 require
370 is_readable: readable
371 deferred
372 end
373
374 read_integer_8 is
375 -- Read a new 8-bit integer.
376 -- Make result available in `last_integer_8'.
377 require
378 is_readable: readable
379 deferred
380 end
381
382 read_integer_16 is
383 -- Read a new 16-bit integer.
384 -- Make result available in `last_integer_16'.
385 require
386 is_readable: readable
387 deferred
388 end
389
390 read_integer_64 is
391 -- Read a new 64-bit integer.
392 -- Make result available in `last_integer_64'.
393 require
394 is_readable: readable
395 deferred
396 end
397
398 read_natural_8 is
399 -- Read a new 8-bit natural.
400 -- Make result available in `last_natural_8'.
401 require
402 is_readable: readable
403 deferred
404 end
405
406 read_natural_16 is
407 -- Read a new 16-bit natural.
408 -- Make result available in `last_natural_16'.
409 require
410 is_readable: readable
411 deferred
412 end
413
414 read_natural, read_natural_32 is
415 -- Read a new 32-bit natural.
416 -- Make result available in `last_natural'.
417 require
418 is_readable: readable
419 deferred
420 end
421
422 read_natural_64 is
423 -- Read a new 64-bit natural.
424 -- Make result available in `last_natural_64'.
425 require
426 is_readable: readable
427 deferred
428 end
429
430 read_stream, readstream (nb_char: INTEGER) is
431 -- Read a string of at most `nb_char' bound characters
432 -- or until end of medium is encountered.
433 -- Make result available in `last_string'.
434 require
435 is_readable: readable
436 deferred
437 ensure
438 last_string_not_void: last_string /= Void
439 end
440
441 read_line, readline is
442 -- Read characters until a new line or
443 -- end of medium.
444 -- Make result available in `last_string'.
445 require
446 is_readable: readable
447 deferred
448 ensure
449 last_string_not_void: last_string /= Void
450 end
451
452 read_to_managed_pointer (p: MANAGED_POINTER; start_pos, nb_bytes: INTEGER) is
453 -- Read at most `nb_bytes' bound bytes and make result
454 -- available in `p' at position `start_pos'.
455 require
456 p_not_void: p /= Void
457 p_large_enough: p.count >= nb_bytes + start_pos
458 nb_bytes_non_negative: nb_bytes >= 0
459 is_readable: readable
460 deferred
461 ensure
462 bytes_read_non_negative: bytes_read >= 0
463 bytes_read_not_too_big: bytes_read <= nb_bytes
464 end
465
466 feature -- Obsolete
467
468 lastchar: CHARACTER is
469 -- Last character read by `read_character'
470 do
471 Result := last_character
472 end
473
474 laststring: STRING is
475 -- Last string read
476 do
477 Result := last_string
478 end
479
480 lastint: INTEGER is
481 -- Last integer read by `read_integer'
482 do
483 Result := last_integer
484 end
485
486 lastreal: REAL is
487 -- Last real read by `read_real'
488 do
489 Result := last_real
490 end
491
492 lastdouble: DOUBLE is
493 -- Last double read by `read_double'
494 do
495 Result := last_double
496 end
497
498 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23