protected:
RouteCreationArgs* new_extended_route(RoutingMode hierarchy, NetPoint* gw_src, NetPoint* gw_dst,
- std::vector<resource::LinkImpl*>& link_list, bool change_order);
+ const std::vector<resource::LinkImpl*>& link_list, bool preserve_order);
XBT_ATTRIB_DEPRECATED_v330("Please drop 2nd, 3rd and 7th parameters") virtual RouteCreationArgs* new_extended_route(
RoutingMode hierarchy, NetPoint* /* src */, NetPoint* /* dst */, NetPoint* gw_src, NetPoint* gw_dst,
- std::vector<resource::LinkImpl*>& link_list, bool /* symmetrical */, bool change_order)
+ std::vector<resource::LinkImpl*>& link_list, bool /* symmetrical */, bool preserve_order)
{
- return new_extended_route(hierarchy, gw_src, gw_dst, link_list, change_order);
+ return new_extended_route(hierarchy, gw_src, gw_dst, link_list, preserve_order);
}
void get_route_check_params(NetPoint* src, NetPoint* dst) const;
void add_route_check_params(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
/* ************************* GENERIC AUX FUNCTIONS ************************** */
/* change a route containing link names into a route containing link entities */
RouteCreationArgs* RoutedZone::new_extended_route(RoutingMode hierarchy, NetPoint* gw_src, NetPoint* gw_dst,
- std::vector<resource::LinkImpl*>& link_list, bool change_order)
+ const std::vector<resource::LinkImpl*>& link_list,
+ bool preserve_order)
{
auto* result = new RouteCreationArgs();
result->gw_dst = gw_dst;
}
- for (auto const& link : link_list) {
- if (change_order)
- result->link_list.push_back(link);
- else
- result->link_list.insert(result->link_list.begin(), link);
- }
+ if (preserve_order)
+ result->link_list = link_list;
+ else
+ result->link_list.assign(link_list.rbegin(), link_list.rend()); // reversed
result->link_list.shrink_to_fit();
return result;