Class Participant
Defined in File Participant.hpp
Class Documentation
-
class Participant
Public Types
Public Functions
-
bool set(PlanId plan, std::vector<Route> itinerary)
Set the whole itinerary for the participant. Every route that was previously in the itinerary will be removed and replaced with these new routes.
- Parameters:
plan – [in] A unique ID that this plan is associated with
itinerary – [in] The new itinerary that the participant should reflect in the schedule.
-
std::optional<Duration> cumulative_delay(PlanId plan) const
The cumulative delay that has built up since the last call to set(plan, ~). If plan does not match the current Plan ID of the itinerary then this returns a nullopt.
Note
This value will not grow when there are no are itineraries for this participant.
-
bool cumulative_delay(PlanId plan, Duration delay, Duration tolerance = Duration(0))
Set the cumulative delay of the specified plan. Returns false if plan does not match the current Plan ID of the itinerary.
- Parameters:
plan – [in] The unique plan ID that this cumulative delay is relevant for
delay – [in] The value for the cumulative delay
tolerance – [in] A tolerance threshold for reporting this delay. If the magnitude of change in the cumulative delay is less than or equal to the magnitude of this tolerance, then no change will be reported to the schedule. Use Duration(0) to always report any non-zero change in cumulative delay.
-
void delay(Duration delay)
Delay the current itinerary.
- Parameters:
delay – [in] The amount of time to push back the relevant waypoints.
-
void reached(PlanId plan, RouteId route, CheckpointId checkpoint)
Notify the schedule that a checkpoint within a plan has been reached.
-
const std::vector<CheckpointId> &reached() const
The last set of checkpoints that were reached for this plan.
-
void clear()
Clear all routes from the itinerary.
-
ItineraryVersion version() const
Get the current itinerary version for this participant.
-
ProgressVersion progress_version() const
Get the current progress version for this participant.
-
const ParticipantDescription &description() const
Get the description of this participant.
-
ParticipantId id() const
Get the ID that was assigned to this participant.
-
const AssignIDPtr &plan_id_assigner() const
Use this to get a generator that can assign valid new unique plan IDs. It is okay to generate a plan ID and not use it, as long as any new call to set(~) uses a plan ID that was generated more recently than the last one that was passed to set(~).
-
PlanId assign_plan_id() const
Use this to assign an ID to a plan. This is equivalent to plan_id_assigner()->assign()
-
Participant(Participant&&) = default
-
Participant &operator=(Participant&&) = default
-
bool set(PlanId plan, std::vector<Route> itinerary)