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-2018 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>
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 
53 #define LIBSUMO_VEHICLE_TYPE_SETTER \
54 static void setLength(const std::string& typeID, double length); \
55 static void setMaxSpeed(const std::string& typeID, double speed); \
56 static void setVehicleClass(const std::string& typeID, const std::string& clazz); \
57 static void setSpeedFactor(const std::string& typeID, double factor); \
58 static void setEmissionClass(const std::string& typeID, const std::string& clazz); \
59 static void setShapeClass(const std::string& typeID, const std::string& shapeClass); \
60 static void setWidth(const std::string& typeID, double width); \
61 static void setHeight(const std::string& typeID, double height); \
62 static void setMinGap(const std::string& typeID, double minGap); \
63 static void setAccel(const std::string& typeID, double accel); \
64 static void setDecel(const std::string& typeID, double decel); \
65 static void setEmergencyDecel(const std::string& typeID, double decel); \
66 static void setApparentDecel(const std::string& typeID, double decel); \
67 static void setImperfection(const std::string& typeID, double imperfection); \
68 static void setTau(const std::string& typeID, double tau); \
69 static void setColor(const std::string& typeID, const TraCIColor& c); \
70 static void setMinGapLat(const std::string& typeID, double minGapLat); \
71 static void setMaxSpeedLat(const std::string& typeID, double speed); \
72 static void setLateralAlignment(const std::string& typeID, const std::string& latAlignment); \
73 static void setActionStepLength(const std::string& typeID, double actionStepLength, bool resetActionOffset);
74 
75 // ===========================================================================
76 // class declarations
77 // ===========================================================================
78 class MSVehicleType;
79 namespace libsumo {
80 class VariableWrapper;
81 }
82 
83 
84 // ===========================================================================
85 // class definitions
86 // ===========================================================================
91 namespace libsumo {
92 class VehicleType {
93 public:
94  static std::vector<std::string> getIDList();
95  static int getIDCount();
97  static std::string getParameter(const std::string& typeID, const std::string& key);
98 
100  static void copy(const std::string& origTypeID, const std::string& newTypeID);
101  static MSVehicleType* getVType(std::string id);
102 
103  static void setSpeedDeviation(const std::string& typeID, double deviation);
104  static void setParameter(const std::string& id, const std::string& name, const std::string& value);
105 
107 
108  static std::shared_ptr<VariableWrapper> makeWrapper();
109 
110  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper);
111 
112 private:
115 
116 private:
118  VehicleType() = delete;
119 };
120 
121 
122 }
123 
124 
125 #endif //SUMO_VehicleType_H
126 
127 /****************************************************************************/
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:199
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:44
static ContextSubscriptionResults myContextSubscriptionResults
Definition: VehicleType.h:114
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:113
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:200
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:53
static std::vector< std::string > getIDList()
Definition: VehicleType.cpp:46