SUMO - Simulation of Urban MObility
TraCI_MultiEntryExit.cpp
Go to the documentation of this file.
1 /****************************************************************************/
10 // C++ TraCI client API implementation
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
36 #include <microsim/MSNet.h>
37 #include <traci-server/TraCIDefs.h>
38 #include "TraCI_MultiEntryExit.h"
39 
40 
41 // ===========================================================================
42 // member definitions
43 // ===========================================================================
44 std::vector<std::string>
46  std::vector<std::string> ids;
48  return ids;
49 }
50 
51 
52 int
54  std::vector<std::string> ids;
56 }
57 
58 
59 int
61  return getDetector(detID)->getVehiclesWithin();
62 }
63 
64 
65 double
66 TraCI_MultiEntryExit::getLastStepMeanSpeed(const std::string& detID) {
67  return getDetector(detID)->getCurrentMeanSpeed();
68 }
69 
70 
71 std::vector<std::string>
73  return getDetector(detID)->getCurrentVehicleIDs();
74 }
75 
76 
77 int
79  return getDetector(detID)->getCurrentHaltingNumber();
80 }
81 
82 
84 TraCI_MultiEntryExit::getDetector(const std::string& id) {
86  if (e3 == 0) {
87  throw TraCIException("Multi entry exit detector '" + id + "' is not known");
88  }
89  return e3;
90 }
91 
92 
93 /****************************************************************************/
static std::vector< std::string > getIDList()
int getCurrentHaltingNumber() const
Returns the number of current haltings within the area.
int size() const
Returns the number of items within the container.
static MSE3Collector * getDetector(const std::string &detID)
T get(const std::string &id) const
Retrieves an item.
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:158
std::vector< std::string > getCurrentVehicleIDs() const
Returns the number of vehicles within the area.
static int getLastStepVehicleNumber(const std::string &detID)
void insertIDs(std::vector< std::string > &into) const
static int getLastStepHaltingNumber(const std::string &detID)
static int getIDCount()
double getCurrentMeanSpeed() const
Returns the mean speed within the area.
MSDetectorControl & getDetectorControl()
Returns the detector control.
Definition: MSNet.h:373
A detector of vehicles passing an area between entry/exit points.
Definition: MSE3Collector.h:65
int getVehiclesWithin() const
Returns the number of vehicles within the area.
const NamedObjectCont< MSDetectorFileOutput * > & getTypedDetectors(SumoXMLTag type) const
Returns the list of detectors of the given type.
static double getLastStepMeanSpeed(const std::string &detID)
alternative tag for e3 detector