45 #ifdef CHECK_MEMORY_LEAKS
47 #endif // CHECK_MEMORY_LEAKS
57 myWaitingForVehicleNumber(0),
58 myHaveNewWaiting(false) {
87 std::map<std::string, MSTransportable*>::const_iterator i =
myTransportables.find(
id);
103 const std::map<std::string, MSTransportable*>::iterator i =
myTransportables.find(transportable->
getID());
125 for (
int i = 0; i < (int)transportables.size(); ++i) {
126 if (transportables[i]->proceed(net, time)) {
129 erase(transportables[i]);
137 for (
int i = 0; i < (int)transportables.size(); ++i) {
138 if (!transportables[i]->proceed(net, time)) {
139 erase(transportables[i]);
162 for (TransportableVector::iterator i = wait.begin(); i != wait.end();) {
169 if (boardingDuration >= stop->
duration) {
187 if (wait.size() == 0) {
200 for (TransportableVector::iterator i = waitContainers.begin(); i != waitContainers.end();) {
205 && stop->
startPos <= (*i)->getEdgePos() && (*i)->getEdgePos() <= stop->
endPos) {
211 if (loadingDuration >= stop->
duration) {
218 i = waitContainers.erase(i);
225 if (waitContainers.size() == 0) {
248 const MSEdge* edge = (*i).first;
250 for (TransportableVector::const_iterator j = pv.begin(); j != pv.end(); ++j) {
252 if (dynamic_cast<MSPerson*>(p) != 0) {
254 WRITE_WARNING(
"Person '" + p->
getID() +
"' aborted waiting for a ride that will never come.");
257 WRITE_WARNING(
"Container '" + p->
getID() +
"' aborted waiting for a transport that will never come.");
267 return new MSPerson(pars, vtype, plan);
SUMOTime getBoardingDuration() const
Get this vehicle type's boarding duration.
void addWaiting(const MSEdge *edge, MSTransportable *person)
adds a transportable to the list of transportables waiting for a vehicle on the specified edge ...
virtual MSTransportable * buildPerson(const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan) const
Builds a new person.
Representation of a vehicle in the micro simulation.
SUMOTime timeToBoardNextPerson
The time at which the vehicle is able to board another person.
virtual void tripInfoOutput(OutputDevice &os) const =0
Called on writing tripinfo output.
SUMOTime getLoadingDuration() const
Get this vehicle type's loading duration.
void addContainer(MSTransportable *container)
Adds a container.
const SUMOVehicleParameter & getParameter() const
std::map< SUMOTime, TransportableVector > myWaiting4Departure
Transportables waiting for departure.
void setWaitEnd(SUMOTime time, MSTransportable *transportable)
sets the arrival time for a waiting transportable
virtual ~MSTransportableControl()
Destructor.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
std::map< std::string, MSTransportable * > myTransportables
all currently created transportables by id
const std::string & getID() const
returns the id of the transportable
Definition of vehicle stop (position and duration)
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
std::map< const MSEdge *, TransportableVector > myWaiting4Vehicle
the lists of waiting transportables
virtual void removeContainer(MSTransportable *container) const
Remove container from myContainers.
#define WRITE_WARNING(msg)
The simulated network and simulation perfomer.
int myLoadedNumber
The number of build transportables.
The car-following model and parameter.
virtual void erase(MSTransportable *transportable)
removes a single transportable
static OptionsCont & getOptions()
Retrieves the options.
int getPersonCapacity() const
Get this vehicle type's person capacity.
int getContainerNumber() const
Returns the number of containers.
A road/street connecting two junctions.
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
bool hasNonWaiting() const
checks whether any transportable is still engaged in walking / stopping
virtual void removePerson(MSTransportable *p) const
MSTransportable * get(const std::string &id) const
Returns the named transportable, if existing.
SUMOTime timeToLoadNextContainer
The time at which the vehicle is able to load another container.
bool myHaveNewWaiting
whether a new transportable waiting for a vehicle has been added in the last step ...
SUMOTime depart
The vehicle's departure time.
virtual void routeOutput(OutputDevice &os) const =0
Called on writing vehroute output.
bool loadAnyWaiting(MSEdge *edge, MSVehicle *vehicle, MSVehicle::Stop *stop)
load any applicable containers Loads any container that is waiting on that edge for the given vehicle...
SUMOTime duration
The stopping duration.
int getPersonNumber() const
Returns the number of persons.
std::string line
The vehicle's line (mainly for public transport)
virtual MSTransportable * buildContainer(const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan) const
Builds a new container.
int myWaitingForVehicleNumber
The number of transportables waiting for vehicles.
bool boardAnyWaiting(MSEdge *edge, MSVehicle *vehicle, MSVehicle::Stop *stop)
board any applicable persons Boards any people who wait on that edge for the given vehicle and remove...
bool hasTransportables() const
checks whether any transportable waits to finish her plan
Structure representing possible vehicle parameter.
void abortWaiting()
aborts the plan for any transportable that is still waiting for a ride
MSTransportableControl()
Constructor.
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
bool add(MSTransportable *transportable)
Adds a single transportable, returns false if an id clash occured.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
void checkWaiting(MSNet *net, const SUMOTime time)
checks whether any transportables waiting time is over
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
SUMOReal endPos
The stopping position end.
std::vector< MSTransportable * > TransportableVector
Definition of a list of transportables.
void addPerson(MSTransportable *person)
Adds a passenger.
int myRunningNumber
The number of transportables within the network (build and inserted but not removed) ...
int getContainerCapacity() const
Get this vehicle type's container capacity.
std::map< SUMOTime, TransportableVector > myWaitingUntil
the lists of walking / stopping transportables
SUMOReal startPos
The stopping position start.
std::string id
The vehicle's id.