Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSVehicleContainer Class Reference

#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, VehicleVectorVehicleDepartureVector
 
typedef std::vector< SUMOVehicle * > VehicleVector
 definition of a list of vehicles which have the same departure time
 

Public Member Functions

void add (SUMOTime time, const VehicleVector &cont)
 Adds a container with vehicles departing at the given time.
 
void add (SUMOVehicle *veh)
 Adds a single vehicle.
 
bool anyWaitingBefore (SUMOTime time) const
 Returns the information whether any vehicles want to depart before the given time.
 
void clearState ()
 Remove all vehicles before quick-loading state.
 
bool isEmpty () const
 Returns the information whether the container is empty.
 
 MSVehicleContainer (int capacity=10)
 Constructor.
 
void pop ()
 Removes the uppermost vehicle vector.
 
void remove (SUMOVehicle *veh)
 Removes a single vehicle.
 
void showArray () const
 Prints the container (the departure times)
 
int size () const
 Returns the size of the container.
 
const VehicleVectortop ()
 Returns the uppermost vehicle vector.
 
SUMOTime topTime () const
 Returns the time the uppermost vehicle vector is assigned to.
 
 ~MSVehicleContainer ()
 Destructor.
 

Private Types

typedef std::vector< VehicleDepartureVectorVehicleHeap
 Definition of the heap type.
 

Private Member Functions

void addReplacing (const VehicleDepartureVector &cont)
 Replaces the existing single departure time vector by the one given.
 
bool isFull () const
 
void percolateDown (int hole)
 Moves the elements down.
 

Private Attributes

VehicleHeap array
 The vehicle vector heap.
 
int currentSize
 Number of elements in heap.
 

Friends

std::ostream & operator<< (std::ostream &strm, MSVehicleContainer &cont)
 Prints the contents of the container.
 

Detailed Description

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 46 of file MSVehicleContainer.h.

Member Typedef Documentation

◆ VehicleDepartureVector

definition of a structure storing the departure time and a list of vehicles leaving at this time

Definition at line 53 of file MSVehicleContainer.h.

◆ VehicleHeap

Definition of the heap type.

Definition at line 133 of file MSVehicleContainer.h.

◆ VehicleVector

definition of a list of vehicles which have the same departure time

Definition at line 49 of file MSVehicleContainer.h.

Constructor & Destructor Documentation

◆ MSVehicleContainer()

MSVehicleContainer::MSVehicleContainer ( int  capacity = 10)

Constructor.

Definition at line 63 of file MSVehicleContainer.cpp.

◆ ~MSVehicleContainer()

MSVehicleContainer::~MSVehicleContainer ( )

Destructor.

Definition at line 67 of file MSVehicleContainer.cpp.

Member Function Documentation

◆ add() [1/2]

void MSVehicleContainer::add ( SUMOTime  time,
const VehicleVector cont 
)

Adds a container with vehicles departing at the given time.

Definition at line 106 of file MSVehicleContainer.cpp.

References addReplacing(), array, and currentSize.

◆ add() [2/2]

void MSVehicleContainer::add ( SUMOVehicle veh)

Adds a single vehicle.

Definition at line 73 of file MSVehicleContainer.cpp.

References addReplacing(), array, currentSize, DELTA_T, SUMOVehicleParameter::depart, and SUMOTrafficObject::getParameter().

Referenced by MSInsertionControl::add().

Here is the caller graph for this function:

◆ addReplacing()

void MSVehicleContainer::addReplacing ( const VehicleDepartureVector cont)
private

Replaces the existing single departure time vector by the one given.

Definition at line 124 of file MSVehicleContainer.cpp.

References array, currentSize, and isFull().

Referenced by add(), and add().

Here is the caller graph for this function:

◆ anyWaitingBefore()

bool MSVehicleContainer::anyWaitingBefore ( SUMOTime  time) const

Returns the information whether any vehicles want to depart before the given time.

Definition at line 146 of file MSVehicleContainer.cpp.

References isEmpty(), and topTime().

Referenced by MSInsertionControl::checkCandidates().

Here is the caller graph for this function:

◆ clearState()

void MSVehicleContainer::clearState ( )

Remove all vehicles before quick-loading state.

Definition at line 251 of file MSVehicleContainer.cpp.

References array, and currentSize.

Referenced by MSInsertionControl::clearState().

Here is the caller graph for this function:

◆ isEmpty()

bool MSVehicleContainer::isEmpty ( ) const

Returns the information whether the container is empty.

Definition at line 186 of file MSVehicleContainer.cpp.

References currentSize.

Referenced by anyWaitingBefore(), pop(), top(), and topTime().

Here is the caller graph for this function:

◆ isFull()

bool MSVehicleContainer::isFull ( ) const
private

Returns the information whether the container must be extended

Definition at line 192 of file MSVehicleContainer.cpp.

References array, and currentSize.

Referenced by addReplacing().

Here is the caller graph for this function:

◆ percolateDown()

void MSVehicleContainer::percolateDown ( int  hole)
private

Moves the elements down.

Definition at line 198 of file MSVehicleContainer.cpp.

References array, and currentSize.

Referenced by pop().

Here is the caller graph for this function:

◆ pop()

void MSVehicleContainer::pop ( )

Removes the uppermost vehicle vector.

!!Underflow( );

Definition at line 172 of file MSVehicleContainer.cpp.

References array, currentSize, isEmpty(), and percolateDown().

Referenced by MSInsertionControl::checkCandidates().

Here is the caller graph for this function:

◆ remove()

void MSVehicleContainer::remove ( SUMOVehicle veh)

Removes a single vehicle.

Definition at line 93 of file MSVehicleContainer.cpp.

References array, currentSize, SUMOVehicleParameter::depart, and SUMOTrafficObject::getParameter().

Referenced by MSInsertionControl::alreadyDeparted().

Here is the caller graph for this function:

◆ showArray()

void MSVehicleContainer::showArray ( ) const

Prints the container (the departure times)

Definition at line 227 of file MSVehicleContainer.cpp.

References array, and currentSize.

◆ size()

int MSVehicleContainer::size ( ) const

Returns the size of the container.

Definition at line 221 of file MSVehicleContainer.cpp.

References currentSize.

◆ top()

const MSVehicleContainer::VehicleVector & MSVehicleContainer::top ( )

Returns the uppermost vehicle vector.

!!Underflow( );

Definition at line 152 of file MSVehicleContainer.cpp.

References array, and isEmpty().

Referenced by MSInsertionControl::checkCandidates().

Here is the caller graph for this function:

◆ topTime()

SUMOTime MSVehicleContainer::topTime ( ) const

Returns the time the uppermost vehicle vector is assigned to.

!!Underflow( );

Definition at line 162 of file MSVehicleContainer.cpp.

References array, and isEmpty().

Referenced by anyWaitingBefore().

Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  strm,
MSVehicleContainer cont 
)
friend

Prints the contents of the container.

Definition at line 238 of file MSVehicleContainer.cpp.

Field Documentation

◆ array

VehicleHeap MSVehicleContainer::array
private

The vehicle vector heap.

Definition at line 136 of file MSVehicleContainer.h.

Referenced by add(), add(), addReplacing(), clearState(), isFull(), percolateDown(), pop(), remove(), showArray(), top(), and topTime().

◆ currentSize

int MSVehicleContainer::currentSize
private

Number of elements in heap.

Definition at line 130 of file MSVehicleContainer.h.

Referenced by add(), add(), addReplacing(), clearState(), isEmpty(), isFull(), percolateDown(), pop(), remove(), showArray(), and size().


The documentation for this class was generated from the following files: