2017-04-27 18:18:03 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2013-04-15 03:10:25 +00:00
|
|
|
/*
|
|
|
|
* statistics.h
|
|
|
|
*
|
|
|
|
* core logic functions called from statistics UI
|
|
|
|
* common types and variables
|
|
|
|
*/
|
2013-05-07 03:55:27 +00:00
|
|
|
|
|
|
|
#ifndef STATISTICS_H
|
|
|
|
#define STATISTICS_H
|
|
|
|
|
2018-06-03 20:15:19 +00:00
|
|
|
#include "core/units.h"
|
|
|
|
|
2019-03-10 02:21:46 +00:00
|
|
|
#define STATS_MAX_DEPTH 300 /* Max depth for stats bucket is 300m */
|
|
|
|
#define STATS_DEPTH_BUCKET 10 /* Size of buckets for depth range */
|
2024-05-01 21:16:00 +00:00
|
|
|
#define STATS_MAX_TEMP 40 /* Max temp for stats bucket is 40C */
|
|
|
|
#define STATS_TEMP_BUCKET 5 /* Size of buckets for temp range */
|
2019-03-10 02:21:46 +00:00
|
|
|
|
2020-10-25 13:10:52 +00:00
|
|
|
struct dive;
|
|
|
|
|
2024-05-01 21:16:00 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
struct stats_t
|
2014-02-28 04:09:57 +00:00
|
|
|
{
|
2024-05-01 21:16:00 +00:00
|
|
|
int period = 0;
|
2024-05-04 17:15:47 +00:00
|
|
|
duration_t total_time ;
|
2016-11-10 09:15:11 +00:00
|
|
|
/* total time of dives with non-zero average depth */
|
2024-05-04 17:15:47 +00:00
|
|
|
duration_t total_average_depth_time;
|
2013-04-15 03:10:25 +00:00
|
|
|
/* avg_time is simply total_time / nr -- let's not keep this */
|
2024-05-04 17:15:47 +00:00
|
|
|
duration_t shortest_time;
|
|
|
|
duration_t longest_time;
|
|
|
|
depth_t max_depth;
|
|
|
|
depth_t min_depth;
|
|
|
|
depth_t avg_depth;
|
|
|
|
depth_t combined_max_depth;
|
|
|
|
volume_t max_sac;
|
|
|
|
volume_t min_sac;
|
|
|
|
volume_t avg_sac;
|
|
|
|
temperature_t max_temp;
|
|
|
|
temperature_t min_temp;
|
|
|
|
temperature_sum_t combined_temp;
|
2024-05-01 21:16:00 +00:00
|
|
|
unsigned int combined_count = 0;
|
|
|
|
unsigned int selection_size = 0;
|
2024-05-04 17:15:47 +00:00
|
|
|
duration_t total_sac_time;
|
2024-05-01 21:16:00 +00:00
|
|
|
bool is_year = false;
|
|
|
|
bool is_trip = false;
|
|
|
|
std::string location;
|
|
|
|
};
|
2018-10-06 08:58:12 +00:00
|
|
|
|
|
|
|
struct stats_summary {
|
2024-05-01 21:16:00 +00:00
|
|
|
stats_summary();
|
|
|
|
~stats_summary();
|
|
|
|
std::vector<stats_t> stats_yearly;
|
|
|
|
std::vector<stats_t> stats_monthly;
|
|
|
|
std::vector<stats_t> stats_by_trip;
|
|
|
|
std::vector<stats_t> stats_by_type;
|
|
|
|
std::vector<stats_t> stats_by_depth;
|
|
|
|
std::vector<stats_t> stats_by_temp;
|
2018-10-06 08:58:12 +00:00
|
|
|
};
|
|
|
|
|
2024-05-01 21:16:00 +00:00
|
|
|
extern stats_summary calculate_stats_summary(bool selected_only);
|
|
|
|
extern stats_t calculate_stats_selected();
|
|
|
|
extern std::vector<volume_t> get_gas_used(struct dive *dive);
|
|
|
|
extern std::pair<volume_t, volume_t> selected_dives_gas_parts(); // returns (O2, He) tuple
|
2013-05-07 03:55:27 +00:00
|
|
|
|
2014-02-11 18:14:46 +00:00
|
|
|
#endif // STATISTICS_H
|