summaryrefslogtreecommitdiffstats
path: root/core/profile.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-07-06 12:35:33 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-11-09 19:19:04 +0100
commitfe6d3c8c3803378fa9369dd6dfb5ec2fa5a0086f (patch)
tree7e00ddc114dd736eee8fd8267c4d7b915c089de7 /core/profile.h
parent459f9acc67df74df206c313389e43d1bf5b80086 (diff)
downloadsubsurface-fe6d3c8c3803378fa9369dd6dfb5ec2fa5a0086f.tar.gz
Profile: switch pressure-accessing functions to indexes
Continue with replacing pointers to struct plot_data entries by indexes. Thus the pressure data can be kept in its own array and can by dynamically sized. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/profile.h')
-rw-r--r--core/profile.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/core/profile.h b/core/profile.h
index 32b255689..070da1f23 100644
--- a/core/profile.h
+++ b/core/profile.h
@@ -102,9 +102,9 @@ extern int get_maxtime(struct plot_info *pi);
* partial pressure graphs */
extern int get_maxdepth(struct plot_info *pi);
-static inline int get_plot_pressure_data(const struct plot_data *entry, enum plot_pressure sensor, int idx)
+static inline int get_plot_pressure_data(const struct plot_info *pi, int idx, enum plot_pressure sensor, int cylinder)
{
- return entry->pressure[idx][sensor];
+ return pi->entry[idx].pressure[cylinder][sensor];
}
static inline void set_plot_pressure_data(struct plot_data *entry, enum plot_pressure sensor, int idx, int value)
@@ -112,21 +112,20 @@ static inline void set_plot_pressure_data(struct plot_data *entry, enum plot_pre
entry->pressure[idx][sensor] = value;
}
-static inline int get_plot_sensor_pressure(const struct plot_data *entry, int idx)
+static inline int get_plot_sensor_pressure(const struct plot_info *pi, int idx, int cylinder)
{
- return get_plot_pressure_data(entry, SENSOR_PR, idx);
+ return get_plot_pressure_data(pi, idx, SENSOR_PR, cylinder);
}
-static inline int get_plot_interpolated_pressure(const struct plot_data *entry, int idx)
+static inline int get_plot_interpolated_pressure(const struct plot_info *pi, int idx, int cylinder)
{
- return get_plot_pressure_data(entry, INTERPOLATED_PR, idx);
+ return get_plot_pressure_data(pi, idx, INTERPOLATED_PR, cylinder);
}
static inline int get_plot_pressure(const struct plot_info *pi, int idx, int cylinder)
{
- const struct plot_data *entry = pi->entry + idx;
- int res = get_plot_sensor_pressure(entry, cylinder);
- return res ? res : get_plot_interpolated_pressure(entry, cylinder);
+ int res = get_plot_sensor_pressure(pi, idx, cylinder);
+ return res ? res : get_plot_interpolated_pressure(pi, idx, cylinder);
}
#ifdef __cplusplus