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 /****************************************************************************/
15 // Abstract base class for vehicle and person representations
16 /****************************************************************************/
17 #ifndef SUMOTrafficObject_h
18 #define SUMOTrafficObject_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <vector>
27 #include <typeinfo>
28 #include <utils/common/SUMOTime.h>
29 #include <utils/common/Named.h>
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class MSVehicleType;
37 class MSEdge;
38 class MSLane;
39 class Position;
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
49 public:
51  virtual ~SUMOTrafficObject() {}
52 
56  virtual bool isVehicle() const = 0;
57 
61  virtual const std::string& getID() const = 0;
62 
66  virtual const MSVehicleType& getVehicleType() const = 0;
67 
71  virtual bool isStopped() const = 0;
72 
77  virtual const MSEdge* getEdge() const = 0;
78 
82  virtual double getSlope() const = 0;
83 
84  virtual double getChosenSpeedFactor() const = 0;
85 
89  virtual SUMOVehicleClass getVClass() const = 0;
90 
94  virtual double getMaxSpeed() const = 0;
95 
96  virtual SUMOTime getWaitingTime() const = 0;
97 
101  virtual double getSpeed() const = 0;
102 
103  // This definition was introduced to make the MSVehicle's previousSpeed Refs. #2579
107  virtual double getPreviousSpeed() const = 0;
108 
109 
113  virtual double getAcceleration() const = 0;
114 
118  virtual double getPositionOnLane() const = 0;
119 
123  virtual double getBackPositionOnLane(const MSLane* lane) const = 0;
124 
125 
133  virtual Position getPosition(const double offset = 0) const = 0;
134 
137  virtual double getAngle() const = 0;
138 
141  virtual bool hasArrived() const = 0;
142 
143 };
144 
145 
146 #endif
147 
148 /****************************************************************************/
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:66
SUMOTrafficObject
Representation of a vehicle or person.
Definition: SUMOTrafficObject.h:48
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:134
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:51
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
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:35
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:39
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:76
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.