Helios++
Helios software for LiDAR simulations
|
Abstract class providing the basics to handle loops inside simulation time, which is discrete because it is based on simulation steps. More...
#include <StepLoop.h>
Public Member Functions | |
StepLoop (int const stepInterval) | |
Step loop constructor receiving interval and computation region function. | |
virtual bool | doStep (StepInput ... input) |
Handle current loop iteration and advances to next one by calling StepLoop::nextStep. More... | |
virtual void | handleStep (StepInput ... input)=0 |
Handle the current step itself, before proceeding to next one. More... | |
virtual void | nextStep () |
Advances to current loop iteration, restarting the loop when as many steps as step interval have been done. | |
virtual int | getStepInterval () const |
Obtain the step interval. More... | |
virtual void | setStepInterval (int const stepInterval) |
Set the step interval. More... | |
virtual int | getCurrentStep () const |
Obtain the current step of the step loop. More... | |
virtual void | setCurrentStep (int const currentStep) |
Set the current step for the step loop. More... | |
Protected Attributes | |
int | stepInterval |
Specify how many simulation steps must elapse so the step loop enters its computation region. More... | |
int | currentStep |
Stores the current step. More... | |
Abstract class providing the basics to handle loops inside simulation time, which is discrete because it is based on simulation steps.
Let \(\Delta\) be the step interval and \(s_t\) be the current step. Considering that \(s_t\) is calculated as explained in StepLoop::currentStep. Always that \(s_t \equiv 0 \mod \Delta\), the computation region of the step loop will be reached.
StepInput | The input arguments of function to be invoked when computation region is reached |
|
inlinevirtual |
Handle current loop iteration and advances to next one by calling StepLoop::nextStep.
Reimplemented in LinearVoidStepLoop< StepInput >, and LinearVoidStepLoop<>.
|
inlinevirtual |
Obtain the current step of the step loop.
|
inlinevirtual |
|
pure virtual |
Handle the current step itself, before proceeding to next one.
This function must be overridden by any concrete implementation of StepLoop
input | Input for current step |
Implemented in VoidStepLoop< StepInput >, VoidStepLoop< StepInput ... >, NonVoidStepLoop< StepOutput, StepInput >, and NonVoidStepLoop< bool >.
|
inlinevirtual |
Set the current step for the step loop.
currentStep | The new current step for the step loop |
|
inlinevirtual |
|
protected |
Stores the current step.
Let \(\Delta\) be the step interval and \(s_t\) the step at \(t\) instant. Thus, the current step update behavior can be defined as follows:
\[ s_{t+1} = \left(s_{t} + 1\right) \mod \Delta \]
|
protected |
Specify how many simulation steps must elapse so the step loop enters its computation region.
If the simulation frequency means there are \(n\) iterations per second. Then, the step interval \(\Delta\) means there are \(\frac{n}{\Delta}\) steps per second. It must be satisfied that \(\Delta \leq n\)