maliput
|
An implementation of a manual api::rules::DiscreteValueRuleStateProvider.
This enables clients to directly set the states of api::rules::DiscreteValueRule instances.
#include <include/maliput/base/manual_discrete_value_rule_state_provider.h>
Public Member Functions | |
ManualDiscreteValueRuleStateProvider (const api::rules::RoadRulebook *rulebook) | |
Constructs a ManualDiscreteValueRuleStateProvider. More... | |
~ManualDiscreteValueRuleStateProvider () override=default | |
void | SetState (const api::rules::Rule::Id &id, const api::rules::DiscreteValueRule::DiscreteValue &state, const std::optional< api::rules::DiscreteValueRule::DiscreteValue > &next_state, const std::optional< double > &duration_until) |
Sets the state, and optionally the next state and duration until the next state, of a DiscreteValueRule. More... | |
![]() | |
virtual | ~DiscreteValueRuleStateProvider ()=default |
std::optional< StateResult > | GetState (const Rule::Id &id) const |
Gets the state of the DiscreteValueRule identified by id . More... | |
std::optional< StateResult > | GetState (const RoadPosition &road_position, const Rule::TypeId &rule_type, double tolerance) const |
Gets the state of the DiscreteValueRule that matches provided road_position and rule_type values according to certain tolerance . More... | |
Protected Member Functions | |
virtual std::optional< api::rules::DiscreteValueRuleStateProvider::StateResult > | DoGetState (const api::rules::Rule::Id &id) const override |
virtual std::optional< api::rules::DiscreteValueRuleStateProvider::StateResult > | DoGetState (const api::RoadPosition &road_position, const api::rules::Rule::TypeId &rule_type, double tolerance) const override |
std::map< api::rules::DiscreteValueRule::Id, api::rules::DiscreteValueRule > | GetFilteredDiscreteValueRules (const api::RoadPosition &road_position, const api::rules::Rule::TypeId &rule_type, double tolerance) const |
![]() | |
DiscreteValueRuleStateProvider ()=default | |
Protected Attributes | |
const api::rules::RoadRulebook * | rulebook_ {nullptr} |
Additional Inherited Members | |
![]() | |
using | StateResult = StateProviderResult< DiscreteValueRule::DiscreteValue > |
The state of a DiscreteValueRule, returned by DiscreteValueRuleStateProvider::GetState(const Rule::Id&). More... | |
|
explicit |
Constructs a ManualDiscreteValueRuleStateProvider.
rulebook | A rulebook pointer to validate Rule::Id and their states. It must not be nullptr. |
common::assertion_error | When rulebook is nullptr. |
|
overridedefault |
|
overrideprotectedvirtual |
Implements DiscreteValueRuleStateProvider.
|
overrideprotectedvirtual |
Implements DiscreteValueRuleStateProvider.
|
protected |
void SetState | ( | const api::rules::Rule::Id & | id, |
const api::rules::DiscreteValueRule::DiscreteValue & | state, | ||
const std::optional< api::rules::DiscreteValueRule::DiscreteValue > & | next_state, | ||
const std::optional< double > & | duration_until | ||
) |
Sets the state, and optionally the next state and duration until the next state, of a DiscreteValueRule.
If id
is new, a new entry is added to this provider.
next_state
and duration_until
are not managed by this provider, i.e. it is the client's responsibility to govern transitions from state
to next_state
after duration_until
(if provided) time.
id | DiscreteValueRule's ID. It must be recognized by the rulebook specified at time of construction. |
state | The state of the rule. It must be one in DiscreteValueRule::states(). |
next_state | The optional next state of the rule. It must be one in DiscreteValueRule::states(). |
duration_until | If known, the estimated time until the transition to the next state, relative to when this method is called. When provided, it must be positive and next_state must not be nullopt. |
std::out_of_range | When id is unrecognized by the rulebook specified at time of construction. |
common::assertion_error | When state does not match any state in DiscreteValueRule::states(). |
common::assertion_error | When next_state does not match any state in DiscreteValueRule::states(). |
common::assertion_error | When duration_until is not positive or it is provided when next_state is nullopt. |
|
protected |