icinga2/lib/base/generator-range.hpp
Alexander A. Klimov cd306c7d2b DSL: add xrange()
2025-04-29 11:01:44 +02:00

34 lines
555 B
C++

/* Icinga 2 | (c) 2020 Icinga GmbH | GPLv2+ */
#ifndef GENERATOR_RANGE_H
#define GENERATOR_RANGE_H
#include "base/generator.hpp"
#include "base/value.hpp"
namespace icinga
{
/**
* Supplies items [start, stop), incrementing by step.
*
* @ingroup base
*/
class GeneratorRange final : public Generator
{
public:
inline GeneratorRange(double start, double stop, double step)
: m_Current(start), m_Stop(stop), m_Step(step)
{
}
bool GetNext(Value& out) override;
private:
double m_Current, m_Stop, m_Step;
};
}
#endif /* GENERATOR_RANGE_H */