6 #ifndef __WVDELAYEDCALLBACK_H 7 #define __WVDELAYEDCALLBACK_H 9 #include "wvistreamlist.h" 29 template<
class Functor>
35 wv::function<void()> frozen;
39 func(_func), stream(
new WvStream), frozen(0)
41 WvIStreamList::globallist.append(stream,
true,
"WvDelayedCallback");
44 func(other.func), stream(
new WvStream), frozen(0)
46 WvIStreamList::globallist.append(stream,
true,
"WvDelayedCallback");
58 void operator()(P1 &p1)
65 void operator()(P1 &p1, P2 &p2)
73 void operator()(P1 &p1, P2 &p2, P3 &p3)
82 void operator()(P1 &p1, P2 &p2, P3 &p3, P4 &p4)
84 stream->
setcallback(wv::bind(func, p1, p2, p3, p4));
92 void operator()(P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5)
94 stream->
setcallback(wv::bind(func, p1, p2, p3, p4, p5));
103 void operator()(P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5, P6 &p6)
105 stream->
setcallback(wv::bind(func, p1, p2, p3, p4, p5, p6));
108 template<
typename P1,
115 void operator()(P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5, P6 &p6, P7 &p7)
117 stream->
setcallback(wv::bind(func, p1, p2, p3, p4, p5, p6, p7));
120 template<
typename P1,
128 void operator()(P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5, P6 &p6, P7 &p7,
131 stream->
setcallback(wv::bind(func, p1, p2, p3, p4, p5, p6, p7, p8));
151 template <
typename T>
152 inline T delayed(T cb)
165 template <
typename T>
166 inline wv::function<T> delayed(T *cb)
virtual void close()
Close the stream if it is open; isok() becomes false from now on.
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
A WvCallback wrapper that delays until the next tick of the WvIStreamList main loop.
void setcallback(IWvStreamCallback _callfunc)
define the callback function for this stream, called whenever the callback() member is run...
void alarm(time_t msec_timeout)
set an alarm, ie.