2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
5 * FIXME: Suspiciously similar to wvstreamlist, and with tons of duplicated
8 #ifndef __WVISTREAMLIST_H
9 #define __WVISTREAMLIST_H
13 /** Create the WvStreamListBase class - a simple linked list of WvStreams */
14 DeclareWvList2(WvIStreamListBase
, IWvStream
);
17 * WvStreamList holds a list of WvStream objects -- and its select() and
18 * callback() functions know how to handle multiple simultaneous streams.
20 class WvIStreamList
: public WvStream
, public WvIStreamListBase
24 virtual ~WvIStreamList();
25 virtual bool isok() const;
26 virtual void pre_select(SelectInfo
&si
);
27 virtual bool post_select(SelectInfo
&si
);
28 virtual void execute();
30 void unlink(IWvStream
*data
)
31 { sure_thing
.unlink(data
); WvIStreamListBase::unlink(data
); }
33 void add_after(WvLink
*after
, IWvStream
*data
, bool autofree
,
36 WvIStreamListBase::add_after(after
, data
, autofree
, id
);
38 void add(IWvStream
*data
, bool autofree
, const char *id
)
40 WvIStreamListBase::add(data
, autofree
, id
);
42 void prepend(IWvStream
*data
, bool autofree
, const char *id
)
44 WvIStreamListBase::prepend(data
, autofree
, id
);
48 bool auto_prune
; // remove !isok() streams from the list automatically?
49 static WvIStreamList globallist
;
52 WvIStreamListBase sure_thing
;
55 // Create some undefined overrides to prevent accidentally using a
56 // WvString as an id; these functions will keep a long-term reference to
57 // the string, so you should probably use a string constant.
58 void add_after(WvLink
*after
, IWvStream
*data
, bool autofree
, WvString id
);
59 void add(IWvStream
*data
, bool autofree
, WvString id
);
60 void prepend(IWvStream
*data
, bool autofree
, WvString id
);
67 static void onfork(pid_t p
);
71 void append(IWvStream
*s
, bool auto_free
, const char *id
)
73 if (s
->wsname() == NULL
)
75 WvIStreamListBase::append(s
, auto_free
, id
);
77 void append(IWvStream
*s
, bool auto_free
, WVSTRING_FORMAT_DECL
)
79 if (s
->wsname() == NULL
)
80 s
->set_wsname(WvString(WVSTRING_FORMAT_CALL
));
81 WvIStreamListBase::append(s
, auto_free
, s
->wsname());
85 const char *wstype() const { return "WvIStreamList"; }
88 static void add_debugger_commands();
90 static WvString
debugger_globallist_run_cb(WvStringParm cmd
,
92 WvStreamsDebugger::ResultCallback result_cb
, void *);
95 #endif // __WVISTREAMLIST_H