Eclipse SUMO - Simulation of Urban MObility
VehicleType.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2017-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 // C++ TraCI client API implementation
16 /****************************************************************************/
17 
18 #ifndef SUMO_VehicleType_H
19 #define SUMO_VehicleType_H
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <string>
26 #include <libsumo/TraCIDefs.h>
27 #include <libsumo/TraCIConstants.h>
28 
29 
30 #define LIBSUMO_VEHICLE_TYPE_GETTER \
31 static double getLength(const std::string& typeID); \
32 static double getMaxSpeed(const std::string& typeID); \
33 static double getActionStepLength(const std::string& typeID); \
34 static double getSpeedFactor(const std::string& typeID); \
35 static double getSpeedDeviation(const std::string& typeID); \
36 static double getAccel(const std::string& typeID); \
37 static double getDecel(const std::string& typeID); \
38 static double getEmergencyDecel(const std::string& typeID); \
39 static double getApparentDecel(const std::string& typeID); \
40 static double getImperfection(const std::string& typeID); \
41 static double getTau(const std::string& typeID); \
42 static std::string getVehicleClass(const std::string& typeID); \
43 static std::string getEmissionClass(const std::string& typeID); \
44 static std::string getShapeClass(const std::string& typeID); \
45 static double getMinGap(const std::string& typeID); \
46 static double getWidth(const std::string& typeID); \
47 static double getHeight(const std::string& typeID); \
48 static TraCIColor getColor(const std::string& typeID); \
49 static double getMinGapLat(const std::string& typeID); \
50 static double getMaxSpeedLat(const std::string& typeID); \
51 static std::string getLateralAlignment(const std::string& typeID); \
52 static int getPersonCapacity(const std::string& typeID);
53 
54 #define LIBSUMO_VEHICLE_TYPE_SETTER \
55 static void setLength(const std::string& typeID, double length); \
56 static void setMaxSpeed(const std::string& typeID, double speed); \
57 static void setVehicleClass(const std::string& typeID, const std::string& clazz); \
58 static void setSpeedFactor(const std::string& typeID, double factor); \
59 static void setEmissionClass(const std::string& typeID, const std::string& clazz); \
60 static void setShapeClass(const std::string& typeID, const std::string& shapeClass); \
61 static void setWidth(const std::string& typeID, double width); \
62 static void setHeight(const std::string& typeID, double height); \
63 static void setMinGap(const std::string& typeID, double minGap); \
64 static void setAccel(const std::string& typeID, double accel); \
65 static void setDecel(const std::string& typeID, double decel); \
66 static void setEmergencyDecel(const std::string& typeID, double decel); \
67 static void setApparentDecel(const std::string& typeID, double decel); \
68 static void setImperfection(const std::string& typeID, double imperfection); \
69 static void setTau(const std::string& typeID, double tau); \
70 static void setColor(const std::string& typeID, const TraCIColor& c); \
71 static void setMinGapLat(const std::string& typeID, double minGapLat); \
72 static void setMaxSpeedLat(const std::string& typeID, double speed); \
73 static void setLateralAlignment(const std::string& typeID, const std::string& latAlignment); \
74 static void setActionStepLength(const std::string& typeID, double actionStepLength, bool resetActionOffset=true);
75 
76 // ===========================================================================
77 // class declarations
78 // ===========================================================================
79 class MSVehicleType;
80 namespace libsumo {
81 class VariableWrapper;
82 }
83 
84 
85 // ===========================================================================
86 // class definitions
87 // ===========================================================================
92 namespace libsumo {
93 class VehicleType {
94 public:
95  static std::vector<std::string> getIDList();
96  static int getIDCount();
98  static std::string getParameter(const std::string& typeID, const std::string& key);
99 
101  static void copy(const std::string& origTypeID, const std::string& newTypeID);
102  static MSVehicleType* getVType(std::string id);
103 
104  static void setSpeedDeviation(const std::string& typeID, double deviation);
105  static void setParameter(const std::string& id, const std::string& name, const std::string& value);
106 
108 
109  static std::shared_ptr<VariableWrapper> makeWrapper();
110 
111  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper);
112 
113 private:
116 
117 private:
119  VehicleType() = delete;
120 };
121 
122 
123 }
124 
125 
126 #endif //SUMO_VehicleType_H
127 
128 /****************************************************************************/
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:204
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:42
static ContextSubscriptionResults myContextSubscriptionResults
Definition: VehicleType.h:115
static void setSpeedDeviation(const std::string &typeID, double deviation)
static LIBSUMO_VEHICLE_TYPE_GETTER std::string getParameter(const std::string &typeID, const std::string &key)
static SubscriptionResults mySubscriptionResults
Definition: VehicleType.h:114
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:205
static int getIDCount()
Definition: VehicleType.cpp:54
The car-following model and parameter.
Definition: MSVehicleType.h:66
static LIBSUMO_SUBSCRIPTION_API std::shared_ptr< VariableWrapper > makeWrapper()
static MSVehicleType * getVType(std::string id)
#define LIBSUMO_VEHICLE_TYPE_GETTER
Definition: VehicleType.h:30
static LIBSUMO_VEHICLE_TYPE_SETTER void copy(const std::string &origTypeID, const std::string &newTypeID)
Definition: Edge.cpp:30
static void setParameter(const std::string &id, const std::string &name, const std::string &value)
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
VehicleType()=delete
invalidated standard constructor
#define LIBSUMO_VEHICLE_TYPE_SETTER
Definition: VehicleType.h:54
static std::vector< std::string > getIDList()
Definition: VehicleType.cpp:46