44std::vector<std::string>
45MultiEntryExit::getIDList() {
46 std::vector<std::string> ids;
53MultiEntryExit::getIDCount() {
58std::vector<std::string>
59MultiEntryExit::getEntryLanes(
const std::string& detID) {
60 std::vector<std::string> ids;
61 for (
const MSCrossSection& cs : getDetector(detID)->getEntries()) {
62 ids.push_back(cs.myLane->getID());
68std::vector<std::string>
69MultiEntryExit::getExitLanes(
const std::string& detID) {
70 std::vector<std::string> ids;
72 ids.push_back(cs.myLane->getID());
79MultiEntryExit::getEntryPositions(
const std::string& detID) {
80 std::vector<double> pos;
81 for (
const MSCrossSection& cs : getDetector(detID)->getEntries()) {
82 pos.push_back(cs.myPosition);
89MultiEntryExit::getExitPositions(
const std::string& detID) {
90 std::vector<double> pos;
92 pos.push_back(cs.myPosition);
99MultiEntryExit::getLastStepVehicleNumber(
const std::string& detID) {
100 return getDetector(detID)->getVehiclesWithin();
105MultiEntryExit::getLastStepMeanSpeed(
const std::string& detID) {
106 return getDetector(detID)->getCurrentMeanSpeed();
110std::vector<std::string>
111MultiEntryExit::getLastStepVehicleIDs(
const std::string& detID) {
112 return getDetector(detID)->getCurrentVehicleIDs();
117MultiEntryExit::getLastStepHaltingNumber(
const std::string& detID) {
118 return getDetector(detID)->getCurrentHaltingNumber();
123MultiEntryExit::getLastIntervalMeanTravelTime(
const std::string& detID) {
124 return getDetector(detID)->getLastIntervalMeanTravelTime();
129MultiEntryExit::getLastIntervalMeanHaltsPerVehicle(
const std::string& detID) {
130 return getDetector(detID)->getLastIntervalMeanHaltsPerVehicle();
135MultiEntryExit::getLastIntervalMeanTimeLoss(
const std::string& detID) {
136 return getDetector(detID)->getLastIntervalMeanTimeLoss();
141MultiEntryExit::getLastIntervalVehicleSum(
const std::string& detID) {
142 return getDetector(detID)->getLastIntervalVehicleSum();
147MultiEntryExit::getParameter(
const std::string& detID,
const std::string& param) {
148 return getDetector(detID)->getParameter(param,
"");
156MultiEntryExit::setParameter(
const std::string& detID,
const std::string& name,
const std::string& value) {
157 getDetector(detID)->setParameter(name, value);
165MultiEntryExit::getDetector(
const std::string&
id) {
168 throw TraCIException(
"Multi entry exit detector '" +
id +
"' is not known");
174std::shared_ptr<VariableWrapper>
175MultiEntryExit::makeWrapper() {
176 return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
181MultiEntryExit::handleVariable(
const std::string& objID,
const int variable, VariableWrapper* wrapper,
tcpip::Storage* paramData) {
184 return wrapper->wrapStringList(objID, variable, getIDList());
186 return wrapper->wrapInt(objID, variable, getIDCount());
188 return wrapper->wrapInt(objID, variable, getLastStepVehicleNumber(objID));
190 return wrapper->wrapDouble(objID, variable, getLastStepMeanSpeed(objID));
192 return wrapper->wrapStringList(objID, variable, getLastStepVehicleIDs(objID));
194 return wrapper->wrapInt(objID, variable, getLastStepHaltingNumber(objID));
196 return wrapper->wrapDouble(objID, variable, getLastIntervalMeanTravelTime(objID));
198 return wrapper->wrapDouble(objID, variable, getLastIntervalMeanHaltsPerVehicle(objID));
200 return wrapper->wrapDouble(objID, variable, getLastIntervalMeanTimeLoss(objID));
202 return wrapper->wrapInt(objID, variable, getLastIntervalVehicleSum(objID));
204 return wrapper->wrapStringList(objID, variable, getEntryLanes(objID));
206 return wrapper->wrapStringList(objID, variable, getExitLanes(objID));
208 return wrapper->wrapDoubleList(objID, variable, getEntryPositions(objID));
210 return wrapper->wrapDoubleList(objID, variable, getExitPositions(objID));
213 return wrapper->wrapString(objID, variable, getParameter(objID, paramData->
readString()));
216 return wrapper->wrapStringPair(objID, variable, getParameterWithKey(objID, paramData->
readString()));
@ SUMO_TAG_ENTRY_EXIT_DETECTOR
alternative tag for e3 detector
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOM)
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
A simple description of a position on a lane (crossing of a lane)
const NamedObjectCont< MSDetectorFileOutput * > & getTypedDetectors(SumoXMLTag type) const
Returns the list of detectors of the given type.
A detector of vehicles passing an area between entry/exit points.
MSDetectorControl & getDetectorControl()
Returns the detector control.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
C++ TraCI client API implementation.
T get(const std::string &id) const
Retrieves an item.
void insertIDs(std::vector< std::string > &into) const
int size() const
Returns the number of stored items within the container.
virtual std::string readString()
virtual int readUnsignedByte()
TRACI_CONST int VAR_LAST_INTERVAL_TRAVELTIME
TRACI_CONST int LAST_STEP_VEHICLE_ID_LIST
TRACI_CONST int VAR_EXIT_POSITIONS
TRACI_CONST int LAST_STEP_VEHICLE_NUMBER
TRACI_CONST int TRACI_ID_LIST
TRACI_CONST int VAR_LANES
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
TRACI_CONST int VAR_TIMELOSS
TRACI_CONST int VAR_POSITION
TRACI_CONST int LAST_STEP_MEAN_SPEED
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
TRACI_CONST int LAST_STEP_VEHICLE_HALTING_NUMBER
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int VAR_EXIT_LANES
TRACI_CONST int VAR_LAST_INTERVAL_VEHICLE_NUMBER
TRACI_CONST int VAR_PARAMETER_WITH_KEY
TRACI_CONST int VAR_LAST_INTERVAL_MEAN_HALTING_NUMBER