planner: encapsulate deco state cache in a struct

Removes memory management pain: the struct cleans up when it
goes out of scope.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-03-07 19:08:22 +01:00 committed by bstoeger
parent 77e8c3655e
commit f69686d429
7 changed files with 90 additions and 91 deletions

View file

@ -36,6 +36,8 @@ struct diveplan {
int surface_interval;
};
struct deco_state_cache;
#ifdef __cplusplus
extern "C" {
#endif
@ -58,9 +60,10 @@ struct decostop {
int depth;
int time;
};
extern bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, int timestep, struct decostop *decostoptable, struct deco_state **cached_datap, bool is_planner, bool show_disclaimer);
#ifdef __cplusplus
}
extern bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, int timestep, struct decostop *decostoptable, deco_state_cache &cache, bool is_planner, bool show_disclaimer);
#endif
#endif // PLANNER_H