} e_surf_resource_state_t;
+/*
+ * Platform creation functions. Instead of passing 123 arguments to the creation functions
+ * (one for each possible XML attribute), we pass structures containing them all. It removes the
+ * chances of switching arguments by error, and reduce the burden when we add a new attribute:
+ * old models can just continue to ignore it without having to update their headers.
+ *
+ * It shouldn't be too costly at runtime, provided that structures living on the stack are
+ * used, instead of malloced structures.
+ */
+
typedef struct s_surf_parsing_host_arg {
char* V_host_id; //id
double V_host_power_peak; //power
XBT_PUBLIC(void) sg_platf_new_AS_open(const char *id, const char *mode);
XBT_PUBLIC(void) sg_platf_new_AS_close(void);
+XBT_PUBLIC(void) sg_platf_new_host(surf_parsing_host_arg_t h);
+
#endif /* SG_PLATF_H */
typedef void (*surf_parse_host_fct_t)(surf_parsing_host_arg_t);
void surf_parse_host_add_cb(surf_parse_host_fct_t);
-void surf_parse_host(surf_parsing_host_arg_t h);
xbt_dynar_free(&surf_parse_host_cb_list);
}
-void surf_parse_host(surf_parsing_host_arg_t h){
+void sg_platf_new_host(surf_parsing_host_arg_t h){
unsigned int iterator;
surf_parse_host_fct_t fun;
xbt_dynar_foreach(surf_parse_host_cb_list, iterator, fun) {
host.V_host_core = struct_cluster->S_cluster_core;
host.V_host_state_initial = SURF_RESOURCE_ON;
host.V_host_coord = "";
- surf_parse_host(&host);
+ sg_platf_new_host(&host);
XBT_DEBUG("</host>");
A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
host.V_host_core = struct_cluster->S_cluster_core;
host.V_host_state_initial = SURF_RESOURCE_ON;
host.V_host_coord = "";
- surf_parse_host(&host);
+ sg_platf_new_host(&host);
XBT_DEBUG("</host>");
A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
host.V_host_core = struct_cluster->S_cluster_core;
host.V_host_state_initial = SURF_RESOURCE_ON;
host.V_host_coord = "";
- surf_parse_host(&host);
+ sg_platf_new_host(&host);
XBT_DEBUG("</host>");
A_surfxml_link_sharing_policy = A_surfxml_link_sharing_policy_SHARED;
host.V_host_state_initial = SURF_RESOURCE_OFF;
host.V_host_coord = xbt_strdup(A_surfxml_host_coordinates);
- surf_parse_host(&host);
+ sg_platf_new_host(&host);
}
void ETag_surfxml_host(void){
surfxml_call_cb_functions(ETag_surfxml_host_cb_list);