Helios++
Helios software for LiDAR simulations
StepLoop< StepInput > Class Template Referenceabstract

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...
 

Detailed Description

template<typename ... StepInput>
class StepLoop< StepInput >

Abstract class providing the basics to handle loops inside simulation time, which is discrete because it is based on simulation steps.

Author
Alberto M. Esmoris Pena
Version
1.0

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.

Template Parameters
StepInputThe input arguments of function to be invoked when computation region is reached
See also
StepLoop::stepInterval
StepLoop::currentStep

Member Function Documentation

◆ doStep()

template<typename ... StepInput>
virtual bool StepLoop< StepInput >::doStep ( StepInput ...  input)
inlinevirtual

Handle current loop iteration and advances to next one by calling StepLoop::nextStep.

Returns
True if the computation region was entered, false otherwise.

Reimplemented in LinearVoidStepLoop< StepInput >, and LinearVoidStepLoop<>.

◆ getCurrentStep()

template<typename ... StepInput>
virtual int StepLoop< StepInput >::getCurrentStep ( ) const
inlinevirtual

Obtain the current step of the step loop.

Returns
The current step of the step loop
See also
StepLoop::currentStep

◆ getStepInterval()

template<typename ... StepInput>
virtual int StepLoop< StepInput >::getStepInterval ( ) const
inlinevirtual

Obtain the step interval.

Returns
The step interval
See also
StepLoop::stepInterval

◆ handleStep()

template<typename ... StepInput>
virtual void StepLoop< StepInput >::handleStep ( StepInput ...  input)
pure virtual

Handle the current step itself, before proceeding to next one.

This function must be overridden by any concrete implementation of StepLoop

Parameters
inputInput for current step

Implemented in VoidStepLoop< StepInput >, VoidStepLoop< StepInput ... >, NonVoidStepLoop< StepOutput, StepInput >, and NonVoidStepLoop< bool >.

◆ setCurrentStep()

template<typename ... StepInput>
virtual void StepLoop< StepInput >::setCurrentStep ( int const  currentStep)
inlinevirtual

Set the current step for the step loop.

Parameters
currentStepThe new current step for the step loop
See also
StepLoop::currentStep

◆ setStepInterval()

template<typename ... StepInput>
virtual void StepLoop< StepInput >::setStepInterval ( int const  stepInterval)
inlinevirtual

Set the step interval.

Parameters
stepIntervalNew step interval
See also
StepLoop::stepInterval

Member Data Documentation

◆ currentStep

template<typename ... StepInput>
int StepLoop< StepInput >::currentStep
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 \]

See also
StepLoop::stepInterval

◆ stepInterval

template<typename ... StepInput>
int StepLoop< StepInput >::stepInterval
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\)

See also
StepLoop::currentStep

The documentation for this class was generated from the following file: