38MSVehicleContainer::VehicleDepartureVectorSortCrit::operator()
40 return e1.first < e2.first;
53MSVehicleContainer::DepartFinder::operator()
55 return myTime +
DELTA_T > e.first && myTime <= e.first;
76 VehicleHeap::iterator i =
83 newElem.second.push_back(veh);
87 (*i).second.push_back(veh);
96 VehicleHeap::iterator i =
100 (*i).second.erase(std::remove((*i).second.begin(), (*i).second.end(), veh), (*i).second.end());
107 VehicleHeap::iterator j =
116 stored.reserve(stored.size() + cont.size());
117 copy(cont.begin(), cont.end(), back_inserter(stored));
127 for (
int i = (
int)
array.size(); i-- > 0;) {
128 assert(i < (
int)array2.size());
129 array2[i] =
array[i];
136 for (; hole > 1 && (x.first <
array[ hole / 2 ].first); hole /= 2) {
137 assert((
int)
array.size() > hole);
140 assert((
int)
array.size() > hole);
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((
int)
array.size() > hole);
208 if ((
array[ child ].first < tmp.first)) {
209 assert((
int)
array.size() > hole);
215 assert((
int)
array.size() > 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;
std::ostream & operator<<(std::ostream &strm, MSVehicleContainer &cont)
Searches for the VehicleDepartureVector with the wished depart.
DepartFinder(SUMOTime time)
constructor
bool anyWaitingBefore(SUMOTime time) const
Returns the information whether any vehicles want to depart before the given time.
std::pair< SUMOTime, VehicleVector > VehicleDepartureVector
void remove(SUMOVehicle *veh)
Removes a single vehicle.
void percolateDown(int hole)
Moves the elements down.
void add(SUMOVehicle *veh)
Adds a single vehicle.
void addReplacing(const VehicleDepartureVector &cont)
Replaces the existing single departure time vector by the one given.
int size() const
Returns the size of the container.
void pop()
Removes the uppermost vehicle vector.
int currentSize
Number of elements in heap.
void showArray() const
Prints the container (the departure times)
MSVehicleContainer(int capacity=10)
Constructor.
VehicleHeap array
The vehicle vector heap.
SUMOTime topTime() const
Returns the time the uppermost vehicle vector is assigned to.
~MSVehicleContainer()
Destructor.
std::vector< SUMOVehicle * > VehicleVector
definition of a list of vehicles which have the same departure time
void clearState()
Remove all vehicles before quick-loading state.
bool isEmpty() const
Returns the information whether the container is empty.
const VehicleVector & top()
Returns the uppermost vehicle vector.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
Representation of a vehicle.