|
SUMO - Simulation of Urban MObility
|
A container for vehicles sorted by their departure time. More...
#include <ROVehicleCont.h>


Public Types | |
| typedef std::map< std::string, ROVehicle * > | IDMap |
| Definition of the key to pointer map type. More... | |
Public Member Functions | |
| virtual bool | add (const std::string &id, ROVehicle *item) |
| Adds a vehicle to the container. More... | |
| const std::vector< ROVehicle * > & | buildAndGetStaticVector () const |
| void | clear () |
| Deletes all vehicles stored; clears the lists. More... | |
| bool | erase (const std::string &id) |
| Tries to remove (and delete) the named vehicle. More... | |
| ROVehicle * | get (const std::string &id) const |
| Retrieves an item. More... | |
| const IDMap & | getMyMap () const |
| std::vector< ROVehicle * > | getTempVector () const |
| const ROVehicle * | getTopVehicle () const |
| Returns the vehicle that departs most early. More... | |
| void | insertIDs (std::vector< std::string > &into) const |
| virtual bool | remove (const std::string &id) |
| Removes an item. More... | |
| ROVehicleCont () | |
| Constructor. More... | |
| unsigned int | size () const |
| Returns the number of items within the container. More... | |
| ~ROVehicleCont () | |
| Destructor. More... | |
Private Member Functions | |
| ROVehicleCont & | operator= (const ROVehicleCont &src) |
| Invalidated assignment operator. More... | |
| void | rebuildSorted () |
| Rebuild the internal, sorted list. More... | |
| ROVehicleCont (const ROVehicleCont &src) | |
| Invalidated copy constructor. More... | |
Private Attributes | |
| std::priority_queue< ROVehicle *, std::vector< ROVehicle * >, ROVehicleByDepartureComperator > | mySorted |
| The sorted vehicle list. More... | |
A container for vehicles sorted by their departure time.
A map of vehicle-ids to the vehicles themselves. Besides the functionality implemented in NamedObjectCont, this class stores vehicles sorted by their departure time.
Definition at line 54 of file ROVehicleCont.h.
|
inherited |
Definition of the key to pointer map type.
Definition at line 57 of file NamedObjectCont.h.
| ROVehicleCont::ROVehicleCont | ( | ) |
Constructor.
Definition at line 48 of file ROVehicleCont.cpp.
| ROVehicleCont::~ROVehicleCont | ( | ) |
Destructor.
Definition at line 51 of file ROVehicleCont.cpp.
|
private |
Invalidated copy constructor.
|
virtual |
Adds a vehicle to the container.
Tries to add the vehicle to the container using NamedObjectCont::add. If this succeeds, the vehicle is also added to the internal sorted list of vehicles.
Returns the value from NamedObjectCont::add.
| [in] | id | The id of the vehicle to add |
| [in] | item | The vehicle to add |
Reimplemented from NamedObjectCont< ROVehicle * >.
Definition at line 64 of file ROVehicleCont.cpp.
References mySorted.
Referenced by RONet::addVehicle().
|
inlineinherited |
Definition at line 179 of file NamedObjectCont.h.
| void ROVehicleCont::clear | ( | ) |
Deletes all vehicles stored; clears the lists.
Calls NamedObjectCont::clear and replaces the internal, sorted list by an empty one.
Definition at line 74 of file ROVehicleCont.cpp.
References NamedObjectCont< T >::clear(), and mySorted.
Referenced by RONet::~RONet().
| bool ROVehicleCont::erase | ( | const std::string & | id | ) |
Tries to remove (and delete) the named vehicle.
Calls NamedObjectCont::erase. If this succeeds, the vehicle is removed from the internal sorted list. This method takes care whether the vehicle to remove is the top-most one (the one with the earliest depart time). If not, the internal list is rebuild.
| [in] | id | The id of the vehicle to remove |
Definition at line 81 of file ROVehicleCont.cpp.
References ROVehicle::getID(), getTopVehicle(), mySorted, and rebuildSorted().
Referenced by RONet::saveAndRemoveRoutesUntil().
|
inlineinherited |
Retrieves an item.
Returns 0 when no item with the given id is stored within the container
| [in] | id | The id of the item to retrieve |
Definition at line 113 of file NamedObjectCont.h.
|
inlineinherited |
Definition at line 224 of file NamedObjectCont.h.
Referenced by rebuildSorted().
|
inlineinherited |
Definition at line 199 of file NamedObjectCont.h.
| const ROVehicle * ROVehicleCont::getTopVehicle | ( | ) | const |
Returns the vehicle that departs most early.
Returns the first vehicle from the internal list of sorted vehicles or 0 if this list is empty.
Definition at line 55 of file ROVehicleCont.cpp.
References mySorted, and NamedObjectCont< ROVehicle * >::size().
Referenced by erase(), and RONet::saveAndRemoveRoutesUntil().
|
inlineinherited |
Definition at line 212 of file NamedObjectCont.h.
|
private |
Invalidated assignment operator.
|
private |
Rebuild the internal, sorted list.
Rebuilds the internal, sorted list by clearing it, first, and then adding all vehicles stored.
Definition at line 97 of file ROVehicleCont.cpp.
References NamedObjectCont< ROVehicle * >::getMyMap(), and mySorted.
Referenced by erase().
|
inlinevirtualinherited |
Removes an item.
| [in] | id | The id of the item to remove |
Definition at line 94 of file NamedObjectCont.h.
|
inlineinherited |
Returns the number of items within the container.
Definition at line 137 of file NamedObjectCont.h.
Referenced by getTopVehicle().
|
mutableprivate |
The sorted vehicle list.
Definition at line 127 of file ROVehicleCont.h.
Referenced by add(), clear(), erase(), getTopVehicle(), and rebuildSorted().