-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rain.h
47 lines (35 loc) · 795 Bytes
/
Rain.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef __RAIN_H__
#define __RAIN_H__
#include "Now.h"
#include <map>
#include <utility>
#include "Database.h"
#define MAX_RAIN_DURATION ( 24 * ONE_HOUR )
class Rain
{
typedef std::map< time_t, int > rainAccumulation_t;
public:
Rain( Now *now, Database &_db );
~Rain( );
void update( unsigned int value );
unsigned int getSum( time_t duration );
unsigned int getRate( void )
{
return getSum( ONE_HOUR );
}
double getInstantRainrate()
{
return instantRain;
}
void dump();
void restore();
private:
rainAccumulation_t rainAccum;
int oldDayRain;
Now *now;
Debug dbg;
Database db;
int instantRain;
time_t lastRainTime;
};
#endif // __RAIN_H__