mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: turn event-list of divecomputer into std::vector<>
This is a rather long commit, because it refactors lots of the event code from pointer to value semantics: pointers to entries in an std::vector<> are not stable, so better use indexes. To step through the event-list at diven time stamps, add *_loop classes, which encapsulate state that had to be manually handled before by the caller. I'm not happy about the interface, but it tries to mirror the one we had before. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
8ddc960fa0
commit
27dbdd35c6
36 changed files with 644 additions and 821 deletions
|
@ -352,14 +352,14 @@ void addEventSetpointChange(struct dive *d, int dcNr, int seconds, pressure_t pO
|
|||
execute(new AddEventSetpointChange(d, dcNr, seconds, pO2));
|
||||
}
|
||||
|
||||
void renameEvent(struct dive *d, int dcNr, struct event *ev, const char *name)
|
||||
void renameEvent(struct dive *d, int dcNr, int idx, const std::string name)
|
||||
{
|
||||
execute(new RenameEvent(d, dcNr, ev, name));
|
||||
execute(new RenameEvent(d, dcNr, idx, std::move(name)));
|
||||
}
|
||||
|
||||
void removeEvent(struct dive *d, int dcNr, struct event *ev)
|
||||
void removeEvent(struct dive *d, int dcNr, int idx)
|
||||
{
|
||||
execute(new RemoveEvent(d, dcNr, ev));
|
||||
execute(new RemoveEvent(d, dcNr, idx));
|
||||
}
|
||||
|
||||
void addGasSwitch(struct dive *d, int dcNr, int seconds, int tank)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue