wvistreamlist.h

00001 /* -*- Mode: C++ -*-
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
00004  * 
00005  * FIXME: Suspiciously similar to wvstreamlist, and with tons of duplicated
00006  * code.  Blech.
00007  */ 
00008 #ifndef __WVISTREAMLIST_H
00009 #define __WVISTREAMLIST_H
00010 
00011 #include "wvstream.h"
00012 
00014 DeclareWvList2(WvIStreamListBase, IWvStream);
00015 
00020 class WvIStreamList : public WvStream, public WvIStreamListBase
00021 {
00022 public:
00023     WvIStreamList();
00024     virtual ~WvIStreamList();
00025     virtual bool isok() const;
00026     virtual void pre_select(SelectInfo &si);
00027     virtual bool post_select(SelectInfo &si);
00028     virtual void execute();
00029     
00030     void unlink(IWvStream *data)
00031         { sure_thing.unlink(data); WvIStreamListBase::unlink(data); }
00032 
00033     void add_after(WvLink *after, IWvStream *data, bool autofree,
00034                    char *id)
00035     {
00036         WvIStreamListBase::add_after(after, data, autofree, id);
00037     }
00038     void append(IWvStream *data, bool autofree, char *id)
00039     {
00040         WvIStreamListBase::append(data, autofree, id);
00041     }
00042     void add(IWvStream *data, bool autofree, char *id)
00043     {
00044         WvIStreamListBase::add(data, autofree, id);
00045     }
00046     void prepend(IWvStream *data, bool autofree, char *id)
00047     {
00048         WvIStreamListBase::prepend(data, autofree, id);
00049     }
00050     
00051     bool auto_prune; // remove !isok() streams from the list automatically?
00052     static WvIStreamList globallist;
00053     
00054 protected:
00055     WvIStreamListBase sure_thing;
00056 
00057 private:
00058     bool in_select;
00059     bool dead_stream;
00060 
00061 #ifndef _WIN32
00062     static void onfork(pid_t p);
00063 #endif
00064 
00065 public:
00066     void append(IWvStream *s, bool auto_free, const char *id = NULL)
00067     {
00068         if (s->wsname() == NULL)
00069             s->set_wsname(id);
00070         WvIStreamListBase::append(s, auto_free, id);
00071     }
00072     void append(IWvStream *s, bool auto_free, WVSTRING_FORMAT_DECL)
00073     {
00074         if (s->wsname() == NULL)
00075             s->set_wsname(WvString(WVSTRING_FORMAT_CALL));
00076         WvIStreamListBase::append(s, auto_free, s->wsname());
00077     }
00078 
00079 public:
00080     const char *wstype() const { return "WvIStreamList"; }
00081     
00082 private:
00083     static void add_debugger_commands();
00084 private:
00085     static WvString debugger_globallist_run_cb(WvStringParm cmd,
00086         WvStringList &args,
00087         WvStreamsDebugger::ResultCallback result_cb, void *);
00088 };
00089 
00090 #endif // __WVISTREAMLIST_H

Generated on Thu Jan 24 16:50:56 2008 for WvStreams by  doxygen 1.5.4