maliput
PhaseRing Class Referencefinal

Detailed Description

A set of mutually exclusive phases, e.g., that comprise the signaling cycle for an intersection.

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

Classes

struct  NextPhase
 Holds a "next phase" specification. More...
 

Public Types

using Id = TypeSpecificIdentifier< class PhaseRing >
 Unique identifier for a PhaseRing. More...
 

Public Member Functions

 MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN (PhaseRing)
 
 PhaseRing (const Id &id, const std::vector< Phase > &phases, const std::optional< const std::unordered_map< Phase::Id, std::vector< NextPhase >>> &next_phases=std::nullopt)
 Constructs a PhaseRing. More...
 
const Idid () const
 Returns the phase ring's identifier. More...
 
std::optional< PhaseGetPhase (const Phase::Id &id) const
 Returns a Phase by its id or std::nullopt when it is not present in this PhaseRing. More...
 
const std::unordered_map< Phase::Id, Phase > & phases () const
 Returns the catalog of phases. More...
 
const std::unordered_map< Phase::Id, std::vector< NextPhase > > & next_phases () const
 
const std::vector< NextPhase > & GetNextPhases (const Phase::Id &id) const
 Returns the possible next phases given the current phase with an ID of id. More...
 

Member Typedef Documentation

◆ Id

Unique identifier for a PhaseRing.

Constructor & Destructor Documentation

◆ PhaseRing()

PhaseRing ( const Id id,
const std::vector< Phase > &  phases,
const std::optional< const std::unordered_map< Phase::Id, std::vector< NextPhase >>> &  next_phases = std::nullopt 
)

Constructs a PhaseRing.

Parameters
idthe unique ID of this phase ring
phasesthe phases within this ring.
next_phasesspecifies, for each phase, possible next phases. This can be std::nullopt, in which case, no next phases will be specified.
Exceptions
std::exceptionif phases is empty, phases contains duplicate Phase::Id's, the phases define different sets of RightOfWayRule::Ids and Rule::Ids, or the phases define different sets of bulb states. If next_phases is provided, this method will also throw if next_phases does not define the possible next phases of every phase in phases, or defines a next phase that is not in phases.

Member Function Documentation

◆ GetNextPhases()

const std::vector<NextPhase>& GetNextPhases ( const Phase::Id id) const

Returns the possible next phases given the current phase with an ID of id.

Exceptions
std::out_of_rangeif no phase with an ID of id exists.

◆ GetPhase()

std::optional< Phase > GetPhase ( const Phase::Id id) const

Returns a Phase by its id or std::nullopt when it is not present in this PhaseRing.

◆ id()

const Id& id ( ) const

Returns the phase ring's identifier.

◆ MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN()

MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN ( PhaseRing  )

◆ next_phases()

const std::unordered_map<Phase::Id, std::vector<NextPhase> >& next_phases ( ) const

◆ phases()

const std::unordered_map<Phase::Id, Phase>& phases ( ) const

Returns the catalog of phases.


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