WvStreams
wvstreamclone.h
1 /* -*- Mode: C++ -*-
2  * Worldvisions Weaver Software:
3  * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4  *
5  * Provides support for constructing streams that wrap other streams.
6  * This can turn a (relatively useless) IWvStream into a useful WvStream.
7  */
8 #ifndef __WVSTREAMCLONE_H
9 #define __WVSTREAMCLONE_H
10 
11 #include "wvstream.h"
12 
23 class WvStreamClone : public WvStream
24 {
25 public:
30  WvStreamClone(IWvStream *_cloned = NULL);
31 
42  virtual ~WvStreamClone();
43 
44  IWvStream *cloned;
45 
62  virtual void setclone(IWvStream *clone);
63 
69  virtual void close();
70 
76  virtual bool flush_internal(time_t msec_timeout);
77  virtual size_t uread(void *buf, size_t size);
78  virtual size_t uwrite(const void *buf, size_t size);
79  virtual bool isok() const;
80  virtual int geterr() const;
81  virtual WvString errstr() const;
82  virtual void pre_select(SelectInfo &si);
83  virtual bool post_select(SelectInfo &si);
84  virtual const WvAddr *src() const;
85  virtual void execute();
86  virtual void noread();
87  virtual void nowrite();
88  virtual WvString getattr(WvStringParm name) const;
89 
90 private:
91  void close_callback();
92 
93 protected:
94  WvString my_type;
95 public:
96  const char *wstype() const { return my_type; }
97 };
98 
99 #endif // __WVSTREAMCLONE_H
Base class for different address types, each of which will have the ability to convert itself to/from...
Definition: wvaddr.h:119
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
Definition: wvstring.h:94
WvStreamClone simply forwards all requests to the "cloned" stream.
Definition: wvstreamclone.h:24
virtual void setclone(IWvStream *clone)
WvStreamClone takes ownership of the given stream; it will WVRELEASE() the stream when you setclone()...
virtual ~WvStreamClone()
The WvStreamClone destructor.
virtual void pre_select(SelectInfo &si)
pre_select() sets up for eventually calling ::select().
virtual void close()
Close this stream.
WvStreamClone(IWvStream *_cloned=NULL)
Constructs the stream, then calls setclone(_cloned).
virtual const WvAddr * src() const
get the remote address from which the last data block was received.
virtual bool isok() const
return true if the stream is actually usable right now
virtual void execute()
The callback() function calls execute(), and then calls the user- specified callback if one is define...
virtual void noread()
Shuts down the reading side of the stream.
virtual void nowrite()
Shuts down the writing side of the stream.
virtual size_t uread(void *buf, size_t size)
unbuffered I/O functions; these ignore the buffer, which is handled by read().
virtual bool post_select(SelectInfo &si)
post_select() is called after ::select(), and returns true if this object is now ready.
virtual int geterr() const
If isok() is false, return the system error number corresponding to the error, -1 for a special error...
virtual bool flush_internal(time_t msec_timeout)
WvStream overrides.
virtual size_t uwrite(const void *buf, size_t size)
unbuffered I/O functions; these ignore the buffer, which is handled by write().
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
Definition: wvstream.h:25
WvString is an implementation of a simple and efficient printable-string class.
Definition: wvstring.h:330
the data structure used by pre_select()/post_select() and internally by select().
Definition: iwvstream.h:50