Branch data Line data Source code
1 : : // ----------------- BEGIN LICENSE BLOCK --------------------------------- 2 : : // 3 : : // Copyright (C) 2019-2021 Intel Corporation 4 : : // 5 : : // SPDX-License-Identifier: LGPL-2.1-only 6 : : // 7 : : // ----------------- END LICENSE BLOCK ----------------------------------- 8 : : 9 : : #include "ad/rss/map/Logging.hpp" 10 : : #include "ad/rss/map/RssRouteCheckerData.hpp" 11 : : 12 : : namespace ad { 13 : : namespace rss { 14 : : namespace map { 15 : : 16 : : template <class OBJECT_INSTANCE_TYPE> class ParallelRouteUpdater 17 : : { 18 : : public: 19 : 11 : ParallelRouteUpdater(::ad::physics::Distance const routePreviewDistance, 20 : : ::ad::map::lane::LaneIdSet const &mapAreaLanes, 21 : : typename RssRouteCheckerVehicleData<OBJECT_INSTANCE_TYPE>::RouteExtensionMode routeExtensionMode) 22 : 11 : : mRoutePreviewDistance(routePreviewDistance) 23 : 11 : , mMapAreaLanes(mapAreaLanes) 24 : 11 : , mRouteExtensionMode(routeExtensionMode) 25 : : { 26 : 11 : } 27 : : 28 : : ParallelRouteUpdater(const ParallelRouteUpdater &other) = delete; 29 : : ParallelRouteUpdater &operator=(const ParallelRouteUpdater &other) = delete; 30 : : 31 : 9 : void operator()(typename RssRouteCheckerVehicleDataMap<OBJECT_INSTANCE_TYPE>::value_type &vehicleToUpdate) const 32 : : { 33 [ + - ]: 9 : if (vehicleToUpdate.second.mActive 34 [ + - ]: 9 : && (::ad::rss::world::ObjectType::OtherObject != vehicleToUpdate.second.mRssObjectData.type) 35 [ + - ]: 9 : && (mRouteExtensionMode 36 : : != RssRouteCheckerVehicleData<OBJECT_INSTANCE_TYPE>::RouteExtensionMode::eAllowOnlySingleRoute)) 37 : : { 38 : : // update other vehicle routes only if not allow only single route mode; otherwhise other vehicles don't need 39 : : // route processing 40 : 9 : vehicleToUpdate.second.updateRoutes(mRoutePreviewDistance, mMapAreaLanes, mRouteExtensionMode); 41 : 9 : vehicleToUpdate.second.normalizeAndOrderRoutes(); 42 : : } 43 : 9 : } 44 : : 45 : 17 : void operator()(typename RssRouteCheckerEgoVehicleDataMap<OBJECT_INSTANCE_TYPE>::value_type &egoVehicleToUpdate) const 46 : : { 47 [ + - ]: 17 : if (egoVehicleToUpdate.second.mActive) 48 : : { 49 : 17 : egoVehicleToUpdate.second.updateRoutes(mRoutePreviewDistance, mMapAreaLanes, mRouteExtensionMode); 50 : 17 : egoVehicleToUpdate.second.updateVehicleDynamicsOnRoutes(); 51 : 17 : egoVehicleToUpdate.second.evaluateRoutes(); 52 : 17 : egoVehicleToUpdate.second.normalizeAndOrderRoutes(); 53 : : } 54 : 17 : } 55 : : 56 : : private: 57 : : ::ad::physics::Distance const mRoutePreviewDistance; 58 : : ::ad::map::lane::LaneIdSet const &mMapAreaLanes; 59 : : typename RssRouteCheckerVehicleData<OBJECT_INSTANCE_TYPE>::RouteExtensionMode mRouteExtensionMode; 60 : : }; 61 : : 62 : : } // namespace map 63 : : } // namespace rss 64 : : } // namespace ad