maliput
ManualRangeValueRuleStateProvider Class Reference

Detailed Description

An implementation of a manual api::rules::RangeValueRuleStateProvider.

This enables clients to directly set the states of api::rules::RangeValueRule instances.

#include <include/maliput/base/manual_range_value_rule_state_provider.h>

Inheritance diagram for ManualRangeValueRuleStateProvider:
[legend]

Public Member Functions

 ManualRangeValueRuleStateProvider (const api::rules::RoadRulebook *rulebook)
 Constructs a ManualRangeValueRuleStateProvider. More...
 
 ~ManualRangeValueRuleStateProvider () override=default
 
void SetState (const api::rules::Rule::Id &id, const api::rules::RangeValueRule::Range &state, const std::optional< api::rules::RangeValueRule::Range > &next_state, const std::optional< double > &duration_until)
 Sets the state, and optionally the next state and duration until the next state, of a RangeValueRule. More...
 
- Public Member Functions inherited from RangeValueRuleStateProvider
virtual ~RangeValueRuleStateProvider ()=default
 
std::optional< StateResultGetState (const Rule::Id &id) const
 Gets the state of the RangeValueRule identified by id. More...
 
std::optional< StateResultGetState (const RoadPosition &road_position, const Rule::TypeId &rule_type, double tolerance) const
 Gets the state of the RangeValueRule that matches provided road_position and rule_type values according to certain tolerance. More...
 

Static Public Member Functions

static std::unique_ptr< ManualRangeValueRuleStateProviderGetDefaultManualRangeValueRuleStateProvider (const maliput::api::rules::RoadRulebook *rulebook)
 Constructs a ManualRangeValueRuleStateProvider with the default states populated. More...
 

Additional Inherited Members

- Public Types inherited from RangeValueRuleStateProvider
using StateResult = StateProviderResult< RangeValueRule::Range >
 The state of a RangeValueRule, returned by RangeValueRuleStateProvider::GetState(const Rule::Id&). More...
 
- Protected Member Functions inherited from RangeValueRuleStateProvider
 RangeValueRuleStateProvider ()=default
 

Constructor & Destructor Documentation

◆ ManualRangeValueRuleStateProvider()

Constructs a ManualRangeValueRuleStateProvider.

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

◆ ~ManualRangeValueRuleStateProvider()

~ManualRangeValueRuleStateProvider ( )
overridedefault

Member Function Documentation

◆ GetDefaultManualRangeValueRuleStateProvider()

std::unique_ptr< ManualRangeValueRuleStateProvider > GetDefaultManualRangeValueRuleStateProvider ( const maliput::api::rules::RoadRulebook rulebook)
static

Constructs a ManualRangeValueRuleStateProvider with the default states populated.

Parameters
rulebookThe RoadRulebook to use.

◆ SetState()

void SetState ( const api::rules::Rule::Id id,
const api::rules::RangeValueRule::Range state,
const std::optional< api::rules::RangeValueRule::Range > &  next_state,
const std::optional< double > &  duration_until 
)

Sets the state, and optionally the next state and duration until the next state, of a RangeValueRule.

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

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