|
Traffic Flow Dynamics Model
|
#include <Vehicle.hpp>
Public Member Functions | |
| Vehicle (int) | |
| create a vehicle of a type in _vehicleType More... | |
| Vehicle (const Vehicle &v) | |
| uint8_t | getType () const noexcept |
| Get the vehicle type index. More... | |
| void | setPosition (int) |
| Set the position of the vehicle. More... | |
| uint16_t | getPosition () const noexcept |
| Get the position of the vehicle. More... | |
| int | getPreviousPosition () const noexcept |
| Get the previous position of the vehicle. More... | |
| void | setStreet (int) |
| Set the street of the vehicle. More... | |
| int | getStreet () const |
| Get the street of the vehicle. More... | |
| uint16_t | getDestination () const noexcept |
| Get the destination of the vehicle. More... | |
| void | setTimePenalty (int) |
| Set the time penalty of the vehicle. More... | |
| int | getTimePenalty () const noexcept |
| Get the time penalty of the vehicle. More... | |
| void | setVelocity (double) |
| Set the velocity of the vehicle. More... | |
| double | getVelocity () const noexcept |
| Get the velocity of the vehicle. More... | |
| void | incrementTimeTraveled () noexcept |
| Increment the time traveled by the vehicle. | |
| int | getTimeTraveled () const noexcept |
| Get the time traveled by the vehicle. More... | |
| void | resetTimeTraveled () noexcept |
| Reset the time traveled by the vehicle, setting it to 0. | |
Static Public Member Functions | |
| static void | addVehicleType (int, int) |
| add a vehicle type in _vehicleType More... | |
| static void | addVehicleType (std::string) |
| add many vehicle types in _vehicleType from file More... | |
| static std::shared_ptr< VehicleType > | getVehicleType (int8_t const) |
| get a vehicle type from _vehicleType More... | |
| static uint8_t | getNVehicleType () |
| get the number of vehicle types in _vehicleType More... | |
Vehicle class.
This class is used to represent a vehicle. It contains the vehicle type, the position, the street, the time penalty, the velocity and the time traveled.
| Vehicle::Vehicle | ( | int | type | ) |
create a vehicle of a type in _vehicleType
Create a new Vehicle object.
| type | The index of the vehicle type in _vehicleType. |
| std::invalid_argument | if the vehicle type index is out of range. |
|
static |
add a vehicle type in _vehicleType
Add a vehicle type in _vehicleType.
| src | The source node. |
| dst | The destination node. |
| std::invalid_argument | if the vehicle type already exists. |
|
static |
add many vehicle types in _vehicleType from file
Add many vehicle types in _vehicleType from file.
| fName | The file name. |
| std::runtime_error | if the file is not found or empty. |
| std::invalid_argument | if the vehicle type already exists. |
|
noexcept |
Get the destination of the vehicle.
|
static |
get the number of vehicle types in _vehicleType
Get the number of vehicle types.
|
noexcept |
Get the position of the vehicle.
|
noexcept |
Get the previous position of the vehicle.
| int Vehicle::getStreet | ( | ) | const |
Get the street of the vehicle.
|
noexcept |
Get the time penalty of the vehicle.
|
noexcept |
Get the time traveled by the vehicle.
|
noexcept |
Get the vehicle type index.
|
static |
get a vehicle type from _vehicleType
Get the vehicle type.
| std::invalid_argument | if the vehicle type index is out of range. |
|
noexcept |
Get the velocity of the vehicle.
| void Vehicle::setPosition | ( | int | pos | ) |
Set the position of the vehicle.
| pos | The position of the vehicle, i.e. a positive integrer representing the index of the node. |
| std::invalid_argument | if the position is negative. |
| void Vehicle::setStreet | ( | int | street | ) |
Set the street of the vehicle.
| street | The street of the vehicle, i.e. a positive integrer representing the index of the street. The -1 is a jolly. |
| void Vehicle::setTimePenalty | ( | int | time | ) |
Set the time penalty of the vehicle.
| time | The time penalty of the vehicle, i.e. a positive integrer. |
| std::invalid_argument | if the time is negative. |
| void Vehicle::setVelocity | ( | double | vel | ) |
Set the velocity of the vehicle.
| vel | The velocity of the vehicle. |
| std::invalid_argument | if the velocity is negative. |