/* make sure these symbols are defined as strong ones in this file so that the linker can resolve them */
/* The default current property receiver. Setup in the corresponding opening callbacks. */
-xbt_dict_t current_property_set = nullptr;
+std::map<std::string, std::string>* current_property_set = nullptr;
std::map<std::string, std::string>* current_model_property_set = nullptr;
int ZONE_TAG = 0; // Whether we just opened a zone tag (to see what to do with the properties)
}
void ETag_surfxml_storage___type()
{
- s_sg_platf_storage_type_cbarg_t storage_type;
- memset(&storage_type,0,sizeof(storage_type));
+ StorageTypeCreationArgs storage_type;
storage_type.properties = current_property_set;
current_property_set = nullptr;
storage_type.model_properties = current_model_property_set;
current_model_property_set = nullptr;
- storage_type.content = A_surfxml_storage___type_content;
- storage_type.id = A_surfxml_storage___type_id;
- storage_type.model = A_surfxml_storage___type_model;
- storage_type.size = surf_parse_get_size(A_surfxml_storage___type_size,
- "size of storage type", storage_type.id);
+ storage_type.content = A_surfxml_storage___type_content;
+ storage_type.id = A_surfxml_storage___type_id;
+ storage_type.model = A_surfxml_storage___type_model;
+ storage_type.size =
+ surf_parse_get_size(A_surfxml_storage___type_size, "size of storage type", storage_type.id.c_str());
sg_platf_new_storage_type(&storage_type);
}
simgrid::s4u::NetZone* netzone = simgrid::s4u::Engine::getInstance()->getNetzoneByNameOrNull(A_surfxml_zone_id);
netzone->setProperty(A_surfxml_prop_id, A_surfxml_prop_value);
- }
- else{
+ } else {
if (not current_property_set)
- current_property_set = xbt_dict_new_homogeneous(&xbt_free_f); // Maybe, it should raise an error
- xbt_dict_set(current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), nullptr);
+ current_property_set = new std::map<std::string, std::string>; // Maybe, it should raise an error
+ current_property_set->insert({A_surfxml_prop_id, A_surfxml_prop_value});
XBT_DEBUG("add prop %s=%s into current property set %p", A_surfxml_prop_id, A_surfxml_prop_value,
current_property_set);
}
void ETag_surfxml_config()
{
- xbt_dict_cursor_t cursor = nullptr;
- char *key;
- char *elem;
- xbt_dict_foreach(current_property_set, cursor, key, elem) {
- if (xbt_cfg_is_default_value(key)) {
- std::string cfg = std::string(key) + ":" + elem;
+ for (auto elm : *current_property_set) {
+ if (xbt_cfg_is_default_value(elm.first.c_str())) {
+ std::string cfg = elm.first + ":" + elm.second;
xbt_cfg_set_parse(cfg.c_str());
} else
- XBT_INFO("The custom configuration '%s' is already defined by user!",key);
+ XBT_INFO("The custom configuration '%s' is already defined by user!", elm.first.c_str());
}
XBT_DEBUG("End configuration name = %s",A_surfxml_config_id);
- xbt_dict_free(¤t_property_set);
+ delete current_property_set;
current_property_set = nullptr;
}