32#define DEBUG_COND2(obj) (true)
43 const MSEdge* from,
double fromPos,
45 const MSEdge* to,
double toPos,
48 const std::string& line,
50 int maxContainerCapacity) {
51 Reservation* res =
MSDispatch::addReservation(person, reservationTime, pickupTime, earliestPickupTime, from, fromPos, fromStop, to, toPos, toStop, group, line, maxCapacity, maxContainerCapacity);
60 const MSEdge* from,
double fromPos,
61 const MSEdge* to,
double toPos,
81 std::vector<const Reservation*> reservations;
82 for (std::string resID : reservationsIDs) {
90 if (reservations.size() == 1) {
91 taxi->
dispatch(*reservations.front());
99 std::set<const Reservation*> unique(reservations.begin(), reservations.end());
111 throw InvalidArgument(
"Cannot split reservation '" + resID +
"' after dispatch");
113 std::set<std::string> allPersons;
115 allPersons.insert(t->getID());
117 for (std::string p : personIDs) {
118 if (allPersons.count(p) == 0) {
119 throw InvalidArgument(
"Person '" + p +
"' is not part of reservation '" + resID +
"'");
122 if (personIDs.size() == allPersons.size()) {
123 throw InvalidArgument(
"Cannot remove all person from reservation '" + resID +
"'");
125 std::vector<const MSTransportable*>
split;
126 for (
const std::string& p : personIDs) {
128 if (t->getID() == p) {
std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A device which collects info on the vehicle trip (mainly on departure and arrival)
void dispatch(const Reservation &res)
service the given reservation
void dispatchShared(std::vector< const Reservation * > reservations)
service the given reservations
void fulfilledReservation(const Reservation *res) override
erase reservation from storage
std::string splitReservation(std::string resID, std::vector< std::string > personIDs)
split existing reservations and return the new reservation id
StringBijection< const Reservation * > myReservationLookup
Reservation * addReservation(MSTransportable *person, SUMOTime reservationTime, SUMOTime pickupTime, SUMOTime earliestPickupTime, const MSEdge *from, double fromPos, const MSStoppingPlace *fromStop, const MSEdge *to, double toPos, const MSStoppingPlace *toStop, std::string group, const std::string &line, int maxCapacity, int maxContainerCapacity) override
add a new reservation
void interpretDispatch(MSDevice_Taxi *taxi, const std::vector< std::string > &reservationsIDs)
trigger taxi dispatch.
std::string removeReservation(MSTransportable *person, const MSEdge *from, double fromPos, const MSEdge *to, double toPos, std::string group) override
remove person from reservation. If the whole reservation is removed, return its id
virtual std::string removeReservation(MSTransportable *person, const MSEdge *from, double fromPos, const MSEdge *to, double toPos, std::string group)
remove person from reservation. If the whole reservation is removed, return its id
std::map< std::string, std::vector< Reservation * > > myGroupReservations
virtual Reservation * addReservation(MSTransportable *person, SUMOTime reservationTime, SUMOTime pickupTime, SUMOTime earliestPickupTime, const MSEdge *from, double fromPos, const MSStoppingPlace *fromStop, const MSEdge *to, double toPos, const MSStoppingPlace *tostop, std::string group, const std::string &line, int maxCapacity, int maxContainerCapacity)
add a new reservation
virtual void fulfilledReservation(const Reservation *res)
erase reservation from storage
void servedReservation(const Reservation *res)
std::set< const Reservation * > myRunningReservations
A road/street connecting two junctions.
A lane area vehicles can halt at.
void remove(const std::string str, const T key)
bool has(const T key) const
bool hasString(const std::string &str) const
T get(const std::string &str) const
void insert(const std::string str, const T key, bool checkDuplicates=true)
const MSStoppingPlace * toStop
const MSStoppingPlace * fromStop
SUMOTime earliestPickupTime
std::set< const MSTransportable * > persons