WvStreams
wvdailyevent.h
1 /* -*- Mode: C++ -*-
2  * Worldvisions Weaver Software:
3  * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4  *
5  * A period event stream.
6  */
7 
8 #ifndef __WVDAILYEVENT_H
9 #define __WVDAILYEVENT_H
10 
11 #include "wvstream.h"
12 
29 class WvDailyEvent : public WvStream
30 /**********************************/
31 {
32 public:
44  WvDailyEvent( int _first_hour, int _num_per_day=0, bool _skip_first=true );
45 
53  virtual void pre_select( SelectInfo& si );
54  virtual bool post_select( SelectInfo& si );
55 
66  void configure( int _first_hour, int _num_per_day=0, bool _skip_first=true );
67 
69  void set_num_per_day(int _num_per_day);
70 
75  void set_hour( int h )
76  { configure( h, num_per_day ); }
77 
79  time_t next_event() const;
80 
81 private:
82  int first_hour;
83  int num_per_day;
84  bool need_reset;
85  bool skip_first;
86  time_t prev;
87 
88  time_t not_until;
89 
90 public:
91  const char *wstype() const { return "WvDailyEvent"; }
92 };
93 
94 #endif