WvStreams
wvbufstream.h
1 /* -*- Mode: C++ -*-
2  * Worldvisions Weaver Software:
3  * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4  *
5  * A buffered loopback stream.
6  */
7 #ifndef __WVBUFSTREAM_H
8 #define __WVBUFSTREAM_H
9 
10 #include "wvstream.h"
11 
31 class WvBufStream : public WvStream
32 {
33  bool dead,
34  eof;
36 public:
37  WvBufStream();
38  virtual ~WvBufStream();
39 
40  virtual void close();
41 
42  virtual size_t uread(void *buf, size_t size);
43  virtual size_t uwrite(const void *buf, size_t size);
44  virtual bool isok() const;
45  virtual void pre_select(SelectInfo &si);
46  virtual bool post_select(SelectInfo &si);
47 
48  void seteof() { eof = true; }
49 };
50 
51 
52 #endif // __WVBUFSTREAM_H
WvBufStream::pre_select
virtual void pre_select(SelectInfo &si)
pre_select() sets up for eventually calling ::select().
Definition: wvbufstream.cc:54
WvBufStream::post_select
virtual bool post_select(SelectInfo &si)
post_select() is called after ::select(), and returns true if this object is now ready.
Definition: wvbufstream.cc:63
WvBufStream::close
virtual void close()
Close the stream if it is open; isok() becomes false from now on.
Definition: wvbufstream.cc:24
WvBufStream::isok
virtual bool isok() const
return true if the stream is actually usable right now
Definition: wvbufstream.cc:48
IWvStream::SelectInfo
the data structure used by pre_select()/post_select() and internally by select().
Definition: iwvstream.h:50
WvBufStream::uwrite
virtual size_t uwrite(const void *buf, size_t size)
unbuffered I/O functions; these ignore the buffer, which is handled by write().
Definition: wvbufstream.cc:41
WvStream
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
Definition: wvstream.h:24
WvBufStream
WvBufStream stores data written by write(), and returns it later on in read().
Definition: wvbufstream.h:31
WvBufStream::uread
virtual size_t uread(void *buf, size_t size)
unbuffered I/O functions; these ignore the buffer, which is handled by read().
Definition: wvbufstream.cc:33