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 /****************************************************************************/
15 // C++ TraCI client API implementation
16 /****************************************************************************/
17 #ifndef InductionLoop_h
18 #define InductionLoop_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <vector>
27 #include <libsumo/TraCIConstants.h>
28 
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 class NamedRTree;
34 class MSInductLoop;
35 class PositionVector;
36 namespace libsumo {
37 struct TraCIVehicleData;
38 class VariableWrapper;
39 }
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
49 namespace libsumo {
51 public:
52  static std::vector<std::string> getIDList();
53  static int getIDCount();
54  static double getPosition(const std::string& detID);
55  static std::string getLaneID(const std::string& detID);
56  static int getLastStepVehicleNumber(const std::string& detID);
57  static double getLastStepMeanSpeed(const std::string& detID);
58  static std::vector<std::string> getLastStepVehicleIDs(const std::string& detID);
59  static double getLastStepOccupancy(const std::string& detID);
60  static double getLastStepMeanLength(const std::string& detID);
61  static double getTimeSinceDetection(const std::string& detID);
62  static std::vector<libsumo::TraCIVehicleData> getVehicleData(const std::string& detID);
63 
65 
69  static NamedRTree* getTree();
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 
88 private:
90  InductionLoop() = delete;
91 
92 };
93 }
94 
95 
96 #endif
97 
98 /****************************************************************************/
libsumo::InductionLoop::InductionLoop
InductionLoop()=delete
invalidated standard constructor
LIBSUMO_SUBSCRIPTION_API
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:42
libsumo::InductionLoop::getDetector
static MSInductLoop * getDetector(const std::string &detID)
Definition: InductionLoop.cpp:127
libsumo::VariableWrapper
Definition: Subscription.h:114
libsumo::InductionLoop::getVehicleData
static std::vector< libsumo::TraCIVehicleData > getVehicleData(const std::string &detID)
Definition: InductionLoop.cpp:110
libsumo::InductionLoop::getLastStepVehicleIDs
static std::vector< std::string > getLastStepVehicleIDs(const std::string &detID)
Definition: InductionLoop.cpp:86
libsumo::InductionLoop::getLaneID
static std::string getLaneID(const std::string &detID)
Definition: InductionLoop.cpp:68
libsumo::ContextSubscriptionResults
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:205
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:55
PositionVector
A list of positions.
Definition: PositionVector.h:46
libsumo::InductionLoop::getLastStepOccupancy
static double getLastStepOccupancy(const std::string &detID)
Definition: InductionLoop.cpp:92
libsumo::InductionLoop::getPosition
static double getPosition(const std::string &detID)
Definition: InductionLoop.cpp:62
libsumo
Definition: Edge.cpp:30
libsumo::InductionLoop::myContextSubscriptionResults
static ContextSubscriptionResults myContextSubscriptionResults
Definition: InductionLoop.h:86
TraCIConstants.h
libsumo::InductionLoop::getLastStepMeanLength
static double getLastStepMeanLength(const std::string &detID)
Definition: InductionLoop.cpp:98
libsumo::InductionLoop::handleVariable
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
Definition: InductionLoop.cpp:167
libsumo::InductionLoop::getTree
static LIBSUMO_SUBSCRIPTION_API NamedRTree * getTree()
Returns a tree filled with inductive loop instances.
Definition: InductionLoop.cpp:140
libsumo::InductionLoop::mySubscriptionResults
static SubscriptionResults mySubscriptionResults
Definition: InductionLoop.h:85
NamedRTree
A RT-tree for efficient storing of SUMO's Named objects.
Definition: NamedRTree.h:64
libsumo::InductionLoop::getIDList
static std::vector< std::string > getIDList()
Definition: InductionLoop.cpp:47
config.h
libsumo::InductionLoop::getLastStepVehicleNumber
static int getLastStepVehicleNumber(const std::string &detID)
Definition: InductionLoop.cpp:74
libsumo::InductionLoop::makeWrapper
static std::shared_ptr< VariableWrapper > makeWrapper()
Definition: InductionLoop.cpp:161
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:154
libsumo::InductionLoop::getLastStepMeanSpeed
static double getLastStepMeanSpeed(const std::string &detID)
Definition: InductionLoop.cpp:80
libsumo::SubscriptionResults
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:204
libsumo::InductionLoop
Definition: InductionLoop.h:50
libsumo::InductionLoop::getTimeSinceDetection
static double getTimeSinceDetection(const std::string &detID)
Definition: InductionLoop.cpp:104