Eclipse SUMO - Simulation of Urban MObility
InductionLoop.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-2024 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 #pragma once
21 #include <string>
22 #include <vector>
23 #include <libsumo/TraCIDefs.h>
24 
25 
26 // ===========================================================================
27 // class declarations
28 // ===========================================================================
29 #ifndef LIBTRACI
30 class NamedRTree;
31 class MSInductLoop;
32 class MEInductLoop;
33 class PositionVector;
34 #endif
35 
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
44 namespace LIBSUMO_NAMESPACE {
46 public:
47  static double getPosition(const std::string& loopID);
48  static std::string getLaneID(const std::string& loopID);
49  static int getLastStepVehicleNumber(const std::string& loopID);
50  static double getLastStepMeanSpeed(const std::string& loopID);
51  static std::vector<std::string> getLastStepVehicleIDs(const std::string& loopID);
52  static double getLastStepOccupancy(const std::string& loopID);
53  static double getLastStepMeanLength(const std::string& loopID);
54  static double getTimeSinceDetection(const std::string& loopID);
55  static std::vector<libsumo::TraCIVehicleData> getVehicleData(const std::string& loopID);
56 
57  static double getIntervalOccupancy(const std::string& loopID);
58  static double getIntervalMeanSpeed(const std::string& loopID);
59  static int getIntervalVehicleNumber(const std::string& loopID);
60  static std::vector<std::string> getIntervalVehicleIDs(const std::string& loopID);
61 
62  static double getLastIntervalOccupancy(const std::string& loopID);
63  static double getLastIntervalMeanSpeed(const std::string& loopID);
64  static int getLastIntervalVehicleNumber(const std::string& loopID);
65  static std::vector<std::string> getLastIntervalVehicleIDs(const std::string& loopID);
66 
67  static void overrideTimeSinceDetection(const std::string& loopID, double time);
68 
71 
72 #ifndef LIBTRACI
73 #ifndef SWIG
77  static NamedRTree* getTree();
78  static void cleanup();
79 
84  static void storeShape(const std::string& id, PositionVector& shape);
85 
86  static std::shared_ptr<VariableWrapper> makeWrapper();
87 
88  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData);
89 
90 private:
91  static MSInductLoop* getDetector(const std::string& loopID);
92  static MEInductLoop* getMEDetector(const std::string& loopID);
93 
94 private:
97  static NamedRTree* myTree;
98 #endif
99 #endif
100 
101 private:
103  InductionLoop() = delete;
104 
105 };
106 }
#define LIBSUMO_ID_PARAMETER_API
Definition: TraCIDefs.h:116
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:62
static std::string getLaneID(const std::string &loopID)
static ContextSubscriptionResults myContextSubscriptionResults
Definition: InductionLoop.h:96
static std::vector< std::string > getLastIntervalVehicleIDs(const std::string &loopID)
static std::shared_ptr< VariableWrapper > makeWrapper()
static std::vector< std::string > getIntervalVehicleIDs(const std::string &loopID)
static SubscriptionResults mySubscriptionResults
Definition: InductionLoop.h:95
static int getIntervalVehicleNumber(const std::string &loopID)
InductionLoop()=delete
invalidated standard constructor
static MEInductLoop * getMEDetector(const std::string &loopID)
static void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
static double getLastIntervalOccupancy(const std::string &loopID)
static MSInductLoop * getDetector(const std::string &loopID)
static double getTimeSinceDetection(const std::string &loopID)
static std::vector< std::string > getLastStepVehicleIDs(const std::string &loopID)
static double getLastStepOccupancy(const std::string &loopID)
static std::vector< libsumo::TraCIVehicleData > getVehicleData(const std::string &loopID)
static int getLastStepVehicleNumber(const std::string &loopID)
static double getLastStepMeanSpeed(const std::string &loopID)
LIBSUMO_ID_PARAMETER_API static LIBSUMO_SUBSCRIPTION_API NamedRTree * getTree()
Returns a tree filled with inductive loop instances.
static double getLastIntervalMeanSpeed(const std::string &loopID)
static void overrideTimeSinceDetection(const std::string &loopID, double time)
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper, tcpip::Storage *paramData)
static double getLastStepMeanLength(const std::string &loopID)
static double getIntervalOccupancy(const std::string &loopID)
static double getPosition(const std::string &loopID)
static int getLastIntervalVehicleNumber(const std::string &loopID)
static double getIntervalMeanSpeed(const std::string &loopID)
An induction loop for mesoscopic simulation.
Definition: MEInductLoop.h:45
An unextended detector measuring at a fixed position on a fixed lane.
Definition: MSInductLoop.h:63
A RT-tree for efficient storing of SUMO's Named objects.
Definition: NamedRTree.h:61
A list of positions.
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