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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // C++ TraCI client API implementation
19 /****************************************************************************/
20 
21 #pragma once
22 #include <string>
23 #include <libsumo/TraCIDefs.h>
24 #include <libsumo/TraCIConstants.h>
25 
26 
27 #define LIBSUMO_VEHICLE_TYPE_GETTER \
28 static double getLength(const std::string& typeID); \
29 static double getMaxSpeed(const std::string& typeID); \
30 static double getActionStepLength(const std::string& typeID); \
31 static double getSpeedFactor(const std::string& typeID); \
32 static double getSpeedDeviation(const std::string& typeID); \
33 static double getAccel(const std::string& typeID); \
34 static double getDecel(const std::string& typeID); \
35 static double getEmergencyDecel(const std::string& typeID); \
36 static double getApparentDecel(const std::string& typeID); \
37 static double getImperfection(const std::string& typeID); \
38 static double getTau(const std::string& typeID); \
39 static std::string getVehicleClass(const std::string& typeID); \
40 static std::string getEmissionClass(const std::string& typeID); \
41 static std::string getShapeClass(const std::string& typeID); \
42 static double getMinGap(const std::string& typeID); \
43 static double getWidth(const std::string& typeID); \
44 static double getHeight(const std::string& typeID); \
45 static libsumo::TraCIColor getColor(const std::string& typeID); \
46 static double getMinGapLat(const std::string& typeID); \
47 static double getMaxSpeedLat(const std::string& typeID); \
48 static std::string getLateralAlignment(const std::string& typeID); \
49 static int getPersonCapacity(const std::string& typeID);
50 
51 #define LIBSUMO_VEHICLE_TYPE_SETTER \
52 static void setLength(const std::string& typeID, double length); \
53 static void setMaxSpeed(const std::string& typeID, double speed); \
54 static void setVehicleClass(const std::string& typeID, const std::string& clazz); \
55 static void setSpeedFactor(const std::string& typeID, double factor); \
56 static void setEmissionClass(const std::string& typeID, const std::string& clazz); \
57 static void setShapeClass(const std::string& typeID, const std::string& shapeClass); \
58 static void setWidth(const std::string& typeID, double width); \
59 static void setHeight(const std::string& typeID, double height); \
60 static void setMinGap(const std::string& typeID, double minGap); \
61 static void setAccel(const std::string& typeID, double accel); \
62 static void setDecel(const std::string& typeID, double decel); \
63 static void setEmergencyDecel(const std::string& typeID, double decel); \
64 static void setApparentDecel(const std::string& typeID, double decel); \
65 static void setImperfection(const std::string& typeID, double imperfection); \
66 static void setTau(const std::string& typeID, double tau); \
67 static void setColor(const std::string& typeID, const libsumo::TraCIColor& color); \
68 static void setMinGapLat(const std::string& typeID, double minGapLat); \
69 static void setMaxSpeedLat(const std::string& typeID, double speed); \
70 static void setLateralAlignment(const std::string& typeID, const std::string& latAlignment); \
71 static void setActionStepLength(const std::string& typeID, double actionStepLength, bool resetActionOffset=true);
72 
73 // ===========================================================================
74 // class declarations
75 // ===========================================================================
76 #ifndef LIBTRACI
77 class MSVehicleType;
78 namespace libsumo {
79 class VariableWrapper;
80 }
81 #endif
82 
83 
84 // ===========================================================================
85 // class definitions
86 // ===========================================================================
91 namespace LIBSUMO_NAMESPACE {
92 class VehicleType {
93 public:
96 
98  static void copy(const std::string& origTypeID, const std::string& newTypeID);
99 
100  static void setSpeedDeviation(const std::string& typeID, double deviation);
101 
103 
104 #ifndef LIBTRACI
105  static MSVehicleType* getVType(std::string id);
106 
107  static std::shared_ptr<VariableWrapper> makeWrapper();
108 
109  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper);
110 
111  static bool handleVariableWithID(const std::string& objID, const std::string& typeID, const int variable, VariableWrapper* wrapper);
112 
113 private:
116 
117 #endif
118 
119 private:
121  VehicleType() = delete;
122 };
123 
124 
125 }
#define LIBSUMO_ID_PARAMETER_API
Definition: TraCIDefs.h:97
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:44
#define LIBSUMO_VEHICLE_TYPE_GETTER
Definition: VehicleType.h:27
#define LIBSUMO_VEHICLE_TYPE_SETTER
Definition: VehicleType.h:51
VehicleType()=delete
invalidated standard constructor
static void setSpeedDeviation(const std::string &typeID, double deviation)
static bool handleVariableWithID(const std::string &objID, const std::string &typeID, const int variable, VariableWrapper *wrapper)
static std::shared_ptr< VariableWrapper > makeWrapper()
static LIBSUMO_SUBSCRIPTION_API MSVehicleType * getVType(std::string id)
static SubscriptionResults mySubscriptionResults
Definition: VehicleType.h:114
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
LIBSUMO_VEHICLE_TYPE_GETTER LIBSUMO_ID_PARAMETER_API static LIBSUMO_VEHICLE_TYPE_SETTER void copy(const std::string &origTypeID, const std::string &newTypeID)
static ContextSubscriptionResults myContextSubscriptionResults
Definition: VehicleType.h:115
The car-following model and parameter.
Definition: MSVehicleType.h:62
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:250
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:251