SUMO - Simulation of Urban MObility
|
#include <MSVehicleContainer.h>
Data Structures | |
class | DepartFinder |
Searches for the VehicleDepartureVector with the wished depart. More... | |
class | VehicleDepartureVectorSortCrit |
Sort-criterion for vehicle departure lists. More... | |
Public Types | |
typedef std::pair< SUMOTime, VehicleVector > | VehicleDepartureVector |
typedef std::vector< SUMOVehicle * > | VehicleVector |
definition of a list of vehicles which have the same departure time More... | |
Public Member Functions | |
void | add (SUMOVehicle *veh) |
Adds a single vehicle. More... | |
void | add (SUMOTime time, const VehicleVector &cont) |
Adds a container with vehicles departing at the given time. More... | |
bool | anyWaitingBefore (SUMOTime time) const |
Returns the information whether any vehicles want to depart before the given time. More... | |
bool | isEmpty () const |
Returns the information whether the container is empty. More... | |
MSVehicleContainer (size_t capacity=10) | |
Constructor. More... | |
void | pop () |
Removes the uppermost vehicle vector. More... | |
void | showArray () const |
Prints the container (the departure times) More... | |
size_t | size () const |
Returns the size of the container. More... | |
const VehicleVector & | top () |
Returns the uppermost vehicle vector. More... | |
SUMOTime | topTime () const |
Returns the time the uppermost vehicle vector is assigned to. More... | |
~MSVehicleContainer () | |
Destructor. More... | |
Private Types | |
typedef std::vector< VehicleDepartureVector > | VehicleHeap |
Definition of the heap type. More... | |
Private Member Functions | |
void | addReplacing (const VehicleDepartureVector &cont) |
Replaces the existing single departure time vector by the one given. More... | |
bool | isFull () const |
void | percolateDown (int hole) |
Moves the elements down. More... | |
Private Attributes | |
VehicleHeap | array |
The vehicle vector heap. More... | |
int | currentSize |
Number of elements in heap. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &strm, MSVehicleContainer &cont) |
Prints the contents of the container. More... | |
A storage for vehicles, mainly used by the vehicle/route loading structures and the insertion control. Stores vehicles in a heap of vehiclevector/departure- pairs.
Definition at line 55 of file MSVehicleContainer.h.
typedef std::pair<SUMOTime, VehicleVector> MSVehicleContainer::VehicleDepartureVector |
definition of a structure storing the departure time and a list of vehicles leaving at this time
Definition at line 62 of file MSVehicleContainer.h.
|
private |
Definition of the heap type.
Definition at line 136 of file MSVehicleContainer.h.
typedef std::vector<SUMOVehicle*> MSVehicleContainer::VehicleVector |
definition of a list of vehicles which have the same departure time
Definition at line 58 of file MSVehicleContainer.h.
MSVehicleContainer::MSVehicleContainer | ( | size_t | capacity = 10 | ) |
Constructor.
Definition at line 76 of file MSVehicleContainer.cpp.
MSVehicleContainer::~MSVehicleContainer | ( | ) |
Destructor.
Definition at line 80 of file MSVehicleContainer.cpp.
void MSVehicleContainer::add | ( | SUMOVehicle * | veh | ) |
Adds a single vehicle.
Definition at line 86 of file MSVehicleContainer.cpp.
References addReplacing(), array, currentSize, SUMOVehicleParameter::depart, and SUMOVehicle::getParameter().
Referenced by MSInsertionControl::add().
void MSVehicleContainer::add | ( | SUMOTime | time, |
const VehicleVector & | cont | ||
) |
Adds a container with vehicles departing at the given time.
Definition at line 104 of file MSVehicleContainer.cpp.
References addReplacing(), array, and currentSize.
|
private |
Replaces the existing single departure time vector by the one given.
Definition at line 122 of file MSVehicleContainer.cpp.
References array, currentSize, and isFull().
Referenced by add().
Returns the information whether any vehicles want to depart before the given time.
Definition at line 144 of file MSVehicleContainer.cpp.
References isEmpty(), and topTime().
Referenced by MSInsertionControl::checkCandidates().
bool MSVehicleContainer::isEmpty | ( | ) | const |
Returns the information whether the container is empty.
Definition at line 184 of file MSVehicleContainer.cpp.
References currentSize.
Referenced by anyWaitingBefore(), operator<<(), pop(), top(), and topTime().
|
private |
Returns the information whether the container must be extended
Definition at line 190 of file MSVehicleContainer.cpp.
References array, and currentSize.
Referenced by addReplacing().
|
private |
Moves the elements down.
Definition at line 196 of file MSVehicleContainer.cpp.
References array, and currentSize.
Referenced by pop().
void MSVehicleContainer::pop | ( | ) |
Removes the uppermost vehicle vector.
!!Underflow( );
Definition at line 170 of file MSVehicleContainer.cpp.
References array, currentSize, isEmpty(), and percolateDown().
Referenced by MSInsertionControl::checkCandidates(), and operator<<().
void MSVehicleContainer::showArray | ( | ) | const |
Prints the container (the departure times)
Definition at line 225 of file MSVehicleContainer.cpp.
References array, and currentSize.
size_t MSVehicleContainer::size | ( | ) | const |
Returns the size of the container.
Definition at line 219 of file MSVehicleContainer.cpp.
References currentSize.
const MSVehicleContainer::VehicleVector & MSVehicleContainer::top | ( | ) |
Returns the uppermost vehicle vector.
!!Underflow( );
Definition at line 150 of file MSVehicleContainer.cpp.
References array, and isEmpty().
Referenced by MSInsertionControl::checkCandidates(), and operator<<().
SUMOTime MSVehicleContainer::topTime | ( | ) | const |
Returns the time the uppermost vehicle vector is assigned to.
!!Underflow( );
Definition at line 160 of file MSVehicleContainer.cpp.
References array, and isEmpty().
Referenced by anyWaitingBefore().
|
friend |
Prints the contents of the container.
Definition at line 236 of file MSVehicleContainer.cpp.
|
private |
The vehicle vector heap.
Definition at line 139 of file MSVehicleContainer.h.
Referenced by add(), addReplacing(), isFull(), percolateDown(), pop(), showArray(), top(), and topTime().
|
private |
Number of elements in heap.
Definition at line 133 of file MSVehicleContainer.h.
Referenced by add(), addReplacing(), isEmpty(), isFull(), percolateDown(), pop(), showArray(), and size().