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 bool 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     bool auto_prune; // remove !isok() streams from the list automatically?
00034     static WvIStreamList globallist;
00035     
00036 protected:
00037     WvIStreamListBase sure_thing;
00038 
00039 private:
00040     bool in_select;
00041 
00042 #ifndef _WIN32
00043     static void onfork(pid_t p);
00044 #endif
00045 
00046 public:
00047     void append(IWvStream *s, bool auto_free, const char *id = NULL)
00048     {
00049         if (s->wsname() == NULL)
00050             s->set_wsname(id);
00051         WvIStreamListBase::append(s, auto_free, id);
00052     }
00053     void append(IWvStream *s, bool auto_free, WVSTRING_FORMAT_DECL)
00054     {
00055         if (s->wsname() == NULL)
00056             s->set_wsname(WvString(WVSTRING_FORMAT_CALL));
00057         WvIStreamListBase::append(s, auto_free, s->wsname());
00058     }
00059 
00060 public:
00061     const char *wstype() const { return "WvIStreamList"; }
00062     
00063 private:
00064     static void add_debugger_commands();
00065 private:
00066     static WvString debugger_globallist_run_cb(WvStringParm cmd,
00067         WvStringList &args,
00068         WvStreamsDebugger::ResultCallback result_cb, void *);
00069 };
00070 
00071 #endif // __WVISTREAMLIST_H

Generated on Fri Oct 5 18:20:28 2007 for WvStreams by  doxygen 1.5.3