SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ROVehicleCont.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // A container for vehicles sorted by their departure time
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11 // Copyright (C) 2001-2014 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 ROVehicleCont_h
22 #define ROVehicleCont_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 <string>
35 #include <map>
36 #include <queue>
37 #include <vector>
38 #include "ROVehicle.h"
40 #include "ROHelper.h"
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
54 class ROVehicleCont : public NamedObjectCont<ROVehicle*> {
55 public:
57  ROVehicleCont();
58 
59 
62 
63 
71  const ROVehicle* getTopVehicle() const;
72 
73 
87  virtual bool add(const std::string& id, ROVehicle* item);
88 
89 
97  void clear();
98 
99 
111  bool erase(const std::string& id);
112 
113 
114 private:
122  void rebuildSorted();
123 
124 
125 private:
127  mutable std::priority_queue<ROVehicle*, std::vector<ROVehicle*>, ROVehicleByDepartureComperator> mySorted;
128 
129 
130 private:
132  ROVehicleCont(const ROVehicleCont& src);
133 
136 
137 };
138 
139 
140 #endif
141 
142 /****************************************************************************/
143 
void clear()
Deletes all vehicles stored; clears the lists.
A map of named object pointers.
virtual bool add(const std::string &id, ROVehicle *item)
Adds a vehicle to the container.
void rebuildSorted()
Rebuild the internal, sorted list.
A vehicle as used by router.
Definition: ROVehicle.h:59
std::priority_queue< ROVehicle *, std::vector< ROVehicle * >, ROVehicleByDepartureComperator > mySorted
The sorted vehicle list.
const ROVehicle * getTopVehicle() const
Returns the vehicle that departs most early.
bool erase(const std::string &id)
Tries to remove (and delete) the named vehicle.
A container for vehicles sorted by their departure time.
Definition: ROVehicleCont.h:54
ROVehicleCont()
Constructor.
A function for sorting vehicles by their departure time.
Definition: ROHelper.h:50
~ROVehicleCont()
Destructor.
ROVehicleCont & operator=(const ROVehicleCont &src)
Invalidated assignment operator.