OSCAR-code/SleepLib/day.h

72 lines
1.9 KiB
C
Raw Normal View History

2011-06-26 08:30:44 +00:00
/********************************************************************
SleepLib Day Class Header
Copyright (c)2011 Mark Watkins <jedimark@users.sourceforge.net>
License: GPL
*********************************************************************/
#ifndef DAY_H
#define DAY_H
#include "SleepLib/machine.h"
#include "SleepLib/session.h"
class OneTypePerDay
{
};
class Machine;
class Session;
class Day
{
public:
Day(Machine *m);
~Day();
void AddSession(Session *s);
MachineType machine_type();
EventDataType min(MachineCode code,int field=0);
EventDataType max(MachineCode code,int field=0);
EventDataType avg(MachineCode code,int field=0);
EventDataType sum(MachineCode code,int field=0);
2011-07-05 05:33:06 +00:00
int count(MachineCode code);
2011-06-26 08:30:44 +00:00
EventDataType weighted_avg(MachineCode code,int field=0);
EventDataType percentile(MachineCode mc,int field,double percent);
// Note, the following convert to doubles without considering the consequences fully.
EventDataType summary_avg(MachineCode code);
EventDataType summary_weighted_avg(MachineCode code);
EventDataType summary_sum(MachineCode code);
EventDataType summary_min(MachineCode code);
EventDataType summary_max(MachineCode code);
qint64 first(MachineCode code);
qint64 last(MachineCode code);
qint64 first() { return d_first; };
qint64 last() { return d_last; };
2011-06-26 08:30:44 +00:00
qint64 total_time(); // in milliseconds
2011-07-02 16:07:38 +00:00
double hours() { return double(total_time())/3600000.0; };
2011-06-26 08:30:44 +00:00
Session *operator [](int i) { return sessions[i]; };
vector<Session *>::iterator begin() { return sessions.begin(); };
vector<Session *>::iterator end() { return sessions.end(); };
size_t size() { return sessions.size(); };
Machine *machine;
void OpenEvents();
void OpenWaveforms();
protected:
vector<Session *> sessions;
qint64 d_first,d_last;
qint64 d_totaltime;
2011-06-26 08:30:44 +00:00
private:
bool d_firstsession;
};
#endif // DAY_H