maliput
ManualDiscreteValueRuleStateProvider Class Reference

Detailed Description

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>

Inheritance diagram for ManualDiscreteValueRuleStateProvider:
[legend]

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...
 
- Public Member Functions inherited from DiscreteValueRuleStateProvider
virtual ~DiscreteValueRuleStateProvider ()=default
 
std::optional< StateResultGetState (const Rule::Id &id) const
 Gets the state of the DiscreteValueRule identified by id. More...
 
std::optional< StateResultGetState (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::StateResultDoGetState (const api::rules::Rule::Id &id) const override
 
virtual std::optional< api::rules::DiscreteValueRuleStateProvider::StateResultDoGetState (const api::RoadPosition &road_position, const api::rules::Rule::TypeId &rule_type, double tolerance) const override
 
std::map< api::rules::DiscreteValueRule::Id, api::rules::DiscreteValueRuleGetFilteredDiscreteValueRules (const api::RoadPosition &road_position, const api::rules::Rule::TypeId &rule_type, double tolerance) const
 
- Protected Member Functions inherited from DiscreteValueRuleStateProvider
 DiscreteValueRuleStateProvider ()=default
 

Protected Attributes

const api::rules::RoadRulebookrulebook_ {nullptr}
 

Additional Inherited Members

- Public Types inherited from DiscreteValueRuleStateProvider
using StateResult = StateProviderResult< DiscreteValueRule::DiscreteValue >
 The state of a DiscreteValueRule, returned by DiscreteValueRuleStateProvider::GetState(const Rule::Id&). More...
 

Constructor & Destructor Documentation

◆ ManualDiscreteValueRuleStateProvider()

Constructs a ManualDiscreteValueRuleStateProvider.

Parameters
rulebookA rulebook pointer to validate Rule::Id and their states. It must not be nullptr.
Exceptions
common::assertion_errorWhen rulebook is nullptr.

◆ ~ManualDiscreteValueRuleStateProvider()

Member Function Documentation

◆ DoGetState() [1/2]

std::optional< api::rules::DiscreteValueRuleStateProvider::StateResult > DoGetState ( const api::RoadPosition road_position,
const api::rules::Rule::TypeId rule_type,
double  tolerance 
) const
overrideprotectedvirtual

◆ DoGetState() [2/2]

std::optional< api::rules::DiscreteValueRuleStateProvider::StateResult > DoGetState ( const api::rules::Rule::Id id) const
overrideprotectedvirtual

◆ GetFilteredDiscreteValueRules()

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
protected

◆ SetState()

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.

Parameters
idDiscreteValueRule's ID. It must be recognized by the rulebook specified at time of construction.
stateThe state of the rule. It must be one in DiscreteValueRule::states().
next_stateThe optional next state of the rule. It must be one in DiscreteValueRule::states().
duration_untilIf 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.
Exceptions
std::out_of_rangeWhen id is unrecognized by the rulebook specified at time of construction.
common::assertion_errorWhen state does not match any state in DiscreteValueRule::states().
common::assertion_errorWhen next_state does not match any state in DiscreteValueRule::states().
common::assertion_errorWhen duration_until is not positive or it is provided when next_state is nullopt.

Member Data Documentation

◆ rulebook_

const api::rules::RoadRulebook* rulebook_ {nullptr}
protected

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