std::shared_ptr<simgrid::surf::HostModel> host_model_;
/** @brief Perform sealing procedure for derived classes, if necessary */
virtual void do_seal(){};
+ void add_child(NetZoneImpl* new_zone);
protected:
explicit NetZoneImpl(const std::string& name);
/** @brief Returns the list of direct children (no grand-children). This returns the internal data, no copy.
* Don't mess with it.*/
std::vector<NetZoneImpl*>* get_children() { return &children_; }
- void add_child(NetZoneImpl* new_zone);
/** @brief Retrieves the name of that netzone as a C++ string */
const std::string& get_name() const { return name_; }
void set_property(const std::string& key, const std::string& value);
std::vector<NetZone*> get_children() const;
- NetZone* add_child(const NetZone* new_zone);
+ XBT_ATTRIB_DEPRECATED_v332("Please use set_parent() to manage NetZone's relationship") NetZone* add_child(
+ NetZone* new_zone);
void extract_xbt_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);
xbt_assert(not sealed_, "Impossible to set parent to an already sealed NetZone(%s)", this->get_cname());
parent_ = parent;
netpoint_->set_englobing_zone(parent_);
- /* copying models from parent host, to be reviewed when we allow multi-models */
if (parent) {
+ /* adding this class as child */
+ parent->add_child(this);
+ /* copying models from parent host, to be reviewed when we allow multi-models */
set_network_model(parent->get_network_model());
set_cpu_pm_model(parent->get_cpu_pm_model());
set_cpu_vm_model(parent->get_cpu_vm_model());
return res;
}
-NetZone* NetZone::add_child(const NetZone* new_zone)
+NetZone* NetZone::add_child(NetZone* new_zone)
{
- pimpl_->add_child(new_zone->get_impl());
+ new_zone->set_parent(this);
return this;
}
/* set the father behavior */
if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::recursive;
- /* add to the sons dictionary */
- current_routing->add_child(new_zone);
}
return new_zone;
}