This started with NetPoint::get_englobing_zone() and propagated quickly...
/* Restore the value for the next test */
thehost->set_property(exist, "180");
- auto thezone = thehost->get_englobing_zone();
+ const auto* thezone = thehost->get_englobing_zone();
XBT_INFO("== Print the properties of the zone '%s' that contains '%s'", thezone->get_cname(), hostname.c_str());
const std::unordered_map<std::string, std::string>* zoneprops = thezone->get_properties();
keys.clear();
* After this function returns, any node in the graph
* will have a loopback attached to it.
*/
- void get_local_route(NetPoint* src, NetPoint* dst, Route* route, double* lat) override;
+ void get_local_route(const NetPoint* src, const NetPoint* dst, Route* route, double* lat) override;
void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
const std::vector<resource::LinkImpl*>& link_list, bool symmetrical) override;
};
};
explicit DragonflyZone(const std::string& name);
- void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) override;
+ void get_local_route(const NetPoint* src, const NetPoint* dst, Route* into, double* latency) override;
/**
* @brief Parse topology parameters from string format
*
public:
explicit EmptyZone(const std::string& name) : NetZoneImpl(name) {}
- void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) override
+ void get_local_route(const NetPoint* src, const NetPoint* dst, Route* into, double* latency) override
{
/* There can't be route in an Empty zone */
}
explicit FatTreeZone(const std::string& name) : ClusterBase(name){};
FatTreeZone(const FatTreeZone&) = delete;
FatTreeZone& operator=(const FatTreeZone&) = delete;
- void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) override;
+ void get_local_route(const NetPoint* src, const NetPoint* dst, Route* into, double* latency) override;
/**
* @brief Parse the topology parameters from string format
FloydZone(const FloydZone&) = delete;
FloydZone& operator=(const FloydZone&) = delete;
- void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) override;
+ void get_local_route(const NetPoint* src, const NetPoint* dst, Route* into, double* latency) override;
void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
const std::vector<resource::LinkImpl*>& link_list, bool symmetrical) override;
};
FullZone(const FullZone&) = delete;
FullZone& operator=(const FullZone) = delete;
- void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) override;
+ void get_local_route(const NetPoint* src, const NetPoint* dst, Route* into, double* latency) override;
void add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
const std::vector<resource::LinkImpl*>& link_list, bool symmetrical) override;
};
const std::string& get_name() const { return name_; }
const char* get_cname() const { return name_.c_str(); }
/** @brief the NetZone in which this NetPoint is included */
- NetZoneImpl* get_englobing_zone() { return englobing_zone_; }
+ NetZoneImpl* get_englobing_zone() const { return englobing_zone_; }
/** @brief Set the NetZone in which this NetPoint is included */
NetPoint* set_englobing_zone(NetZoneImpl* netzone_p);
NetPoint* set_coordinates(const std::string& coords);
std::string name_;
bool sealed_ = false; // We cannot add more content when sealed
- std::map<std::pair<NetPoint*, NetPoint*>, BypassRoute*> bypass_routes_; // src x dst -> route
+ std::map<std::pair<const NetPoint*, const NetPoint*>, BypassRoute*> bypass_routes_; // src x dst -> route
routing::NetPoint* netpoint_ = nullptr; // Our representative in the father NetZone
protected:
* @param into Container into which the traversed links and gateway information should be pushed
* @param latency Accumulator in which the latencies should be added (caller must set it to 0)
*/
- virtual void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) = 0;
+ virtual void get_local_route(const NetPoint* src, const NetPoint* dst, Route* into, double* latency) = 0;
/** @brief retrieves the list of all routes of size 1 (of type src x dst x Link) */
/* returns whether we found a bypass path */
- bool get_bypass_route(routing::NetPoint* src, routing::NetPoint* dst,
+ bool get_bypass_route(const routing::NetPoint* src, const routing::NetPoint* dst,
/* OUT */ std::vector<resource::LinkImpl*>& links, double* latency,
std::unordered_set<NetZoneImpl*>& netzones);
* @param links Accumulator in which all traversed links should be pushed (caller must empty it)
* @param latency Accumulator in which the latencies should be added (caller must set it to 0)
*/
- static void get_global_route(routing::NetPoint* src, routing::NetPoint* dst,
+ static void get_global_route(const routing::NetPoint* src, const routing::NetPoint* dst,
/* OUT */ std::vector<resource::LinkImpl*>& links, double* latency);
/** @brief Similar to get_global_route but get the NetZones traversed by route */
- static void get_global_route_with_netzones(routing::NetPoint* src, routing::NetPoint* dst,
+ static void get_global_route_with_netzones(const routing::NetPoint* src, const routing::NetPoint* dst,
/* OUT */ std::vector<resource::LinkImpl*>& links, double* latency,
std::unordered_set<NetZoneImpl*>& netzones);
{
return new_extended_route(hierarchy, gw_src, gw_dst, link_list, preserve_order);
}
- void get_route_check_params(NetPoint* src, NetPoint* dst) const;
+ void get_route_check_params(const NetPoint* src, const NetPoint* dst) const;
void add_route_check_params(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
const std::vector<resource::LinkImpl*>& link_list, bool symmetrical) const;
};
public:
explicit StarZone(const std::string& name);
- void get_local_route(NetPoint* src, NetPoint* dst, Route* route, double* latency) override;
+ void get_local_route(const NetPoint* src, const NetPoint* dst, Route* route, double* latency) override;
void get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t, std::less<>>* nodes,
std::map<std::string, xbt_edge_t, std::less<>>* edges) override;
public:
explicit TorusZone(const std::string& name) : ClusterBase(name){};
void create_torus_links(int id, int rank, unsigned int position);
- void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) override;
+ void get_local_route(const NetPoint* src, const NetPoint* dst, Route* into, double* latency) override;
void set_topology(const std::vector<unsigned int>& dimensions);
/** @brief Convert topology parameters from string to vector of uint */
public:
using StarZone::StarZone;
void set_peer_link(NetPoint* netpoint, double bw_in, double bw_out);
- void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) override;
+ void get_local_route(const NetPoint* src, const NetPoint* dst, Route* into, double* latency) override;
};
namespace vivaldi {
WifiZone(const WifiZone&) = delete;
WifiZone& operator=(const WifiZone) = delete;
- void get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency) override;
+ void get_local_route(const NetPoint* src, const NetPoint* dst, Route* into, double* latency) override;
s4u::Link* create_link(const std::string& name, const std::vector<double>& bandwidths) override;
NetPoint* get_access_point() const { return access_point_; }
};
XBT_ATTRIB_DEPRECATED_v330("Please use Host::sendto()") void send_to(Host* dest, double byte_amount);
#endif
- NetZone* get_englobing_zone();
+ NetZone* get_englobing_zone() const;
/** Block the calling actor on an execution located on the called host
*
* It is not a problem if the actor is not located on the called host.
static void instr_user_srcdst_variable(double time, const char *src, const char *dst, const char *variable,
const char *father_type, double value, InstrUserVariable what)
{
- simgrid::kernel::routing::NetPoint* src_elm = sg_netpoint_by_name_or_null(src);
+ const simgrid::kernel::routing::NetPoint* src_elm = sg_netpoint_by_name_or_null(src);
xbt_assert(src_elm, "Element '%s' not found!", src);
- simgrid::kernel::routing::NetPoint* dst_elm = sg_netpoint_by_name_or_null(dst);
+ const simgrid::kernel::routing::NetPoint* dst_elm = sg_netpoint_by_name_or_null(dst);
xbt_assert(dst_elm, "Element '%s' not found!", dst);
std::vector<simgrid::kernel::resource::LinkImpl*> route;
/* Parsing */
-void DijkstraZone::get_local_route(NetPoint* src, NetPoint* dst, Route* route, double* lat)
+void DijkstraZone::get_local_route(const NetPoint* src, const NetPoint* dst, Route* route, double* lat)
{
get_route_check_params(src, dst);
int src_id = src->id();
}
}
-void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, Route* route, double* latency)
+void DragonflyZone::get_local_route(const NetPoint* src, const NetPoint* dst, Route* route, double* latency)
{
// Minimal routing version.
// TODO : non-minimal random one, and adaptive ?
return true;
}
-void FatTreeZone::get_local_route(NetPoint* src, NetPoint* dst, Route* into, double* latency)
+void FatTreeZone::get_local_route(const NetPoint* src, const NetPoint* dst, Route* into, double* latency)
{
if (dst->is_router() || src->is_router())
return;
}
}
-void FloydZone::get_local_route(NetPoint* src, NetPoint* dst, Route* route, double* lat)
+void FloydZone::get_local_route(const NetPoint* src, const NetPoint* dst, Route* route, double* lat)
{
get_route_check_params(src, dst);
}
}
-void FullZone::get_local_route(NetPoint* src, NetPoint* dst, Route* res, double* lat)
+void FullZone::get_local_route(const NetPoint* src, const NetPoint* dst, Route* res, double* lat)
{
XBT_DEBUG("full getLocalRoute from %s[%u] to %s[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id());
* dst
* @endverbatim
*/
-static void find_common_ancestors(NetPoint* src, NetPoint* dst,
+static void find_common_ancestors(const NetPoint* src, const NetPoint* dst,
/* OUT */ NetZoneImpl** common_ancestor, NetZoneImpl** src_ancestor,
NetZoneImpl** dst_ancestor)
{
}
/* PRECONDITION: this is the common ancestor of src and dst */
-bool NetZoneImpl::get_bypass_route(NetPoint* src, NetPoint* dst,
+bool NetZoneImpl::get_bypass_route(const NetPoint* src, const NetPoint* dst,
/* OUT */ std::vector<resource::LinkImpl*>& links, double* latency,
std::unordered_set<NetZoneImpl*>& netzones)
{
return false;
}
-void NetZoneImpl::get_global_route(NetPoint* src, NetPoint* dst,
+void NetZoneImpl::get_global_route(const NetPoint* src, const NetPoint* dst,
/* OUT */ std::vector<resource::LinkImpl*>& links, double* latency)
{
std::unordered_set<NetZoneImpl*> netzones;
get_global_route_with_netzones(src, dst, links, latency, netzones);
}
-void NetZoneImpl::get_global_route_with_netzones(NetPoint* src, NetPoint* dst,
+void NetZoneImpl::get_global_route_with_netzones(const NetPoint* src, const NetPoint* dst,
/* OUT */ std::vector<resource::LinkImpl*>& links, double* latency,
std::unordered_set<NetZoneImpl*>& netzones)
{
return result;
}
-void RoutedZone::get_route_check_params(NetPoint* src, NetPoint* dst) const
+void RoutedZone::get_route_check_params(const NetPoint* src, const NetPoint* dst) const
{
xbt_assert(src, "Cannot find a route from nullptr to %s", dst->get_cname());
xbt_assert(dst, "Cannot find a route from %s to nullptr", src->get_cname());
}
}
-void StarZone::get_local_route(NetPoint* src, NetPoint* dst, Route* route, double* latency)
+void StarZone::get_local_route(const NetPoint* src, const NetPoint* dst, Route* route, double* latency)
{
XBT_VERB("StarZone getLocalRoute from '%s'[%u] to '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(),
dst->id());
set_num_links_per_node(dimensions_.size());
}
-void TorusZone::get_local_route(NetPoint* src, NetPoint* dst, Route* route, double* lat)
+void TorusZone::get_local_route(const NetPoint* src, const NetPoint* dst, Route* route, double* lat)
{
XBT_VERB("torus getLocalRoute from '%s'[%u] to '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id());
return (src_coord - dst_coord) * (src_coord - dst_coord);
}
-static const std::vector<double>& netpoint_get_coords(NetPoint* np)
+static const std::vector<double>& netpoint_get_coords(const NetPoint* np)
{
const auto* coords = np->extension<vivaldi::Coords>();
xbt_assert(coords, "Please specify the Vivaldi coordinates of %s %s (%p)",
add_route(nullptr, netpoint, nullptr, nullptr, {linkDown->get_impl()}, false);
}
-void VivaldiZone::get_local_route(NetPoint* src, NetPoint* dst, Route* route, double* lat)
+void VivaldiZone::get_local_route(const NetPoint* src, const NetPoint* dst, Route* route, double* lat)
{
XBT_DEBUG("vivaldi getLocalRoute from '%s'[%u] '%s'[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id());
}
}
-void WifiZone::get_local_route(NetPoint* src, NetPoint* dst, Route* res, double* lat)
+void WifiZone::get_local_route(const NetPoint* src, const NetPoint* dst, Route* res, double* lat)
{
XBT_DEBUG("full getLocalRoute from %s[%u] to %s[%u]", src->get_cname(), src->id(), dst->get_cname(), dst->id());
}
/** @brief Returns the networking zone englobing that host */
-NetZone* Host::get_englobing_zone()
+NetZone* Host::get_englobing_zone() const
{
return pimpl_netpoint_->get_englobing_zone()->get_iface();
}
});
for (auto src_host : hosts) { // Routes from host
- simgrid::kernel::routing::NetPoint* src = src_host->get_netpoint();
+ const simgrid::kernel::routing::NetPoint* src = src_host->get_netpoint();
for (auto dst_host : hosts) { // Routes to host
std::vector<simgrid::kernel::resource::LinkImpl*> route;
- simgrid::kernel::routing::NetPoint* dst = dst_host->get_netpoint();
+ const simgrid::kernel::routing::NetPoint* dst = dst_host->get_netpoint();
simgrid::kernel::routing::NetZoneImpl::get_global_route(src, dst, route, nullptr);
if (route.empty())
continue;