39 #ifdef CHECK_MEMORY_LEAKS
41 #endif // CHECK_MEMORY_LEAKS
51 MSVehicleContainer::VehicleDepartureVectorSortCrit::operator()
53 return e1.first < e2.first;
66 MSVehicleContainer::DepartFinder::operator()
68 return myTime +
DELTA_T > e.first && myTime <= e.first;
89 VehicleHeap::iterator i =
94 newElem.second.push_back(veh);
98 (*i).second.push_back(veh);
105 VehicleHeap::iterator j =
114 stored.reserve(stored.size() + cont.size());
115 copy(cont.begin(), cont.end(), back_inserter(stored));
125 for (
size_t i =
array.size(); i-- > 0;) {
126 assert(array2.size() > i);
127 array2[i] =
array[i];
134 for (; hole > 1 && (x.first <
array[ hole / 2 ].first); hole /= 2) {
135 assert(
array.size() > (size_t) hole);
138 assert(
array.size() > (size_t) hole);
145 VehicleHeap::const_iterator j =
156 assert(
array.size() > 1);
157 return array[ 1 ].second;
166 assert(
array.size() > 1);
167 return array[ 1 ].first;
179 assert(
array.size() > 1);
200 assert(
array.size() > (size_t)hole);
208 if ((
array[ child ].first < tmp.first)) {
209 assert(
array.size() > (size_t) hole);
215 assert(
array.size() > (size_t) hole);
229 if (i !=
array.begin() + 1) {
232 std::cout << (*i).first;
234 std::cout << std::endl <<
"-------------------------" << std::endl;
239 strm <<
"------------------------------------" << std::endl;
242 for (MSVehicleContainer::VehicleVector::const_iterator i = v.begin(); i != v.end(); ++i) {
243 strm << (*i)->getParameter().depart << std::endl;
VehicleHeap array
The vehicle vector heap.
SUMOTime topTime() const
Returns the time the uppermost vehicle vector is assigned to.
void percolateDown(int hole)
Moves the elements down.
DepartFinder(SUMOTime time)
constructor
bool isEmpty() const
Returns the information whether the container is empty.
std::vector< SUMOVehicle * > VehicleVector
definition of a list of vehicles which have the same departure time
int currentSize
Number of elements in heap.
void pop()
Removes the uppermost vehicle vector.
Representation of a vehicle.
MSVehicleContainer(size_t capacity=10)
Constructor.
SUMOTime depart
The vehicle's departure time.
size_t size() const
Returns the size of the container.
void add(SUMOVehicle *veh)
Adds a single vehicle.
const VehicleVector & top()
Returns the uppermost vehicle vector.
bool anyWaitingFor(SUMOTime time) const
Returns the information whether any vehicles want to depart at the given time.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
std::pair< SUMOTime, VehicleVector > VehicleDepartureVector
void showArray() const
Prints the container (the departure times)
std::ostream & operator<<(std::ostream &os, const MTRand &mtrand)
void addReplacing(const VehicleDepartureVector &cont)
Replaces the existing single departure time vector by the one given.
Searches for the VehicleDepartureVector with the wished depart.
~MSVehicleContainer()
Destructor.