SUMO - Simulation of Urban MObility
MSContainerControl.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // Stores all containers in the net and handles their waiting for cars.
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef MSContainerControl_h
22 #define MSContainerControl_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <vector>
35 #include <map>
36 #include "MSContainer.h"
37 #include "MSVehicle.h"
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class MSNet;
44 class MSVehicle;
45 
46 
47 // ===========================================================================
48 // class definitions
49 // ===========================================================================
58 public:
59 
60  typedef std::vector<MSTransportable*> ContainerVector;
61 
64 
66  virtual ~MSContainerControl();
67 
69  bool add(const std::string& id, MSTransportable* container);
70 
72  virtual void erase(MSTransportable* container);
73 
75  void setDeparture(SUMOTime time, MSTransportable* container);
76 
78  void setWaitEnd(SUMOTime time, MSTransportable* container);
79 
81  void checkWaitingContainers(MSNet* net, const SUMOTime time);
82 
84  void addWaiting(const MSEdge* edge, MSTransportable* container);
85 
92  bool loadAnyWaiting(MSEdge* edge, MSVehicle* vehicle, MSVehicle::Stop* stop);
93 
95  bool hasContainers() const;
96 
98  bool hasNonWaiting() const;
99 
101  void abortWaiting();
102 
103 
110 
112  void setTranship(MSTransportable* c);
113 
116 
117 private:
119  std::map<std::string, MSTransportable*> myContainers;
120 
122  std::map<std::string, MSTransportable*> myTranship;
123 
125  std::map<SUMOTime, ContainerVector> myWaiting4Departure;
126 
128  std::map<SUMOTime, ContainerVector> myWaitingUntil;
129 
131  std::map<const MSEdge*, ContainerVector> myWaiting4Vehicle;
132 //
133 };
134 
135 
136 #endif
137 
138 /****************************************************************************/
std::map< SUMOTime, ContainerVector > myWaiting4Departure
Containers waiting for departure.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
long long int SUMOTime
Definition: SUMOTime.h:43
virtual MSContainer * buildContainer(const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan) const
Builds a new container.
std::map< std::string, MSTransportable * > myTranship
all containers being transhiped
void abortWaiting()
aborts the plan for any container that is still waiting for a ride
void addWaiting(const MSEdge *edge, MSTransportable *container)
adds a container to the list of containers waiting for a vehicle on the specified edge ...
void setDeparture(SUMOTime time, MSTransportable *container)
sets the arrival time for a waiting container
Definition of vehicle stop (position and duration)
Definition: MSVehicle.h:564
The simulated network and simulation perfomer.
Definition: MSNet.h:94
The car-following model and parameter.
Definition: MSVehicleType.h:74
A road/street connecting two junctions.
Definition: MSEdge.h:81
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
std::vector< MSTransportable * > ContainerVector
void setWaitEnd(SUMOTime time, MSTransportable *container)
sets the arrival time for a waiting container
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...
void setTranship(MSTransportable *c)
adds a container to myTranship
MSContainerControl()
constructor
Structure representing possible vehicle parameter.
bool add(const std::string &id, MSTransportable *container)
adds a single container, returns false if an id clash occured
void unsetTranship(MSTransportable *c)
removes a container from myTranship
std::map< std::string, MSTransportable * > myContainers
all containers by id
std::map< SUMOTime, ContainerVector > myWaitingUntil
the lists of walking / stopping containers
std::map< const MSEdge *, ContainerVector > myWaiting4Vehicle
the lists of waiting containers
bool hasNonWaiting() const
checks whether any container is still engaged in walking / stopping
virtual void erase(MSTransportable *container)
removes a single container
bool hasContainers() const
checks whether any container waits to finish her plan
void checkWaitingContainers(MSNet *net, const SUMOTime time)
checks whether any containers waiting time is over
virtual ~MSContainerControl()
destructor