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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
// IStatistics.hh
//
// Copyright (C) 2002, 2003, 2005, 2006, 2007 Rob Caelers & Raymond Penners
// All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#ifndef ISTATISTICS_HH
#define ISTATISTICS_HH
#include <time.h>
#ifdef PLATFORM_OS_WINDOWS_NATIVE
typedef __int64 int64_t;
#else
# include <stdint.h>
#endif
#include "ICore.hh"
namespace workrave
{
class IStatistics
{
public:
enum StatsBreakValueType
{
STATS_BREAKVALUE_PROMPTED = 0,
STATS_BREAKVALUE_TAKEN,
STATS_BREAKVALUE_NATURAL_TAKEN,
STATS_BREAKVALUE_SKIPPED,
STATS_BREAKVALUE_POSTPONED,
STATS_BREAKVALUE_UNIQUE_BREAKS,
STATS_BREAKVALUE_TOTAL_OVERDUE,
STATS_BREAKVALUE_SIZEOF
};
enum StatsValueType
{
STATS_VALUE_TOTAL_ACTIVE_TIME = 0,
STATS_VALUE_TOTAL_MOUSE_MOVEMENT,
STATS_VALUE_TOTAL_CLICK_MOVEMENT,
STATS_VALUE_TOTAL_MOVEMENT_TIME,
STATS_VALUE_TOTAL_CLICKS,
STATS_VALUE_TOTAL_KEYSTROKES,
STATS_VALUE_SIZEOF
};
typedef int BreakStats[STATS_BREAKVALUE_SIZEOF];
typedef int64_t MiscStats[STATS_VALUE_SIZEOF];
struct DailyStats
{
//! Start time of this day.
struct tm start;
//! Stop time of this day.
struct tm stop;
//! Statistic of each break
BreakStats break_stats[BREAK_ID_SIZEOF];
//! Misc statistics
MiscStats misc_stats;
};
public:
virtual ~IStatistics() {}
virtual bool delete_all_history() = 0;
virtual void update() = 0;
virtual DailyStats *get_current_day() const = 0;
virtual DailyStats *get_day(int day) const = 0;
virtual void get_day_index_by_date(int y, int m, int d, int &idx, int &next, int &prev) const = 0;
virtual int get_history_size() const = 0;
virtual void dump() = 0;
};
} // namespace workrave
#endif // ISTATISTICS_HH
|