Eclipse SUMO - Simulation of Urban MObility
SUMOTrafficObject.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
14 // Abstract base class for vehicle and person representations
15 /****************************************************************************/
16 #ifndef SUMOTrafficObject_h
17 #define SUMOTrafficObject_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <vector>
26 #include <typeinfo>
27 #include <utils/common/SUMOTime.h>
28 #include <utils/common/Named.h>
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
35 class MSVehicleType;
36 class MSEdge;
37 class MSLane;
38 class Position;
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
48 public:
50  virtual ~SUMOTrafficObject() {}
51 
55  virtual bool isVehicle() const = 0;
56 
60  virtual const std::string& getID() const = 0;
61 
65  virtual const MSVehicleType& getVehicleType() const = 0;
66 
70  virtual bool isStopped() const = 0;
71 
76  virtual const MSEdge* getEdge() const = 0;
77 
81  virtual double getSlope() const = 0;
82 
83  virtual double getChosenSpeedFactor() const = 0;
84 
88  virtual SUMOVehicleClass getVClass() const = 0;
89 
93  virtual double getMaxSpeed() const = 0;
94 
95  virtual SUMOTime getWaitingTime() const = 0;
96 
100  virtual double getSpeed() const = 0;
101 
102  // This definition was introduced to make the MSVehicle's previousSpeed Refs. #2579
106  virtual double getPreviousSpeed() const = 0;
107 
108 
112  virtual double getAcceleration() const = 0;
113 
117  virtual double getPositionOnLane() const = 0;
118 
122  virtual double getBackPositionOnLane(const MSLane* lane) const = 0;
123 
124 
132  virtual Position getPosition(const double offset = 0) const = 0;
133 
136  virtual double getAngle() const = 0;
137 
140  virtual bool hasArrived() const = 0;
141 
142 };
143 
144 
145 #endif
146 
147 /****************************************************************************/
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:65
SUMOTrafficObject
Representation of a vehicle or person.
Definition: SUMOTrafficObject.h:47
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:133
SUMOTrafficObject::getPosition
virtual Position getPosition(const double offset=0) const =0
Return current position (x/y, cartesian)
SUMOTrafficObject::getWaitingTime
virtual SUMOTime getWaitingTime() const =0
SUMOTime.h
SUMOTrafficObject::~SUMOTrafficObject
virtual ~SUMOTrafficObject()
Destructor.
Definition: SUMOTrafficObject.h:50
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
SUMOTrafficObject::getAcceleration
virtual double getAcceleration() const =0
Returns the vehicle's acceleration.
SUMOTrafficObject::getEdge
virtual const MSEdge * getEdge() const =0
Returns the edge the vehicle is currently at.
SUMOTrafficObject::getVehicleType
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
SUMOTrafficObject::isVehicle
virtual bool isVehicle() const =0
Get the vehicle's ID.
SUMOTrafficObject::getID
virtual const std::string & getID() const =0
Get the vehicle's ID.
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
SUMOTrafficObject::getVClass
virtual SUMOVehicleClass getVClass() const =0
Returns the vehicle's access class.
SUMOTrafficObject::getBackPositionOnLane
virtual double getBackPositionOnLane(const MSLane *lane) const =0
Get the vehicle's back position along the given lane.
SUMOTrafficObject::getChosenSpeedFactor
virtual double getChosenSpeedFactor() const =0
SUMOTrafficObject::getAngle
virtual double getAngle() const =0
Returns the objects angle in degrees.
Named.h
SUMOVehicleClass.h
SUMOTrafficObject::getSlope
virtual double getSlope() const =0
Returns the slope of the road at vehicle's position.
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
SUMOTrafficObject::getPreviousSpeed
virtual double getPreviousSpeed() const =0
Returns the vehicle's previous speed.
SUMOTrafficObject::hasArrived
virtual bool hasArrived() const =0
Returns whether this vehicle has arrived.
config.h
SUMOTrafficObject::getPositionOnLane
virtual double getPositionOnLane() const =0
Get the vehicle's position along the lane.
SUMOTrafficObject::getMaxSpeed
virtual double getMaxSpeed() const =0
Returns the vehicle's maximum speed.
SUMOTrafficObject::getSpeed
virtual double getSpeed() const =0
Returns the vehicle's current speed.
SUMOTrafficObject::isStopped
virtual bool isStopped() const =0
Returns whether the vehicle is at a stop.