FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
RefreshSchedule.h
1#pragma once
2
8#include <cstdint>
9
10namespace util
11{
12
14enum class Refresh
15{
16 Auto,
17 Once,
18 OnChange,
19 Period,
21};
22
31Refresh ResolveRefresh(Refresh requested, bool timeInvariant, bool changesWithWakesOnly);
32
42{
43public:
50 RefreshSchedule(Refresh mode, double period);
51
60 [[nodiscard]] bool Due(double T, std::uint64_t revision, bool unchanged, bool moved) const;
61
67 void Sampled(double T, std::uint64_t revision);
68
70 [[nodiscard]] Refresh Mode() const { return m_mode; }
71
73 [[nodiscard]] double LastSampleTime() const { return m_lastTime; }
74
75private:
77 [[nodiscard]] bool PeriodPassed(double T) const;
78
79 Refresh m_mode;
80 double m_period;
81 bool m_sampled = false;
82 double m_lastTime = 0.0;
83 std::uint64_t m_lastRevision = 0;
84};
85
86} // namespace util
Definition RefreshSchedule.h:42
double LastSampleTime() const
Simulation time of the last sample [s]; 0 before the first.
Definition RefreshSchedule.h:73
void Sampled(double T, std::uint64_t revision)
Refresh Mode() const
The mode.
Definition RefreshSchedule.h:70
bool Due(double T, std::uint64_t revision, bool unchanged, bool moved) const
RefreshSchedule(Refresh mode, double period)
Utility functions for reading Environment parameters from XML.
Definition BathymetryDiagnostics.h:16
Refresh
When a field visualiser samples again, its Refresh parameter.
Definition RefreshSchedule.h:15
@ Auto
Resolved by ResolveRefresh() from the field.
@ Period
Every RefreshPeriod of simulation time.
@ EveryFrame
Every rendered frame.
@ OnChange
When the field's change signal says it changed; every RefreshPeriod (or frame) while it changes conti...
@ Once
At the start only.
Refresh ResolveRefresh(Refresh requested, bool timeInvariant, bool changesWithWakesOnly)