/* model_list_invoke contains only surf_host and surf_vm.
* The callback functions of cpu_model and network_model will be called from
* those of these host models. */
-xbt_dynar_t model_list = NULL; /* for destroying all models correctly */
+xbt_dynar_t all_existing_models = NULL; /* to destroy models correctly */
xbt_dynar_t model_list_invoke = NULL; /* for invoking callbacks */
tmgr_history_t history = NULL;
SURF_STORAGE_LEVEL = xbt_lib_add_level(storage_lib,surf_storage_free);
xbt_init(argc, argv);
- if (!model_list)
- model_list = xbt_dynar_new(sizeof(Model*), NULL);
+ if (!all_existing_models)
+ all_existing_models = xbt_dynar_new(sizeof(Model*), NULL);
if (!model_list_invoke)
model_list_invoke = xbt_dynar_new(sizeof(Model*), NULL);
if (!history)
xbt_lib_free(&file_lib);
xbt_dict_free(&watched_hosts_lib);
- xbt_dynar_foreach(model_list, iter, model)
+ xbt_dynar_foreach(all_existing_models, iter, model)
delete model;
- xbt_dynar_free(&model_list);
+ xbt_dynar_free(&all_existing_models);
xbt_dynar_free(&model_list_invoke);
routing_exit();
{}
Resource::Resource(Model *model, const char *name, xbt_dict_t props)
- : p_name(xbt_strdup(name)), p_properties(props), p_model(model)
- , m_running(true), m_stateCurrent(SURF_RESOURCE_ON)
+ : Resource(model, name, props, SURF_RESOURCE_ON)
{}
Resource::Resource(Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint)
+ : Resource(model, name, props, constraint, SURF_RESOURCE_ON)
+{}
+
+Resource::Resource(
+ Model *model, const char *name, xbt_dict_t props,
+ lmm_constraint_t constraint, e_surf_resource_state_t stateInit)
: p_name(xbt_strdup(name)), p_properties(props), p_model(model)
- , m_running(true), m_stateCurrent(SURF_RESOURCE_ON), p_constraint(constraint)
+ , m_running(true), m_stateCurrent(stateInit), p_constraint(constraint)
{}
Resource::Resource(Model *model, const char *name, xbt_dict_t props, e_surf_resource_state_t stateInit)