16 : iterant(&nullIterant)
29 this->startTime = startTime;
30 this->stopTime = stopTime;
31 this->timestep = timestep;
35 const std::string& durationStr,
const std::string& stepStr)
37 std::stringstream ss(startTimeStr);
39 ss = std::stringstream(stepStr);
41 if (!durationStr.empty()) {
42 ss = std::stringstream(durationStr);
45 stopTime = startTime + duration;
47 ss = std::stringstream(stopTimeStr);
56 iterant->
start(startTime);
58 for (
auto t = startTime; t < stopTime; t += timestep) {
63 iterant->
stop(stopTime);
A base class for classes that specify what happens during one timestep.
virtual void iterate(const TimestepTime &dt)=0
virtual void stop(const TimePoint &stopTime)=0
virtual void start(const TimePoint &startTime)=0
void run()
Run the Iterant over the specified time period.
TimePoint parseAndSet(const std::string &startTimeStr, const std::string &stopTimeStr, const std::string &durationStr, const std::string &stepStr)
Parses the four strings and sets the time parameters from them.
static NullIterant nullIterant
A static instance of the NullIterant class.
void setStartStopStep(TimePoint startTime, TimePoint stopTime, Duration timestep)
Sets the time parameters as a start time, stop time and timestep length.
void setIterant(Iterant *iterant)
Sets the iterant to be iterated using a pointer.