core: move functions into struct dive

Nothing against free-standing functions, but in the case
of dc_watertemp(), dc_airtemp(), endtime() and totaltime(),
it seems natural to move this into the dive class and avoid
polution of the global name space.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-06-05 17:02:40 +02:00 committed by bstoeger
parent b9df26066e
commit a1e6df46d9
13 changed files with 63 additions and 64 deletions

View file

@ -78,6 +78,15 @@ struct dive {
dive(const dive &);
dive(dive &&);
dive &operator=(const dive &);
timestamp_t endtime() const; /* maximum over divecomputers (with samples) */
duration_t totaltime() const; /* maximum over divecomputers (with samples) */
temperature_t dc_airtemp() const; /* average over divecomputers */
temperature_t dc_watertemp() const; /* average over divecomputers */
bool is_planned() const;
bool is_logged() const;
};
/* For the top-level list: an entry is either a dive or a trip */
@ -137,9 +146,6 @@ extern std::string get_dive_location(const struct dive *dive);
extern unsigned int number_of_computers(const struct dive *dive);
extern struct divecomputer *get_dive_dc(struct dive *dive, int nr);
extern const struct divecomputer *get_dive_dc(const struct dive *dive, int nr);
extern timestamp_t dive_endtime(const struct dive *dive);
extern temperature_t dc_airtemp(const struct dive *dive);
extern temperature_t dc_watertemp(const struct dive *dive);
extern void set_git_prefs(const char *prefs);
@ -222,9 +228,6 @@ extern void invalidate_dive_cache(struct dive *dc);
extern int total_weight(const struct dive *);
extern bool is_planned(const struct dive *dive);
extern bool is_logged(const struct dive *dive);
/* Get gasmix at a given time */
extern struct gasmix get_gasmix_at_time(const struct dive &dive, const struct divecomputer &dc, duration_t time);