SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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<MSContainer*> ContainerVector;
61 
64 
66  virtual ~MSContainerControl();
67 
69  bool add(const std::string& id, MSContainer* container);
70 
72  virtual void erase(MSContainer* container);
73 
75  void setDeparture(SUMOTime time, MSContainer* container);
76 
78  void setWaitEnd(SUMOTime time, MSContainer* container);
79 
81  void checkWaitingContainers(MSNet* net, const SUMOTime time);
82 
84  void addWaiting(const MSEdge* edge, MSContainer* 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 
109  virtual MSContainer* buildContainer(const SUMOVehicleParameter* pars, const MSVehicleType* vtype, MSContainer::MSContainerPlan* plan) const;
110 
112  void setTranship(MSContainer* c);
113 
115  void unsetTranship(MSContainer* c);
116 //
117 // /// @brief returns whether the the given container is waiting for a vehicle on the given edge
118 // bool isWaiting4Vehicle(const MSEdge* const edge, MSContainer* p) const;
119 //
120 // const std::map<std::string, MSContainer*>& getContainers() const {
121 // return myContainers;
122 // }
123 //
124 private:
126  std::map<std::string, MSContainer*> myContainers;
127 
129  std::map<std::string, MSContainer*> myTranship;
130 
132  std::map<SUMOTime, ContainerVector> myWaiting4Departure;
133 
135  std::map<SUMOTime, ContainerVector> myWaitingUntil;
136 
138  std::map<const MSEdge*, ContainerVector> myWaiting4Vehicle;
139 //
140 };
141 
142 
143 #endif
144 
145 /****************************************************************************/
std::map< SUMOTime, ContainerVector > myWaiting4Departure
Containers waiting for departure.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
void setWaitEnd(SUMOTime time, MSContainer *container)
sets the arrival time for a waiting container
void abortWaiting()
aborts the plan for any container that is still waiting for a ride
void addWaiting(const MSEdge *edge, MSContainer *container)
adds a container to the list of containers waiting for a vehicle on the specified edge ...
Definition of vehicle stop (position and duration)
Definition: MSVehicle.h:560
void setTranship(MSContainer *c)
adds a container to myTranship
The simulated network and simulation perfomer.
Definition: MSNet.h:94
The car-following model and parameter.
Definition: MSVehicleType.h:74
virtual void erase(MSContainer *container)
removes a single container
std::vector< MSContainer * > ContainerVector
A road/street connecting two junctions.
Definition: MSEdge.h:81
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...
std::vector< MSContainerStage * > MSContainerPlan
the structure holding the plan of a container
Definition: MSContainer.h:553
MSContainerControl()
constructor
virtual MSContainer * buildContainer(const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSContainer::MSContainerPlan *plan) const
Builds a new container.
Structure representing possible vehicle parameter.
bool add(const std::string &id, MSContainer *container)
adds a single container, returns false if an id clash occured
std::map< std::string, MSContainer * > myTranship
all containers being transhiped
void setDeparture(SUMOTime time, MSContainer *container)
sets the arrival time for a waiting container
void unsetTranship(MSContainer *c)
removes a container from myTranship
int SUMOTime
Definition: SUMOTime.h:43
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
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
std::map< std::string, MSContainer * > myContainers
all containers by id
virtual ~MSContainerControl()
destructor