profile: C++-ify plot_info

Use more C++ style memory management for plot_info: Use std::vector
for array data. Return the plot_info instead of filling an output
parameter. Add a constructor/destructor pair so that the caller
isn't bothered with memory management.

The bulk of the commit is replacement of pointers with references,
which is kind of gratuitous. But I started and then went on...

Default initializiation of gas_pressures made it necessary to convert
gas.c to c++, though with minimal changes to the code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-05-03 18:51:03 +02:00 committed by bstoeger
parent aaab5157d4
commit 48f7828d10
14 changed files with 635 additions and 670 deletions

View file

@ -212,7 +212,7 @@ void ToolTipItem::setPlotInfo(const plot_info &plot)
void ToolTipItem::clearPlotInfo()
{
memset(&pInfo, 0, sizeof(pInfo));
pInfo = plot_info();
}
void ToolTipItem::setTimeAxis(DiveCartesianAxis *axis)
@ -231,7 +231,7 @@ void ToolTipItem::refresh(const dive *d, const QPointF &pos, bool inPlanner)
lastTime = time;
clear();
auto [idx, lines] = get_plot_details_new(d, &pInfo, time);
auto [idx, lines] = get_plot_details_new(d, pInfo, time);
tissues.fill();
painter.setPen(QColor(0, 0, 0, 0));