Skip to content

Commit

Permalink
checking network existence in libsumo fix #11215
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Nov 11, 2023
1 parent 70fc57e commit 07cd550
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/libsumo/Calibrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ ContextSubscriptionResults Calibrator::myContextSubscriptionResults;
// ===========================================================================
std::vector<std::string>
Calibrator::getIDList() {
MSNet::getInstance(); // just to check that we actually have a network
std::vector<std::string> ids;
for (auto& item : MSCalibrator::getInstances()) {
for (const auto& item : MSCalibrator::getInstances()) {
ids.push_back(item.first);
}
std::sort(ids.begin(), ids.end());
return ids;
}

Expand Down
1 change: 1 addition & 0 deletions src/libsumo/Edge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ ContextSubscriptionResults Edge::myContextSubscriptionResults;
// ===========================================================================
std::vector<std::string>
Edge::getIDList() {
MSNet::getInstance(); // just to check that we actually have a network
std::vector<std::string> ids;
MSEdge::insertIDs(ids);
return ids;
Expand Down
1 change: 1 addition & 0 deletions src/libsumo/Lane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ ContextSubscriptionResults Lane::myContextSubscriptionResults;
// ===========================================================================
std::vector<std::string>
Lane::getIDList() {
MSNet::getInstance(); // just to check that we actually have a network
std::vector<std::string> ids;
MSLane::insertIDs(ids);
return ids;
Expand Down
2 changes: 1 addition & 1 deletion src/libsumo/MeanData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ContextSubscriptionResults MeanData::myContextSubscriptionResults;
std::vector<std::string>
MeanData::getIDList() {
std::vector<std::string> ids;
for (auto item : MSNet::getInstance()->getDetectorControl().getMeanData()) {
for (const auto& item : MSNet::getInstance()->getDetectorControl().getMeanData()) {
ids.push_back(item.first);
}
std::sort(ids.begin(), ids.end());
Expand Down
3 changes: 1 addition & 2 deletions src/libsumo/POI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ NamedRTree* POI::myTree(nullptr);
std::vector<std::string>
POI::getIDList() {
std::vector<std::string> ids;
ShapeContainer& shapeCont = MSNet::getInstance()->getShapeContainer();
shapeCont.getPOIs().insertIDs(ids);
MSNet::getInstance()->getShapeContainer().getPOIs().insertIDs(ids);
return ids;
}

Expand Down
3 changes: 1 addition & 2 deletions src/libsumo/Polygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ NamedRTree* Polygon::myTree(nullptr);
std::vector<std::string>
Polygon::getIDList() {
std::vector<std::string> ids;
ShapeContainer& shapeCont = MSNet::getInstance()->getShapeContainer();
shapeCont.getPolygons().insertIDs(ids);
MSNet::getInstance()->getShapeContainer().getPolygons().insertIDs(ids);
return ids;
}

Expand Down
1 change: 1 addition & 0 deletions src/libsumo/Rerouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ContextSubscriptionResults Rerouter::myContextSubscriptionResults;
// ===========================================================================
std::vector<std::string>
Rerouter::getIDList() {
MSNet::getInstance(); // just to check that we actually have a network
std::vector<std::string> ids;
for (const auto& item : MSTriggeredRerouter::getInstances()) {
ids.push_back(item.first);
Expand Down
1 change: 1 addition & 0 deletions src/libsumo/Route.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ ContextSubscriptionResults Route::myContextSubscriptionResults;
// ===========================================================================
std::vector<std::string>
Route::getIDList() {
MSNet::getInstance(); // just to check that we actually have a network
std::vector<std::string> ids;
MSRoute::insertIDs(ids);
return ids;
Expand Down
2 changes: 1 addition & 1 deletion src/libsumo/VariableSpeedSign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ ContextSubscriptionResults VariableSpeedSign::myContextSubscriptionResults;
// ===========================================================================
std::vector<std::string>
VariableSpeedSign::getIDList() {
MSNet::getInstance(); // just to check that we actually have a network
std::vector<std::string> ids;
for (auto& item : MSLaneSpeedTrigger::getInstances()) {
ids.push_back(item.first);
}
std::sort(ids.begin(), ids.end());
return ids;
}

Expand Down

0 comments on commit 07cd550

Please sign in to comment.