XBT_PUBLIC(msg_netzone_t) MSG_zone_get_root();
XBT_PUBLIC(const char*) MSG_zone_get_name(msg_netzone_t zone);
XBT_PUBLIC(msg_netzone_t) MSG_zone_get_by_name(const char* name);
-XBT_PUBLIC(xbt_dict_t) MSG_zone_get_sons(msg_netzone_t zone);
+XBT_PUBLIC(void) MSG_zone_get_sons(msg_netzone_t zone, xbt_dict_t whereto);
XBT_PUBLIC(const char*) MSG_zone_get_property_value(msg_netzone_t as, const char* name);
XBT_PUBLIC(void) MSG_zone_set_property_value(msg_netzone_t netzone, const char* name, char* value);
-XBT_PUBLIC(xbt_dynar_t) MSG_zone_get_hosts(msg_netzone_t zone);
+XBT_PUBLIC(void) MSG_zone_get_hosts(msg_netzone_t zone, xbt_dynar_t whereto);
/* Deprecated forms of the previous functions */
static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_root since v3.16")
}
static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_sons since v3.16")
xbt_dict_t MSG_environment_as_get_routing_sons(msg_netzone_t zone) {
- return MSG_zone_get_sons(zone);
+ xbt_dict_t res = xbt_dict_new_homogeneous(NULL);
+ MSG_zone_get_sons(zone, res);
+ return res;
}
static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_property_value since v3.16")
const char* MSG_environment_as_get_property_value(msg_netzone_t zone, const char* name) {
}
static inline XBT_ATTRIB_DEPRECATED("Please use MSG_zone_get_hosts since v3.16")
xbt_dynar_t MSG_environment_as_get_hosts(msg_netzone_t zone) {
- return MSG_zone_get_hosts(zone);
+ xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t), NULL);
+ MSG_zone_get_hosts(zone, res);
+ return res;
}
/************************** File handling ***********************************/
return simgrid::s4u::Engine::instance()->netzoneByNameOrNull(name);
}
-xbt_dict_t MSG_zone_get_sons(msg_netzone_t netzone)
+void MSG_zone_get_sons(msg_netzone_t netzone, xbt_dict_t whereto)
{
- xbt_dict_t res = xbt_dict_new_homogeneous(nullptr);
for (auto elem : *netzone->children()) {
- xbt_dict_set(res, elem->name(), static_cast<void*>(elem), nullptr);
+ xbt_dict_set(whereto, elem->name(), static_cast<void*>(elem), nullptr);
}
- return res;
}
const char* MSG_zone_get_property_value(msg_netzone_t netzone, const char* name)
netzone->setProperty(name, value);
}
-xbt_dynar_t MSG_zone_get_hosts(msg_netzone_t netzone)
+void MSG_zone_get_hosts(msg_netzone_t netzone, xbt_dynar_t whereto)
{
- xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t), nullptr);
-
for (auto host : *netzone->hosts()) {
- xbt_dynar_push(res, &host);
+ xbt_dynar_push(whereto, &host);
}
-
- return res;
}
SG_END_DECL()