WvStreams
wvtimestream.h
1 /* -*- Mode: C++ -*-
2  * Worldvisions Weaver Software:
3  * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4  *
5  */
6 #ifndef __WVTIMESTREAM_H
7 #define __WVTIMESTREAM_H
8 
9 #include "wvtimeutils.h"
10 #include "wvstream.h"
11 
22 class WvTimeStream : public WvStream
23 {
24  WvTime last;
25  WvTime next;
26  time_t ms_per_tick;
27 
28 public:
29  WvTimeStream();
30 
43  void set_timer(time_t msec);
44 
45  virtual bool isok() const;
46  virtual void pre_select(SelectInfo &si);
47  virtual bool post_select(SelectInfo &si);
48  virtual void execute();
49 
50 public:
51  const char *wstype() const { return "WvTimeStream"; }
52 };
53 
54 
55 #endif // __WVTIMESTREAM_H
WvTimeStream::pre_select
virtual void pre_select(SelectInfo &si)
pre_select() sets up for eventually calling ::select().
Definition: wvtimestream.cc:31
WvTime
Based on (and interchangeable with) struct timeval.
Definition: wvtimeutils.h:17
WvTimeStream::post_select
virtual bool post_select(SelectInfo &si)
post_select() is called after ::select(), and returns true if this object is now ready.
Definition: wvtimestream.cc:64
WvTimeStream
WvTimeStream causes select() to be true after a configurable number of milliseconds.
Definition: wvtimestream.h:22
WvTimeStream::set_timer
void set_timer(time_t msec)
Every 'msec' milliseconds, select() will return true on this stream.
Definition: wvtimestream.cc:15
IWvStream::SelectInfo
the data structure used by pre_select()/post_select() and internally by select().
Definition: iwvstream.h:50
WvStream
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
Definition: wvstream.h:24
WvTimeStream::isok
virtual bool isok() const
return true if the stream is actually usable right now
Definition: wvtimestream.cc:25
WvTimeStream::execute
virtual void execute()
The callback() function calls execute(), and then calls the user- specified callback if one is define...
Definition: wvtimestream.cc:72