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.dev/sumo
3// Copyright (C) 2017-2023 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>
25
26
27#define LIBSUMO_VEHICLE_TYPE_GETTER \
28static double getLength(const std::string& typeID); \
29static double getMaxSpeed(const std::string& typeID); \
30static std::string getVehicleClass(const std::string& typeID); \
31static double getSpeedFactor(const std::string& typeID); \
32static double getAccel(const std::string& typeID); \
33static double getDecel(const std::string& typeID); \
34static double getEmergencyDecel(const std::string& typeID); \
35static double getApparentDecel(const std::string& typeID); \
36static double getImperfection(const std::string& typeID); \
37static double getTau(const std::string& typeID); \
38static std::string getEmissionClass(const std::string& typeID); \
39static std::string getShapeClass(const std::string& typeID); \
40static double getMinGap(const std::string& typeID); \
41static double getWidth(const std::string& typeID); \
42static double getHeight(const std::string& typeID); \
43static libsumo::TraCIColor getColor(const std::string& typeID); \
44static double getMinGapLat(const std::string& typeID); \
45static double getMaxSpeedLat(const std::string& typeID); \
46static std::string getLateralAlignment(const std::string& typeID); \
47static int getPersonCapacity(const std::string& typeID); \
48static double getActionStepLength(const std::string& typeID); \
49\
50static double getSpeedDeviation(const std::string& typeID); \
51static double getBoardingDuration(const std::string& typeID); \
52static double getImpatience(const std::string& typeID); \
53
54
55#define LIBSUMO_VEHICLE_TYPE_SETTER \
56static void setLength(const std::string& typeID, double length); \
57static void setMaxSpeed(const std::string& typeID, double speed); \
58static void setVehicleClass(const std::string& typeID, const std::string& clazz); \
59static void setSpeedFactor(const std::string& typeID, double factor); \
60static void setAccel(const std::string& typeID, double accel); \
61static void setDecel(const std::string& typeID, double decel); \
62static void setEmergencyDecel(const std::string& typeID, double decel); \
63static void setApparentDecel(const std::string& typeID, double decel); \
64static void setImperfection(const std::string& typeID, double imperfection); \
65static void setTau(const std::string& typeID, double tau); \
66static void setEmissionClass(const std::string& typeID, const std::string& clazz); \
67static void setShapeClass(const std::string& typeID, const std::string& shapeClass); \
68static void setWidth(const std::string& typeID, double width); \
69static void setHeight(const std::string& typeID, double height); \
70static void setColor(const std::string& typeID, const libsumo::TraCIColor& color); \
71static void setMinGap(const std::string& typeID, double minGap); \
72static void setMinGapLat(const std::string& typeID, double minGapLat); \
73static void setMaxSpeedLat(const std::string& typeID, double speed); \
74static void setLateralAlignment(const std::string& typeID, const std::string& latAlignment); \
75static void setActionStepLength(const std::string& typeID, double actionStepLength, bool resetActionOffset=true); \
76static void setBoardingDuration(const std::string& typeID, double boardingDuration); \
77static void setImpatience(const std::string& typeID, double impatience); \
78
79// ===========================================================================
80// class declarations
81// ===========================================================================
82#ifndef LIBTRACI
83class MSVehicleType;
84#endif
85
86
87// ===========================================================================
88// class definitions
89// ===========================================================================
94namespace LIBSUMO_NAMESPACE {
96public:
99
101 static void copy(const std::string& origTypeID, const std::string& newTypeID);
102
103 static void setSpeedDeviation(const std::string& typeID, double deviation);
104 static double getScale(const std::string& typeID);
105 static void setScale(const std::string& typeID, double value);
106
108
109#ifndef LIBTRACI
110#ifndef SWIG
111 static MSVehicleType* getVType(std::string id);
112
113 static std::shared_ptr<VariableWrapper> makeWrapper();
114
115 static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData);
116
117 static bool handleVariableWithID(const std::string& objID, const std::string& typeID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData);
118
119private:
122
123#endif
124#endif
125
126private:
128 VehicleType() = delete;
129};
130
131
132}
#define LIBSUMO_ID_PARAMETER_API
Definition: TraCIDefs.h:116
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:62
#define LIBSUMO_VEHICLE_TYPE_GETTER
Definition: VehicleType.h:27
#define LIBSUMO_VEHICLE_TYPE_SETTER
Definition: VehicleType.h:55
VehicleType()=delete
invalidated standard constructor
static void setSpeedDeviation(const std::string &typeID, double deviation)
static void setScale(const std::string &typeID, double value)
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper, tcpip::Storage *paramData)
static std::shared_ptr< VariableWrapper > makeWrapper()
static double getScale(const std::string &typeID)
static LIBSUMO_SUBSCRIPTION_API MSVehicleType * getVType(std::string id)
static SubscriptionResults mySubscriptionResults
Definition: VehicleType.h:120
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:121
static bool handleVariableWithID(const std::string &objID, const std::string &typeID, const int variable, VariableWrapper *wrapper, tcpip::Storage *paramData)
The car-following model and parameter.
Definition: MSVehicleType.h:63
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:338
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:337