WvStreams
include/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
31class WvBufStream : public WvStream
32{
33 bool dead,
34 eof;
36public:
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 stores data written by write(), and returns it later on in read().
virtual void pre_select(SelectInfo &si)
pre_select() sets up for eventually calling select().
virtual size_t uread(void *buf, size_t size)
unbuffered I/O functions; these ignore the buffer, which is handled by read().
virtual size_t uwrite(const void *buf, size_t size)
unbuffered I/O functions; these ignore the buffer, which is handled by write().
virtual bool post_select(SelectInfo &si)
post_select() is called after select(), and returns true if this object is now ready.
virtual bool isok() const
return true if the stream is actually usable right now
virtual void close()
Close the stream if it is open; isok() becomes false from now on.
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
the data structure used by pre_select()/post_select() and internally by select().