WvStreams
wvdailyevent.h
00001 /* -*- Mode: C++ -*-
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
00004  *
00005  * A period event stream.
00006  */
00007 
00008 #ifndef __WVDAILYEVENT_H
00009 #define __WVDAILYEVENT_H
00010 
00011 #include "wvstream.h"
00012 
00029 class WvDailyEvent : public WvStream
00030 /**********************************/
00031 {
00032 public:
00044     WvDailyEvent( int _first_hour, int _num_per_day=0, bool _skip_first=true );
00045 
00053     virtual void pre_select( SelectInfo& si );
00054     virtual bool post_select( SelectInfo& si );
00055 
00066     void configure( int _first_hour, int _num_per_day=0, bool _skip_first=true );
00067 
00069     void set_num_per_day(int _num_per_day);
00070     
00075     void set_hour( int h )
00076         { configure( h, num_per_day ); }
00077 
00079     time_t next_event() const;
00080 
00081 private:
00082     int     first_hour;
00083     int     num_per_day;
00084     bool    need_reset;
00085     bool    skip_first;
00086     time_t  prev;
00087     
00088     time_t  not_until;
00089 
00090 public:
00091     const char *wstype() const { return "WvDailyEvent"; }
00092 };
00093 
00094 #endif