SUMO - Simulation of Urban MObility
TraCI_MultiEntryExit.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2012-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
20 // C++ TraCI client API implementation
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
35 #include <microsim/MSNet.h>
36 #include <traci-server/TraCIDefs.h>
37 #include "TraCI_MultiEntryExit.h"
38 
39 
40 // ===========================================================================
41 // member definitions
42 // ===========================================================================
43 std::vector<std::string>
45  std::vector<std::string> ids;
47  return ids;
48 }
49 
50 
51 int
53  std::vector<std::string> ids;
55 }
56 
57 
58 int
60  return getDetector(detID)->getVehiclesWithin();
61 }
62 
63 
64 double
65 TraCI_MultiEntryExit::getLastStepMeanSpeed(const std::string& detID) {
66  return getDetector(detID)->getCurrentMeanSpeed();
67 }
68 
69 
70 std::vector<std::string>
72  return getDetector(detID)->getCurrentVehicleIDs();
73 }
74 
75 
76 int
78  return getDetector(detID)->getCurrentHaltingNumber();
79 }
80 
81 
83 TraCI_MultiEntryExit::getDetector(const std::string& id) {
85  if (e3 == 0) {
86  throw TraCIException("Multi entry exit detector '" + id + "' is not known");
87  }
88  return e3;
89 }
90 
91 
92 /****************************************************************************/
static std::vector< std::string > getIDList()
static MSE3Collector * getDetector(const std::string &detID)
static std::vector< std::string > getLastStepVehicleIDs(const std::string &detID)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
static int getLastStepVehicleNumber(const std::string &detID)
static int getLastStepHaltingNumber(const std::string &detID)
T get(const std::string &id) const
Retrieves an item.
const NamedObjectCont< MSDetectorFileOutput * > & getTypedDetectors(SumoXMLTag type) const
Returns the list of detectors of the given type.
double getCurrentMeanSpeed() const
Returns the mean speed within the area.
static int getIDCount()
void insertIDs(std::vector< std::string > &into) const
int getVehiclesWithin() const
Returns the number of vehicles within the area.
MSDetectorControl & getDetectorControl()
Returns the detector control.
Definition: MSNet.h:369
A detector of vehicles passing an area between entry/exit points.
Definition: MSE3Collector.h:64
int getCurrentHaltingNumber() const
Returns the number of current haltings within the area.
static double getLastStepMeanSpeed(const std::string &detID)
alternative tag for e3 detector
std::vector< std::string > getCurrentVehicleIDs() const
Returns the number of vehicles within the area.
int size() const
Returns the number of stored items within the container.