Class ItineraryViewer¶
Defined in File Viewer.hpp
Nested Relationships¶
Nested Types¶
Inheritance Relationships¶
Base Type¶
public rmf_traffic::schedule::Viewer
(Class Viewer)
Derived Types¶
public rmf_traffic::schedule::Database
(Class Database)public rmf_traffic::schedule::Mirror
(Class Mirror)
Class Documentation¶
-
class
rmf_traffic::schedule
::
ItineraryViewer
: public virtual rmf_traffic::schedule::Viewer¶ A pure abstract interface class that extends Viewer to allow users to explicitly request the itinerary of a specific participant.
- Note
This interface class is separate from Viewer because it is not generally needed by the traffic planning or negotiation systems, and the Snapshot class can perform better if it does not need to provide this function.
Subclassed by rmf_traffic::schedule::Database, rmf_traffic::schedule::Mirror
Public Functions
-
virtual std::optional<ItineraryView>
get_itinerary
(ParticipantId participant_id) const = 0¶ Get the itinerary of a specific participant if it is available. If a participant with the specified ID is not registered with the schedule or has never submitted an itinerary, then this will return a nullopt.
-
virtual std::optional<PlanId>
get_current_plan_id
(ParticipantId participant_id) const = 0¶ Get the current plan ID of a specific participant if it is available. If a participant with the specified ID is not registered with the schedule, then this will return a nullopt.
-
virtual const std::vector<CheckpointId> *
get_current_progress
(ParticipantId participant_id) const = 0¶ Get the current progress of a specific participant. If a participant with the specified ID is not registered with the schedule or has never made progress, then this will return a nullptr.
-
virtual ProgressVersion
get_current_progress_version
(ParticipantId participant_id) const = 0¶ Get the current known progress of a specific participant along its current plan. If no progress has been made, this will have a value of 0.
-
virtual DependencySubscription
watch_dependency
(Dependency dependency, std::function<void()> on_reachedstd::function<void()> on_deprecated) const = 0¶ Watch a traffic dependency. When a relevant event happens for the dependency, the on_reached or on_deprecated will be triggered. If the event had already come to pass before this function is called, then the relevant callback will be triggered right away, within the scope of this function.
Only one of the callbacks will ever be triggered, and it will only be triggered at most once.
- Return
an object that maintains the dependency for the viewer.
- Parameters
[in] on_reached
: If the dependency is reached, this will be triggered. on_changed will never be triggered afterwards.[in] on_deprecated
: If the plan of the participant changed before it reached this dependency then the dependency is deprecated and this callback will be triggered. on_reached will never be triggered afterwards.
-
virtual
~ItineraryViewer
() = default¶
-
class
DependencySubscription
¶ A handle for maintaining a dependency on the progress of an itinerary.
Public Functions
-
bool
reached
() const¶ The dependency was reached by the participant.
-
bool
deprecated
() const¶ The plan of the participant changed before it ever reached the dependency
-
bool
finished
() const¶ Equivalent to reached() || deprecated()
-
Dependency
dependency
() const¶ Check what dependency this is subscribed to.
-
bool