Class schedule::ScheduleGenerator
ScheduleGenerator interface.
A schedule generator maps any input value in the progress interval [0..1] to an output value.
Note
The input is always in the range [0..1], because the mapping from the input interval to this progress interval is handled by the Schedule
class. This ensures the input mapping logic is not duplicated in every generator.
Inheritance
Constructors
ScheduleGenerator()
Declaration
schedule::ScheduleGenerator::ScheduleGenerator()
Methods
~ScheduleGenerator()
Declaration
virtual schedule::ScheduleGenerator::~ScheduleGenerator()
get_progress_value()
Return the value that progress
is mapped to.
Declaration
virtual double schedule::ScheduleGenerator::get_progress_value(double progress) const =0
get_initial_value()
Return the value at the beginning of the input interval.
Declaration
double schedule::ScheduleGenerator::get_initial_value() const
get_final_value()
Return the value at the end of the input interval.
Declaration
double schedule::ScheduleGenerator::get_final_value() const
get_start()
Get the start
input value (first in the input interval). [This default to start=0 if not specified].
Declaration
double schedule::ScheduleGenerator::get_start() const
get_stop()
Get the stop
input value (last in the input interval). [This defaults to stop=1 if not specified].
Declaration
double schedule::ScheduleGenerator::get_stop() const
get_count()
Get the number of equidistributed input values to use when generating a discretized set from this generator (without requesting a specific set size). The default value of count=1 means pick just one (the initial value)
Declaration
int schedule::ScheduleGenerator::get_count() const
set_stop()
Force the number of equidistributed values to pick.
Declaration
void schedule::ScheduleGenerator::set_stop(int stop)
has_start()
Query if the start value was explicitly configured.
Declaration
bool schedule::ScheduleGenerator::has_start() const
has_stop()
Query if the stop value was explicitly configured.
Declaration
bool schedule::ScheduleGenerator::has_stop() const
has_count()
Query if the count value was explicitly configured.
Declaration
bool schedule::ScheduleGenerator::has_count() const
is_repeated()
Should this schedule be repeated indefinitly outside the input interval?
Declaration
bool schedule::ScheduleGenerator::is_repeated() const
configure()
configure the object from input
Initialize the object's state from the input utils::Config
. This is done by declaring which required and optional parameters are associated with the fields of this object. During initialization, they are checked for their presence, type and any matchers.
Example:
MyClass : public Component {
public:
void configure(const utils::Json& json) override {
this->param(json, "number", my_number)
.description("some description")
.matches(GreaterEquals(0))
.required();
this->param(json, "name", my_name)
.description("some description")
.matches(SizeIs(GreaterThan(0)))
.default_value("no_name");
}
private:
int my_number;
std::string my_name;
}
MyClass my_object;
my_object.configure(utils::json_from_string(R"(
{
"number": 42,
"name": "hello"
}
)"));
Note
By default, nothing is configured from input. You need to overload this method if you want to use this functionality. Don't forget to call the configure method of the parent class if it also needs to be configured (this is not the case for utils::Component
itself).
HINT: Parameters are not limited to scalars and strings; Any component can be a parameter; in which case it is initialized using its own configure method.
utils::Json
Declaration
void schedule::ScheduleGenerator::configure(const utils::Json&json) override