maliput
Rule Class Reference

Detailed Description

Describes a generic rule type.

A Rule may have multiple states that affect agent behavior while it is driving through the rule's zone. The possible states of a Rule must be semantically coherent. The current state of a Rule is given by a RuleStateProvider. States can be:

#include <include/maliput/api/rules/rule.h>

Inheritance diagram for Rule:
[legend]

Classes

struct  State
 Defines a base state for a Rule. More...
 

Public Types

using Id = TypeSpecificIdentifier< class Rule >
 Alias for the Rule's unique ID across all Rule types. More...
 
using TypeId = TypeSpecificIdentifier< class Type >
 Alias for the Rule's type. More...
 
using RelatedRules = std::map< std::string, std::vector< Id > >
 Alias of a map holding groups of related rules. More...
 
using RelatedUniqueIds = std::map< std::string, std::vector< UniqueId > >
 Alias of a map holding groups of related unique ids. More...
 

Public Member Functions

 MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN (Rule)
 
 Rule (const Id &id, const TypeId &type_id, const LaneSRoute &zone)
 Constructs a Rule. More...
 
virtual ~Rule ()=default
 
const Idid () const
 
const TypeIdtype_id () const
 
const LaneSRoutezone () const
 

Protected Member Functions

void ValidateRelatedRules (const RelatedRules &related_rules) const
 
void ValidateRelatedUniqueIds (const RelatedUniqueIds &related_unique_ids) const
 
void ValidateSeverity (int severity) const
 

Member Typedef Documentation

◆ Id

using Id = TypeSpecificIdentifier<class Rule>

Alias for the Rule's unique ID across all Rule types.

It is a property of each Rule's instance, and should be unique across all Rule instances. To achieve this, backend implementations are encouraged to use "[rule_type]/[rule_id]" as the string value of a Rule's ID.

◆ RelatedRules

using RelatedRules = std::map<std::string, std::vector<Id> >

Alias of a map holding groups of related rules.

The name of each group is specified by the key, and the semantics vary based on the specific rule type. The group name must not be an empty string. Each vector of Rule::Id must contain unique Rule::Ids.

◆ RelatedUniqueIds

using RelatedUniqueIds = std::map<std::string, std::vector<UniqueId> >

Alias of a map holding groups of related unique ids.

The name of each group is specified by the key, and the semantics vary based on the specific unique id type. The group name must not be an empty string. Each vector of UniqueId must contain unique UniqueIds.

◆ TypeId

using TypeId = TypeSpecificIdentifier<class Type>

Alias for the Rule's type.

Several Rule instances could share the same TypeId, assuming they really are the same type. Example types include "right of way rule", "direction usage rule", "vehicle usage rule", etc.

Constructor & Destructor Documentation

◆ Rule()

Rule ( const Id id,
const TypeId type_id,
const LaneSRoute zone 
)

Constructs a Rule.

Parameters
idThe Rule ID.
type_idThe Rule Type ID.
zoneLaneSRoute to which this rule applies.
Exceptions
maliput::common::assertion_errorWhen any Rule::Id within related_rules is duplicated.

◆ ~Rule()

virtual ~Rule ( )
virtualdefault

Member Function Documentation

◆ id()

const Id& id ( ) const

◆ MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN()

MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN ( Rule  )

◆ type_id()

const TypeId& type_id ( ) const

◆ ValidateRelatedRules()

void ValidateRelatedRules ( const RelatedRules related_rules) const
protected

◆ ValidateRelatedUniqueIds()

void ValidateRelatedUniqueIds ( const RelatedUniqueIds related_unique_ids) const
protected

◆ ValidateSeverity()

void ValidateSeverity ( int  severity) const
protected

◆ zone()

const LaneSRoute& zone ( ) const

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