From: Bruno Donassolo Date: Fri, 2 Apr 2021 16:41:04 +0000 (+0200) Subject: Constify list of links parameter X-Git-Tag: v3.28~482^2~25 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/1365d67fed75eed3bc33aaed77aac4481039f27a Constify list of links parameter --- diff --git a/include/simgrid/kernel/routing/DijkstraZone.hpp b/include/simgrid/kernel/routing/DijkstraZone.hpp index 6ae3a92166..16a435fd59 100644 --- a/include/simgrid/kernel/routing/DijkstraZone.hpp +++ b/include/simgrid/kernel/routing/DijkstraZone.hpp @@ -8,7 +8,6 @@ #include - namespace simgrid { namespace kernel { namespace routing { @@ -52,7 +51,7 @@ public: */ void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat) override; void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst, - std::vector& link_list, bool symmetrical) override; + const std::vector& link_list, bool symmetrical) override; }; } // namespace routing } // namespace kernel diff --git a/include/simgrid/kernel/routing/FloydZone.hpp b/include/simgrid/kernel/routing/FloydZone.hpp index 19c7f2086b..17ade54bec 100644 --- a/include/simgrid/kernel/routing/FloydZone.hpp +++ b/include/simgrid/kernel/routing/FloydZone.hpp @@ -38,7 +38,7 @@ public: void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override; void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst, - std::vector& link_list, bool symmetrical) override; + const std::vector& link_list, bool symmetrical) override; }; } // namespace routing } // namespace kernel diff --git a/include/simgrid/kernel/routing/FullZone.hpp b/include/simgrid/kernel/routing/FullZone.hpp index b86d243236..13565c4579 100644 --- a/include/simgrid/kernel/routing/FullZone.hpp +++ b/include/simgrid/kernel/routing/FullZone.hpp @@ -27,7 +27,7 @@ public: void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override; void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst, - std::vector& link_list, bool symmetrical) override; + const std::vector& link_list, bool symmetrical) override; private: std::vector routing_table_; diff --git a/include/simgrid/kernel/routing/NetZoneImpl.hpp b/include/simgrid/kernel/routing/NetZoneImpl.hpp index 6853d5ca6b..2e9b75b614 100644 --- a/include/simgrid/kernel/routing/NetZoneImpl.hpp +++ b/include/simgrid/kernel/routing/NetZoneImpl.hpp @@ -154,7 +154,7 @@ public: virtual int add_component(kernel::routing::NetPoint* elm); /* A host, a router or a netzone, whatever */ virtual void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst, - std::vector& link_list, bool symmetrical); + const std::vector& link_list, bool symmetrical); /** @brief Set parent of this Netzone */ void set_parent(NetZoneImpl* parent); /** @brief Set network model for this Netzone */ diff --git a/include/simgrid/s4u/NetZone.hpp b/include/simgrid/s4u/NetZone.hpp index 2e23d7cb16..a78e29d9bb 100644 --- a/include/simgrid/s4u/NetZone.hpp +++ b/include/simgrid/s4u/NetZone.hpp @@ -94,7 +94,7 @@ public: const std::vector& link_list, bool symmetrical = true); void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src, - kernel::routing::NetPoint* gw_dst, std::vector& link_list, + kernel::routing::NetPoint* gw_dst, const std::vector& link_list, bool symmetrical); void add_bypass_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst, diff --git a/src/kernel/routing/DijkstraZone.cpp b/src/kernel/routing/DijkstraZone.cpp index 4a6a2ad445..3b6a036a7d 100644 --- a/src/kernel/routing/DijkstraZone.cpp +++ b/src/kernel/routing/DijkstraZone.cpp @@ -219,7 +219,7 @@ void DijkstraZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationAr } void DijkstraZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst, - std::vector& link_list, bool symmetrical) + const std::vector& link_list, bool symmetrical) { add_route_check_params(src, dst, gw_src, gw_dst, link_list, symmetrical); diff --git a/src/kernel/routing/FloydZone.cpp b/src/kernel/routing/FloydZone.cpp index 1b4bc8f7f7..98903cb741 100644 --- a/src/kernel/routing/FloydZone.cpp +++ b/src/kernel/routing/FloydZone.cpp @@ -82,7 +82,7 @@ void FloydZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* } void FloydZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst, - std::vector& link_list, bool symmetrical) + const std::vector& link_list, bool symmetrical) { /* set the size of table routing */ unsigned int table_size = get_table_size(); diff --git a/src/kernel/routing/FullZone.cpp b/src/kernel/routing/FullZone.cpp index e3abf98ccb..9f0c860db1 100644 --- a/src/kernel/routing/FullZone.cpp +++ b/src/kernel/routing/FullZone.cpp @@ -64,7 +64,7 @@ void FullZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* } void FullZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst, - std::vector& link_list, bool symmetrical) + const std::vector& link_list, bool symmetrical) { add_route_check_params(src, dst, gw_src, gw_dst, link_list, symmetrical); diff --git a/src/kernel/routing/NetZoneImpl.cpp b/src/kernel/routing/NetZoneImpl.cpp index a5996aa07b..7280225b34 100644 --- a/src/kernel/routing/NetZoneImpl.cpp +++ b/src/kernel/routing/NetZoneImpl.cpp @@ -173,7 +173,7 @@ int NetZoneImpl::add_component(NetPoint* elm) } void NetZoneImpl::add_route(NetPoint* /*src*/, NetPoint* /*dst*/, NetPoint* /*gw_src*/, NetPoint* /*gw_dst*/, - std::vector& /*link_list*/, bool /*symmetrical*/) + const std::vector& /*link_list*/, bool /*symmetrical*/) { xbt_die("NetZone '%s' does not accept new routes (wrong class).", get_cname()); } diff --git a/src/s4u/s4u_Netzone.cpp b/src/s4u/s4u_Netzone.cpp index 0866435df9..fa6f0c2d26 100644 --- a/src/s4u/s4u_Netzone.cpp +++ b/src/s4u/s4u_Netzone.cpp @@ -111,21 +111,19 @@ std::vector NetZone::get_link_list_impl(const std:: void NetZone::add_regular_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, const std::vector& link_list, bool symmetrical) { - auto links = NetZone::get_link_list_impl(link_list); - add_route(src, dst, nullptr, nullptr, links, symmetrical); + add_route(src, dst, nullptr, nullptr, NetZone::get_link_list_impl(link_list), symmetrical); } void NetZone::add_netzone_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst, const std::vector& link_list, bool symmetrical) { - auto links = NetZone::get_link_list_impl(link_list); - add_route(src, dst, gw_src, gw_dst, links, symmetrical); + add_route(src, dst, gw_src, gw_dst, NetZone::get_link_list_impl(link_list), symmetrical); } void NetZone::add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst, - std::vector& link_list, bool symmetrical) + const std::vector& link_list, bool symmetrical) { pimpl_->add_route(src, dst, gw_src, gw_dst, link_list, symmetrical); }