WvStreams
Main Page
Modules
Classes
Files
File List
File Members
streams
wvbufstream.cc
1
/*
2
* Worldvisions Weaver Software:
3
* Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4
*
5
* WvBufStream stores data written by write(), and returns it in read().
6
*
7
* See wvbufstream.h.
8
*/
9
#include "wvbufstream.h"
10
11
12
WvBufStream::WvBufStream()
13
{
14
dead = eof =
false
;
15
}
16
17
18
WvBufStream::~WvBufStream()
19
{
20
close
();
21
}
22
23
24
void
WvBufStream::close
()
25
{
26
dead =
true
;
27
WvStream::close
();
28
}
29
30
31
// if uread() is called, someone has already exhausted inbuf... so now it's
32
// time to close our stream so they know they're at EOF.
33
size_t
WvBufStream::uread
(
void
*buf,
size_t
size)
34
{
35
if
(eof)
36
close
();
37
return
0;
38
}
39
40
41
size_t
WvBufStream::uwrite
(
const
void
*buf,
size_t
size)
42
{
43
inbuf.put(buf, size);
44
return
size;
45
}
46
47
48
bool
WvBufStream::isok
()
const
49
{
50
return
!dead;
51
}
52
53
54
void
WvBufStream::pre_select
(
SelectInfo
&si)
55
{
56
WvStream::pre_select
(si);
57
58
if
(si.wants.writable || eof)
59
si.msec_timeout = 0;
60
}
61
62
63
bool
WvBufStream::post_select
(
SelectInfo
&si)
64
{
65
return
WvStream::post_select
(si) || si.wants.writable || eof;
66
}
Generated on Thu Jul 12 2012 23:23:55 for WvStreams by
1.8.1.1