From 8a04be1e8decf6df9c677929ad255b11c8edfe25 Mon Sep 17 00:00:00 2001 From: warrior-graph Date: Wed, 15 Aug 2018 10:05:45 -0300 Subject: [PATCH] New package: sumo-0.32.0 --- .../0001-Rework-the-ComparatorIdLess.patch | 335 ++++++++++++++++++ srcpkgs/sumo/template | 13 + 2 files changed, 348 insertions(+) create mode 100644 srcpkgs/sumo/patches/0001-Rework-the-ComparatorIdLess.patch create mode 100644 srcpkgs/sumo/template diff --git a/srcpkgs/sumo/patches/0001-Rework-the-ComparatorIdLess.patch b/srcpkgs/sumo/patches/0001-Rework-the-ComparatorIdLess.patch new file mode 100644 index 0000000000..c72d90f4fe --- /dev/null +++ b/srcpkgs/sumo/patches/0001-Rework-the-ComparatorIdLess.patch @@ -0,0 +1,335 @@ +From 59ee8a9c8bceb09fa4e90234e823d8004da7211f Mon Sep 17 00:00:00 2001 +From: Max Schettler +Date: Tue, 29 May 2018 14:08:48 +0200 +Subject: [PATCH] Rework the ComparatorIdLess + +This makes it compile with current compilers (GCC >= 8, Clang >= 6). +Fixes #4110. + +Signed-off-by: Max Schettler +--- + src/jtrrouter/ROJTREdge.h | 2 +- + src/microsim/MSEdgeControl.cpp | 2 +- + src/microsim/MSEdgeControl.h | 2 +- + src/microsim/MSLane.cpp | 8 +++--- + src/microsim/MSLane.h | 4 +-- + src/microsim/MSLink.h | 4 +-- + src/microsim/devices/MSDevice_Tripinfo.h | 2 +- + src/microsim/devices/MSDevice_Vehroutes.cpp | 2 +- + src/microsim/devices/MSDevice_Vehroutes.h | 2 +- + src/microsim/traffic_lights/MSRailSignal.cpp | 2 +- + src/netbuild/NBAlgorithms_Ramps.cpp | 8 +++--- + src/netbuild/NBEdgeCont.cpp | 4 +-- + src/netbuild/NBNodeCont.cpp | 4 +-- + src/utils/common/Named.h | 28 +++++++------------- + src/utils/vehicle/SUMOVehicle.h | 3 --- + 15 files changed, 33 insertions(+), 44 deletions(-) + +diff --git src/jtrrouter/ROJTREdge.h src/jtrrouter/ROJTREdge.h +index dbaf9508bb..ec8a63759e 100644 +--- src/jtrrouter/ROJTREdge.h ++++ src/jtrrouter/ROJTREdge.h +@@ -111,7 +111,7 @@ public: + + private: + /// @brief Definition of a map that stores the probabilities of using a certain follower over time +- typedef std::map*, Named::ComparatorIdLess> FollowerUsageCont; ++ typedef std::map*, ComparatorIdLess> FollowerUsageCont; + + /// @brief Storage for the probabilities of using a certain follower over time + FollowerUsageCont myFollowingDefs; +diff --git src/microsim/MSEdgeControl.cpp src/microsim/MSEdgeControl.cpp +index 34beb8cf96..b7eca6df46 100644 +--- src/microsim/MSEdgeControl.cpp ++++ src/microsim/MSEdgeControl.cpp +@@ -77,7 +77,7 @@ MSEdgeControl::~MSEdgeControl() { + + void + MSEdgeControl::patchActiveLanes() { +- for (std::set::iterator i = myChangedStateLanes.begin(); i != myChangedStateLanes.end(); ++i) { ++ for (std::set::iterator i = myChangedStateLanes.begin(); i != myChangedStateLanes.end(); ++i) { + LaneUsage& lu = myLanes[(*i)->getNumericalID()]; + // if the lane was inactive but is now... + if (!lu.amActive && (*i)->getVehicleNumber() > 0) { +diff --git src/microsim/MSEdgeControl.h src/microsim/MSEdgeControl.h +index 64536fe25b..aeb570bc27 100644 +--- src/microsim/MSEdgeControl.h ++++ src/microsim/MSEdgeControl.h +@@ -220,7 +220,7 @@ private: + std::vector myWithVehicles2Integrate; + + /// @brief Lanes which changed the state without informing the control +- std::set myChangedStateLanes; ++ std::set myChangedStateLanes; + + /// @brief The list of active (not empty) lanes + std::vector myLastLaneChange; +diff --git src/microsim/MSLane.cpp src/microsim/MSLane.cpp +index 7edb512c0f..258152c83b 100644 +--- src/microsim/MSLane.cpp ++++ src/microsim/MSLane.cpp +@@ -1172,7 +1172,7 @@ MSLane::detectCollisions(SUMOTime timestep, const std::string& stage) { + if (myVehicles.size() == 0 || myCollisionAction == COLLISION_ACTION_NONE) { + return; + } +- std::set toRemove; ++ std::set toRemove; + std::set toTeleport; + if (MSGlobals::gLateralResolution <= 0 && MSGlobals::gLaneChangeDuration <= 0) { + // no sublanes +@@ -1304,7 +1304,7 @@ MSLane::detectCollisions(SUMOTime timestep, const std::string& stage) { + } + + +- for (std::set::iterator it = toRemove.begin(); it != toRemove.end(); ++it) { ++ for (std::set::iterator it = toRemove.begin(); it != toRemove.end(); ++it) { + MSVehicle* veh = const_cast(*it); + MSLane* vehLane = veh->getLane(); + vehLane->removeVehicle(veh, MSMoveReminder::NOTIFICATION_TELEPORT, false); +@@ -1353,7 +1353,7 @@ MSLane::detectPedestrianJunctionCollision(const MSVehicle* collider, const Posit + + bool + MSLane::detectCollisionBetween(SUMOTime timestep, const std::string& stage, MSVehicle* collider, MSVehicle* victim, +- std::set& toRemove, ++ std::set& toRemove, + std::set& toTeleport) const { + #ifndef NO_TRACI + if (myCollisionAction == COLLISION_ACTION_TELEPORT && ((victim->hasInfluencer() && victim->getInfluencer().isRemoteAffected(timestep)) || +@@ -1416,7 +1416,7 @@ MSLane::detectCollisionBetween(SUMOTime timestep, const std::string& stage, MSVe + + void + MSLane::handleCollisionBetween(SUMOTime timestep, const std::string& stage, MSVehicle* collider, MSVehicle* victim, +- double gap, double latGap, std::set& toRemove, ++ double gap, double latGap, std::set& toRemove, + std::set& toTeleport) const { + std::string prefix = "Vehicle '" + collider->getID() + "'; collision with vehicle '" + victim->getID() ; + if (myCollisionStopTime > 0) { +diff --git src/microsim/MSLane.h src/microsim/MSLane.h +index db97e5e93a..1eedbfddba 100644 +--- src/microsim/MSLane.h ++++ src/microsim/MSLane.h +@@ -1098,13 +1098,13 @@ protected: + + /// @brief detect whether there is a collision between the two vehicles + bool detectCollisionBetween(SUMOTime timestep, const std::string& stage, MSVehicle* collider, MSVehicle* victim, +- std::set& toRemove, ++ std::set& toRemove, + std::set& toTeleport) const; + + /// @brief take action upon collision + void handleCollisionBetween(SUMOTime timestep, const std::string& stage, MSVehicle* collider, MSVehicle* victim, + double gap, double latGap, +- std::set& toRemove, ++ std::set& toRemove, + std::set& toTeleport) const; + + /// @brief compute maximum braking distance on this lane +diff --git src/microsim/MSLink.h src/microsim/MSLink.h +index 97cf763f32..caeced9cd9 100644 +--- src/microsim/MSLink.h ++++ src/microsim/MSLink.h +@@ -204,7 +204,7 @@ public: + ApproachingVehicleInformation getApproaching(const SUMOVehicle* veh) const; + + /// @brief return all approaching vehicles +- const std::map& getApproaching() const { ++ const std::map& getApproaching() const { + return myApproachingVehicles; + } + +@@ -529,7 +529,7 @@ private: + /// @brief The lane approaching this link + MSLane* myLaneBefore; + +- std::map myApproachingVehicles; ++ std::map myApproachingVehicles; + std::set myBlockedFoeLinks; + + /// @brief The position within this respond +diff --git src/microsim/devices/MSDevice_Tripinfo.h src/microsim/devices/MSDevice_Tripinfo.h +index fb72281c66..886c1148b0 100644 +--- src/microsim/devices/MSDevice_Tripinfo.h ++++ src/microsim/devices/MSDevice_Tripinfo.h +@@ -228,7 +228,7 @@ private: + SUMOTime myMesoTimeLoss; + + /// @brief devices which may still need to produce output +- typedef std::set > DeviceSet; ++ typedef std::set DeviceSet; + + static DeviceSet myPendingOutput; + +diff --git src/microsim/devices/MSDevice_Vehroutes.cpp src/microsim/devices/MSDevice_Vehroutes.cpp +index a8d4901c85..43094b83c6 100644 +--- src/microsim/devices/MSDevice_Vehroutes.cpp ++++ src/microsim/devices/MSDevice_Vehroutes.cpp +@@ -384,7 +384,7 @@ MSDevice_Vehroutes::addRoute() { + + void + MSDevice_Vehroutes::generateOutputForUnfinished() { +- for (std::map >::const_iterator it = myStateListener.myDevices.begin(); ++ for (std::map::const_iterator it = myStateListener.myDevices.begin(); + it != myStateListener.myDevices.end(); ++it) { + if (it->first->hasDeparted()) { + it->second->writeOutput(false); +diff --git src/microsim/devices/MSDevice_Vehroutes.h src/microsim/devices/MSDevice_Vehroutes.h +index 4586587c0a..8121a406fa 100644 +--- src/microsim/devices/MSDevice_Vehroutes.h ++++ src/microsim/devices/MSDevice_Vehroutes.h +@@ -218,7 +218,7 @@ private: + void vehicleStateChanged(const SUMOVehicle* const vehicle, MSNet::VehicleState to); + + /// @brief A map for internal notification +- std::map myDevices; ++ std::map myDevices; + + }; + +diff --git src/microsim/traffic_lights/MSRailSignal.cpp src/microsim/traffic_lights/MSRailSignal.cpp +index 4506fe6495..45db95fd14 100644 +--- src/microsim/traffic_lights/MSRailSignal.cpp ++++ src/microsim/traffic_lights/MSRailSignal.cpp +@@ -215,7 +215,7 @@ MSRailSignal::getAppropriateState() { + std::map::iterator it = mySucceedingBlocksIncommingLinks.find(lane); + if (it != mySucceedingBlocksIncommingLinks.end()) { + const MSLink* inCommingLing = it->second; +- const std::map approaching = inCommingLing->getApproaching(); ++ const std::map approaching = inCommingLing->getApproaching(); + std::map::const_iterator apprIt = approaching.begin(); + for (; apprIt != approaching.end(); apprIt++) { + MSLink::ApproachingVehicleInformation info = apprIt->second; +diff --git src/netbuild/NBAlgorithms_Ramps.cpp src/netbuild/NBAlgorithms_Ramps.cpp +index 38a0e23dc1..b6c6cae2bd 100644 +--- src/netbuild/NBAlgorithms_Ramps.cpp ++++ src/netbuild/NBAlgorithms_Ramps.cpp +@@ -84,8 +84,8 @@ NBRampsComputer::computeRamps(NBNetBuilder& nb, OptionsCont& oc) { + NBDistrictCont& dc = nb.getDistrictCont(); + + // if an edge is part of two ramps, ordering is important +- std::set potOnRamps; +- std::set potOffRamps; ++ std::set potOnRamps; ++ std::set potOffRamps; + for (std::map::const_iterator i = nc.begin(); i != nc.end(); ++i) { + NBNode* cur = (*i).second; + if (mayNeedOnRamp(cur, minHighwaySpeed, maxRampSpeed, noramps)) { +@@ -95,10 +95,10 @@ NBRampsComputer::computeRamps(NBNetBuilder& nb, OptionsCont& oc) { + potOffRamps.insert(cur); + } + } +- for (std::set::const_iterator i = potOnRamps.begin(); i != potOnRamps.end(); ++i) { ++ for (std::set::const_iterator i = potOnRamps.begin(); i != potOnRamps.end(); ++i) { + buildOnRamp(*i, nc, ec, dc, rampLength, dontSplit); + } +- for (std::set::const_iterator i = potOffRamps.begin(); i != potOffRamps.end(); ++i) { ++ for (std::set::const_iterator i = potOffRamps.begin(); i != potOffRamps.end(); ++i) { + buildOffRamp(*i, nc, ec, dc, rampLength, dontSplit); + } + } +diff --git src/netbuild/NBEdgeCont.cpp src/netbuild/NBEdgeCont.cpp +index fb47bfeb30..67d97476fe 100644 +--- src/netbuild/NBEdgeCont.cpp ++++ src/netbuild/NBEdgeCont.cpp +@@ -1167,7 +1167,7 @@ NBEdgeCont::remapIDs(bool numericaIDs, bool reservedIDs) { + avoid.insert(avoid.end(), reserve.begin(), reserve.end()); + } + IDSupplier idSupplier("", avoid); +- std::set toChange; ++ std::set toChange; + for (EdgeCont::iterator it = myEdges.begin(); it != myEdges.end(); it++) { + if (numericaIDs) { + try { +@@ -1181,7 +1181,7 @@ NBEdgeCont::remapIDs(bool numericaIDs, bool reservedIDs) { + } + } + const bool origNames = OptionsCont::getOptions().getBool("output.original-names"); +- for (std::set::iterator it = toChange.begin(); it != toChange.end(); ++it) { ++ for (std::set::iterator it = toChange.begin(); it != toChange.end(); ++it) { + NBEdge* edge = *it; + myEdges.erase(edge->getID()); + if (origNames) { +diff --git src/netbuild/NBNodeCont.cpp src/netbuild/NBNodeCont.cpp +index b511e5a094..5768205f04 100644 +--- src/netbuild/NBNodeCont.cpp ++++ src/netbuild/NBNodeCont.cpp +@@ -1306,7 +1306,7 @@ NBNodeCont::remapIDs(bool numericaIDs, bool reservedIDs) { + avoid.insert(avoid.end(), reserve.begin(), reserve.end()); + } + IDSupplier idSupplier("", avoid); +- std::set toChange; ++ std::set toChange; + for (NodeCont::iterator it = myNodes.begin(); it != myNodes.end(); it++) { + if (numericaIDs) { + try { +@@ -1320,7 +1320,7 @@ NBNodeCont::remapIDs(bool numericaIDs, bool reservedIDs) { + } + } + const bool origNames = OptionsCont::getOptions().getBool("output.original-names"); +- for (std::set::iterator it = toChange.begin(); it != toChange.end(); ++it) { ++ for (std::set::iterator it = toChange.begin(); it != toChange.end(); ++it) { + NBNode* node = *it; + myNodes.erase(node->getID()); + if (origNames) { +diff --git src/utils/common/Named.h src/utils/common/Named.h +index c88d96700c..3b01bd1b9d 100644 +--- src/utils/common/Named.h ++++ src/utils/common/Named.h +@@ -35,6 +35,16 @@ + #include + + ++/// @brief Function-object for stable sorting of objects acting like Named without being derived (SUMOVehicle) ++// @note Numbers of different lenghts will not be ordered by alphanumerical sorting ++struct ComparatorIdLess { ++ template ++ bool operator()(const T* const a, const T* const b) const { ++ return a->getID() < b->getID(); ++ } ++}; ++ ++ + // =========================================================================== + // class definitions + // =========================================================================== +@@ -75,24 +85,6 @@ public: + } + + +- /// @brief Function-object for stable sorting in containers +- // @note Numbers of different lengths will not be ordered by alphanumerical sorting +- struct ComparatorIdLess { +- bool operator()(Named* const a, Named* const b) const { +- return a->getID() < b->getID(); +- } +- }; +- +- /// @brief Function-object for stable sorting of objects acting like Named without being derived (SUMOVehicle) +- // @note Numbers of different lenghts will not be ordered by alphanumerical sorting +- template +- struct NamedLikeComparatorIdLess { +- bool operator()(const NamedLike* const a, const NamedLike* const b) const { +- return a->getID() < b->getID(); +- } +- }; +- +- + /** @class StoringVisitor + * @brief Allows to store the object; used as context while traveling the rtree in TraCI + */ +diff --git src/utils/vehicle/SUMOVehicle.h src/utils/vehicle/SUMOVehicle.h +index 8e7af4ae76..43c783c8b0 100644 +--- src/utils/vehicle/SUMOVehicle.h ++++ src/utils/vehicle/SUMOVehicle.h +@@ -75,9 +75,6 @@ public: + */ + virtual double getPreviousSpeed() const = 0; + +- +- typedef Named::NamedLikeComparatorIdLess ComparatorIdLess; +- + /// @brief Destructor + virtual ~SUMOVehicle() {} + +-- +2.18.0 + diff --git a/srcpkgs/sumo/template b/srcpkgs/sumo/template new file mode 100644 index 0000000000..9ed9242d04 --- /dev/null +++ b/srcpkgs/sumo/template @@ -0,0 +1,13 @@ +# Template file for 'sumo' +pkgname=sumo +version=0.32.0 +revision=1 +build_style=gnu-configure +hostmakedepends="pkg-config libgdal-tools" +makedepends="fox-devel libgdal-devel libxerces-c-devel proj-devel" +short_desc="SUMO (Simulation of Urban MObility) and included applications" +maintainer="Warrior Graph " +license="EPL-2.0" +homepage="http://sumo.sourceforge.net/" +distfiles="${SOURCEFORGE_SITE}/${pkgname}/${pkgname}-src-${version}.tar.gz" +checksum=00753ca57a9911f0c99202505a6b05b1777168134842d7924fd827766642608a