32#define DEBUG_COND2(obj) (true)
42 const MSEdge* from,
double fromPos,
43 const MSEdge* to,
double toPos,
45 const std::string& line,
47 int maxContainerCapacity) {
48 Reservation* res =
MSDispatch::addReservation(person, reservationTime, pickupTime, from, fromPos, to, toPos, group, line, maxCapacity, maxContainerCapacity);
57 const MSEdge* from,
double fromPos,
58 const MSEdge* to,
double toPos,
78 std::vector<const Reservation*> reservations;
79 for (std::string resID : reservationsIDs) {
87 if (reservations.size() == 1) {
88 taxi->
dispatch(*reservations.front());
96 std::set<const Reservation*> unique(reservations.begin(), reservations.end());
108 throw InvalidArgument(
"Cannot split reservation '" + resID +
"' after dispatch");
110 std::set<std::string> allPersons;
112 allPersons.insert(t->
getID());
114 for (std::string p : personIDs) {
115 if (allPersons.count(p) == 0) {
116 throw InvalidArgument(
"Person '" + p +
"' is not part of reservation '" + resID +
"'");
119 if (personIDs.size() == allPersons.size()) {
120 throw InvalidArgument(
"Cannot remove all person from reservation '" + resID +
"'");
122 std::vector<MSTransportable*>
split;
123 for (
const std::string& p : personIDs) {
125 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
void interpretDispatch(MSDevice_Taxi *taxi, const std::vector< std::string > &reservationsIDs)
trigger taxi dispatch.
Reservation * addReservation(MSTransportable *person, SUMOTime reservationTime, SUMOTime pickupTime, const MSEdge *from, double fromPos, const MSEdge *to, double toPos, std::string group, const std::string &line, int maxCapacity, int maxContainerCapacity) override
add a new reservation
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 it's 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 it's id
std::map< std::string, std::vector< Reservation * > > myGroupReservations
virtual Reservation * addReservation(MSTransportable *person, SUMOTime reservationTime, SUMOTime pickupTime, const MSEdge *from, double fromPos, const MSEdge *to, double toPos, 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.
const std::string & getID() const
Returns the id.
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)
std::set< MSTransportable * > persons