Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

wvstreamclone.h

Go to the documentation of this file.
00001 /* -*- Mode: C++ -*-
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
00004  * 
00005  * Provides support for constructing streams that wrap other streams.
00006  * This can turn a (relatively useless) IWvStream into a useful WvStream.
00007  */ 
00008 #ifndef __WVSTREAMCLONE_H
00009 #define __WVSTREAMCLONE_H
00010 
00011 #include "wvstream.h"
00012 
00013 /**
00014  * WvStreamClone simply forwards all requests to the "cloned" stream.
00015  * 
00016  * A class derived from WvStreamClone can contain a WvStream as a
00017  * dynamically allocated data member, but act like the stream itself.
00018  * 
00019  * This is useful for classes that need to create/destroy WvPipes
00020  * while they run, for example, yet do not want users to know about
00021  * the member variable.
00022  * 
00023  * WvStreamClone _does_ attempt to close the cloned stream in the
00024  * destructor.
00025  */
00026 class WvStreamClone : public WvStream
00027 {
00028 public:
00029     /**
00030      * WvStreamClone gains ownership (i.e. it will delete it when it
00031      * dies) of the stream you give it. If you do not want that to
00032      * happen, set cloned to NULL before destroying the WvStreamClone
00033      * (for example, in your destructor if you derive WvStreamClone).
00034      *
00035      * If you want to be certain that the cloned stream will not be
00036      * harmed in any way by deleting or closing the wrapper stream,
00037      * set disassociate_on_close to true.
00038      */
00039     WvStreamClone(IWvStream *_cloned = NULL);
00040     virtual ~WvStreamClone();
00041 
00042     IWvStream *cloned;
00043     bool disassociate_on_close; // defaults to false
00044     
00045     virtual void setclone(IWvStream *clone);
00046     virtual void close();
00047     virtual bool flush_internal(time_t msec_timeout);
00048     virtual size_t uread(void *buf, size_t size);
00049     virtual size_t uwrite(const void *buf, size_t size);
00050     virtual bool isok() const;
00051     virtual int geterr() const;
00052     virtual WvString errstr() const;
00053     virtual bool pre_select(SelectInfo &si);
00054     virtual bool post_select(SelectInfo &si);
00055     virtual const WvAddr *src() const;
00056     virtual void execute();
00057     virtual void nowrite();
00058 };
00059 
00060 #endif // __WVSTREAMCLONE_H

Generated on Sat Mar 13 14:55:56 2004 for WvStreams by doxygen 1.3.6-20040222