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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
14 // C++ TraCI client API implementation
15 /****************************************************************************/
16 #ifndef InductionLoop_h
17 #define InductionLoop_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <vector>
26 #include <libsumo/TraCIConstants.h>
27 
28 
29 // ===========================================================================
30 // class declarations
31 // ===========================================================================
32 class NamedRTree;
33 class MSInductLoop;
34 class PositionVector;
35 namespace libsumo {
36 struct TraCIVehicleData;
37 class VariableWrapper;
38 }
39 
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
48 namespace libsumo {
50 public:
51  static std::vector<std::string> getIDList();
52  static int getIDCount();
53  static double getPosition(const std::string& detID);
54  static std::string getLaneID(const std::string& detID);
55  static int getLastStepVehicleNumber(const std::string& detID);
56  static double getLastStepMeanSpeed(const std::string& detID);
57  static std::vector<std::string> getLastStepVehicleIDs(const std::string& detID);
58  static double getLastStepOccupancy(const std::string& detID);
59  static double getLastStepMeanLength(const std::string& detID);
60  static double getTimeSinceDetection(const std::string& detID);
61  static std::vector<libsumo::TraCIVehicleData> getVehicleData(const std::string& detID);
62 
64 
68  static NamedRTree* getTree();
69 
74  static void storeShape(const std::string& id, PositionVector& shape);
75 
76  static std::shared_ptr<VariableWrapper> makeWrapper();
77 
78  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper);
79 
80 private:
81  static MSInductLoop* getDetector(const std::string& detID);
82 
83 private:
86 
87 private:
89  InductionLoop() = delete;
90 
91 };
92 }
93 
94 
95 #endif
96 
97 /****************************************************************************/
libsumo::InductionLoop::InductionLoop
InductionLoop()=delete
invalidated standard constructor
LIBSUMO_SUBSCRIPTION_API
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:41
libsumo::InductionLoop::getDetector
static MSInductLoop * getDetector(const std::string &detID)
Definition: InductionLoop.cpp:126
libsumo::VariableWrapper
Definition: Subscription.h:132
libsumo::InductionLoop::getVehicleData
static std::vector< libsumo::TraCIVehicleData > getVehicleData(const std::string &detID)
Definition: InductionLoop.cpp:109
libsumo::InductionLoop::getLastStepVehicleIDs
static std::vector< std::string > getLastStepVehicleIDs(const std::string &detID)
Definition: InductionLoop.cpp:85
libsumo::InductionLoop::getLaneID
static std::string getLaneID(const std::string &detID)
Definition: InductionLoop.cpp:67
libsumo::ContextSubscriptionResults
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:204
MSInductLoop
An unextended detector measuring at a fixed position on a fixed lane.
Definition: MSInductLoop.h:64
libsumo::InductionLoop::getIDCount
static int getIDCount()
Definition: InductionLoop.cpp:54
PositionVector
A list of positions.
Definition: PositionVector.h:45
libsumo::InductionLoop::getLastStepOccupancy
static double getLastStepOccupancy(const std::string &detID)
Definition: InductionLoop.cpp:91
libsumo::InductionLoop::getPosition
static double getPosition(const std::string &detID)
Definition: InductionLoop.cpp:61
libsumo
Definition: Edge.cpp:29
libsumo::InductionLoop::myContextSubscriptionResults
static ContextSubscriptionResults myContextSubscriptionResults
Definition: InductionLoop.h:85
TraCIConstants.h
libsumo::InductionLoop::getLastStepMeanLength
static double getLastStepMeanLength(const std::string &detID)
Definition: InductionLoop.cpp:97
libsumo::InductionLoop::handleVariable
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
Definition: InductionLoop.cpp:166
libsumo::InductionLoop::getTree
static LIBSUMO_SUBSCRIPTION_API NamedRTree * getTree()
Returns a tree filled with inductive loop instances.
Definition: InductionLoop.cpp:139
libsumo::InductionLoop::mySubscriptionResults
static SubscriptionResults mySubscriptionResults
Definition: InductionLoop.h:84
NamedRTree
A RT-tree for efficient storing of SUMO's Named objects.
Definition: NamedRTree.h:63
libsumo::InductionLoop::getIDList
static std::vector< std::string > getIDList()
Definition: InductionLoop.cpp:46
config.h
libsumo::InductionLoop::getLastStepVehicleNumber
static int getLastStepVehicleNumber(const std::string &detID)
Definition: InductionLoop.cpp:73
libsumo::InductionLoop::makeWrapper
static std::shared_ptr< VariableWrapper > makeWrapper()
Definition: InductionLoop.cpp:160
libsumo::InductionLoop::storeShape
static void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
Definition: InductionLoop.cpp:153
libsumo::InductionLoop::getLastStepMeanSpeed
static double getLastStepMeanSpeed(const std::string &detID)
Definition: InductionLoop.cpp:79
libsumo::SubscriptionResults
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:203
libsumo::InductionLoop
Definition: InductionLoop.h:49
libsumo::InductionLoop::getTimeSinceDetection
static double getTimeSinceDetection(const std::string &detID)
Definition: InductionLoop.cpp:103