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-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 #pragma once
21 #include <config.h>
22 
23 #include <string>
24 #include <vector>
25 #include <libsumo/TraCIDefs.h>
26 
27 
28 // ===========================================================================
29 // class declarations
30 // ===========================================================================
31 #ifndef LIBTRACI
32 class NamedRTree;
33 class MSInductLoop;
34 class PositionVector;
35 namespace libsumo {
36 class VariableWrapper;
37 }
38 #endif
39 
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
48 namespace LIBSUMO_NAMESPACE {
50 public:
51  static double getPosition(const std::string& detID);
52  static std::string getLaneID(const std::string& detID);
53  static int getLastStepVehicleNumber(const std::string& detID);
54  static double getLastStepMeanSpeed(const std::string& detID);
55  static std::vector<std::string> getLastStepVehicleIDs(const std::string& detID);
56  static double getLastStepOccupancy(const std::string& detID);
57  static double getLastStepMeanLength(const std::string& detID);
58  static double getTimeSinceDetection(const std::string& detID);
59  static std::vector<libsumo::TraCIVehicleData> getVehicleData(const std::string& detID);
60 
63 
64 #ifndef LIBTRACI
68  static NamedRTree* getTree();
69  static void cleanup();
70 
75  static void storeShape(const std::string& id, PositionVector& shape);
76 
77  static std::shared_ptr<VariableWrapper> makeWrapper();
78 
79  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper);
80 
81 private:
82  static MSInductLoop* getDetector(const std::string& detID);
83 
84 private:
87  static NamedRTree* myTree;
88 #endif
89 
90 private:
92  InductionLoop() = delete;
93 
94 };
95 }
#define LIBSUMO_ID_PARAMETER_API
Definition: TraCIDefs.h:97
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:44
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
static double getLastStepMeanSpeed(const std::string &detID)
static ContextSubscriptionResults myContextSubscriptionResults
Definition: InductionLoop.h:86
static std::shared_ptr< VariableWrapper > makeWrapper()
static SubscriptionResults mySubscriptionResults
Definition: InductionLoop.h:85
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 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:60
A list of positions.
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:250
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:251