// our content, as known to our graph routing algorithm (maps vertex_id -> vertex)
std::vector<kernel::routing::NetPoint*> vertices_;
- // would like to use the one defined in the StandardLinkImpl file, but for some reason
- // this hpp is exported to the users and so cannot include the other internal hpp.
- class ResourceDeleter {
- public:
- template <typename Resource> void operator()(Resource* res) const;
- };
- std::map<std::string, std::unique_ptr<resource::StandardLinkImpl, ResourceDeleter>, std::less<>> links_;
+ std::map<std::string, resource::StandardLinkImpl*, std::less<>> links_;
/* save split-duplex links separately, keep links_ with only LinkImpl* seen by the user
* members of a split-duplex are saved in the links_ */
std::map<std::string, std::unique_ptr<resource::SplitDuplexLinkImpl>, std::less<>> split_duplex_links_;
std::vector<kernel::resource::StandardLinkImpl*> const& link_list)>
NetZoneImpl::on_route_creation;
-template <typename Resource> void NetZoneImpl::ResourceDeleter::operator()(Resource* res) const
-{
- res->destroy();
-}
-
NetZoneImpl::NetZoneImpl(const std::string& name) : piface_(this), name_(name)
{
auto* engine = s4u::Engine::get_instance();
for (auto const& nz : children_)
delete nz;
- /* Since hosts_ is a std::map, the hosts are destroyed in the lexicographic order, which ensures that the output is
- * reproducible.
+ /* Since hosts_ and links_ are a std::map, the hosts are destroyed in the lexicographic order, which ensures that the
+ * output is reproducible.
*/
for (auto& host : hosts_) {
host.second->destroy();
}
hosts_.clear();
+ for (auto& link : links_) {
+ link.second->destroy();
+ }
+ links_.clear();
for (auto const& kv : bypass_routes_)
delete kv.second;
"Impossible to create link: %s. Invalid network model: nullptr. Have you set the parent of this NetZone: %s?",
name.c_str(), get_cname());
xbt_assert(not sealed_, "Impossible to create link: %s. NetZone %s already sealed", name.c_str(), get_cname());
- links_[name].reset(do_create_link(name, bandwidths)->set_englobing_zone(this));
+ links_[name] = do_create_link(name, bandwidths)->set_englobing_zone(this);
return links_[name]->get_iface();
}
{
auto link_it = links_.find(name);
if (link_it != links_.end())
- return link_it->second.get();
+ return link_it->second;
for (const auto* child : children_) {
auto* link = child->get_link_by_name_or_null(name);