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.org/sumo
3 // Copyright (C) 2017-2022 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 PositionVector;
33 #endif
34 
35 
36 // ===========================================================================
37 // class definitions
38 // ===========================================================================
43 namespace LIBSUMO_NAMESPACE {
45 public:
46  static double getPosition(const std::string& detID);
47  static std::string getLaneID(const std::string& detID);
48  static int getLastStepVehicleNumber(const std::string& detID);
49  static double getLastStepMeanSpeed(const std::string& detID);
50  static std::vector<std::string> getLastStepVehicleIDs(const std::string& detID);
51  static double getLastStepOccupancy(const std::string& detID);
52  static double getLastStepMeanLength(const std::string& detID);
53  static double getTimeSinceDetection(const std::string& detID);
54  static std::vector<libsumo::TraCIVehicleData> getVehicleData(const std::string& detID);
55 
58 
59 #ifndef LIBTRACI
60 #ifndef SWIG
64  static NamedRTree* getTree();
65  static void cleanup();
66 
71  static void storeShape(const std::string& id, PositionVector& shape);
72 
73  static std::shared_ptr<VariableWrapper> makeWrapper();
74 
75  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData);
76 
77 private:
78  static MSInductLoop* getDetector(const std::string& detID);
79 
80 private:
83  static NamedRTree* myTree;
84 #endif
85 #endif
86 
87 private:
89  InductionLoop() = delete;
90 
91 };
92 }
#define LIBSUMO_ID_PARAMETER_API
Definition: TraCIDefs.h:108
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:56
static double getLastStepMeanSpeed(const std::string &detID)
static ContextSubscriptionResults myContextSubscriptionResults
Definition: InductionLoop.h:82
static std::shared_ptr< VariableWrapper > makeWrapper()
static SubscriptionResults mySubscriptionResults
Definition: InductionLoop.h:81
InductionLoop()=delete
invalidated standard constructor
static double getPosition(const std::string &detID)
static double getLastStepOccupancy(const std::string &detID)
static void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
static MSInductLoop * getDetector(const std::string &detID)
static double getTimeSinceDetection(const std::string &detID)
static double getLastStepMeanLength(const std::string &detID)
static std::vector< libsumo::TraCIVehicleData > getVehicleData(const std::string &detID)
LIBSUMO_ID_PARAMETER_API static LIBSUMO_SUBSCRIPTION_API NamedRTree * getTree()
Returns a tree filled with inductive loop instances.
static int getLastStepVehicleNumber(const std::string &detID)
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper, tcpip::Storage *paramData)
static std::string getLaneID(const std::string &detID)
static std::vector< std::string > getLastStepVehicleIDs(const std::string &detID)
An unextended detector measuring at a fixed position on a fixed lane.
Definition: MSInductLoop.h:62
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:279
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:278