// SPDX-License-Identifier: GPL-2.0 /* * statistics.h * * core logic functions called from statistics UI * common types and variables */ #ifndef STATISTICS_H #define STATISTICS_H #include "core/units.h" #define STATS_MAX_DEPTH 300 /* Max depth for stats bucket is 300m */ #define STATS_DEPTH_BUCKET 10 /* Size of buckets for depth range */ #define STATS_MAX_TEMP 40 /* Max temp for stats bucket is 40C */ #define STATS_TEMP_BUCKET 5 /* Size of buckets for temp range */ struct dive; #ifdef __cplusplus #include #include struct stats_t { int period = 0; duration_t total_time = { 0 }; /* total time of dives with non-zero average depth */ duration_t total_average_depth_time = { 0 }; /* avg_time is simply total_time / nr -- let's not keep this */ duration_t shortest_time = { 0 }; duration_t longest_time = { 0 }; depth_t max_depth = { 0 }; depth_t min_depth = { 0 }; depth_t avg_depth = { 0 }; depth_t combined_max_depth = { 0 }; volume_t max_sac = { 0 }; volume_t min_sac = { 0 }; volume_t avg_sac = { 0 }; temperature_t max_temp = { 0 }; temperature_t min_temp = { 0 }; temperature_sum_t combined_temp = { 0 }; unsigned int combined_count = 0; unsigned int selection_size = 0; duration_t total_sac_time = { 0 }; bool is_year = false; bool is_trip = false; std::string location; }; struct stats_summary { stats_summary(); ~stats_summary(); std::vector stats_yearly; std::vector stats_monthly; std::vector stats_by_trip; std::vector stats_by_type; std::vector stats_by_depth; std::vector stats_by_temp; }; extern stats_summary calculate_stats_summary(bool selected_only); extern stats_t calculate_stats_selected(); extern std::vector get_gas_used(struct dive *dive); extern std::pair selected_dives_gas_parts(); // returns (O2, He) tuple #endif #endif // STATISTICS_H