surf_cpu_model_t surf_cpu_model = NULL;
lmm_system_t cpu_maxmin_system = NULL;
-xbt_dict_t cpu_set = NULL;
+
static xbt_swag_t running_action_set_that_does_not_need_being_checked = NULL;
static void cpu_free(void *cpu)
xbt_dict_t cpu_properties)
{
cpu_Cas01_t cpu = xbt_new0(s_cpu_Cas01_t, 1);
- xbt_assert1(!xbt_dict_get_or_null(cpu_set, name),
+ xbt_assert1(!surf_model_resource_by_name(surf_cpu_model, name),
"Host '%s' declared several times in the platform file", name);
cpu->model = (surf_model_t) surf_cpu_model;
cpu->name = name;
current_property_set = cpu_properties;
- xbt_dict_set(cpu_set, name, cpu, cpu_free);
+ xbt_dict_set(surf_model_resource_set(surf_cpu_model), name, cpu, cpu_free);
return cpu;
}
/* connect all traces relative to hosts */
xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
- cpu_Cas01_t host = xbt_dict_get_or_null(cpu_set, elm);
+ cpu_Cas01_t host = surf_model_resource_by_name((surf_model_t)surf_cpu_model, elm);
xbt_assert1(host, "Host %s undefined", elm);
xbt_assert1(trace, "Trace %s undefined", trace_name);
xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name);
- cpu_Cas01_t host = xbt_dict_get_or_null(cpu_set, elm);
+ cpu_Cas01_t host = surf_model_resource_by_name((surf_model_t)surf_cpu_model, elm);
xbt_assert1(host, "Host %s undefined", elm);
xbt_assert1(trace, "Trace %s undefined", trace_name);
surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_init);
}
-static void *name_service(const char *name)
-{
- return xbt_dict_get_or_null(cpu_set, name);
-}
-
static const char *get_resource_name(void *resource_id)
{
return ((cpu_Cas01_t) resource_id)->name;
static void finalize(void)
{
- xbt_dict_free(&cpu_set);
lmm_system_free(cpu_maxmin_system);
cpu_maxmin_system = NULL;
running_action_set_that_does_not_need_being_checked =
xbt_swag_new(xbt_swag_offset(action, state_hookup));
- surf_cpu_model->common_public.name_service = name_service;
surf_cpu_model->common_public.get_resource_name = get_resource_name;
surf_cpu_model->common_public.action_get_state = surf_action_get_state;
surf_cpu_model->common_public.action_get_start_time =
/*manage the properties of the cpu */
surf_cpu_model->common_public.get_properties = get_properties;
- if (!cpu_set)
- cpu_set = xbt_dict_new();
if (!cpu_maxmin_system)
cpu_maxmin_system = lmm_system_new();
}