typedef struct s_container *container_t;
typedef struct s_container {
- char *name;
- char *type;
- int level;
+ char *name; /* Unique id of this container */
+ char *type; /* Type of this container */
+ int level; /* Level in the hierarchy, root level is 0 */
struct s_container *father;
xbt_dict_t children;
}s_container_t;
-static container_t rootContainer = NULL;
-static xbt_dynar_t currentContainer = NULL;
+static container_t rootContainer = NULL; /* the root container */
+static xbt_dynar_t currentContainer = NULL; /* push and pop, used only in creation */
static xbt_dict_t allContainers = NULL; /* all created containers indexed by name */
xbt_dict_t hosts_types = NULL;
xbt_dict_t links_types = NULL;
static void instr_routing_parse_end_host (void);
static void instr_routing_parse_start_router (void);
static void instr_routing_parse_end_router (void);
+static void instr_routing_parse_end_platform (void);
static char *instr_AS_type (int level);
static char *instr_AS_type (int level)
surfxml_add_callback(ETag_surfxml_host_cb_list, &instr_routing_parse_end_host);
surfxml_add_callback(STag_surfxml_router_cb_list, &instr_routing_parse_start_router);
surfxml_add_callback(ETag_surfxml_router_cb_list, &instr_routing_parse_end_router);
+ surfxml_add_callback(ETag_surfxml_platform_cb_list, &instr_routing_parse_end_platform);
}
container_t father = xbt_dynar_get_ptr(currentContainer, xbt_dynar_length(currentContainer)-1);
char type[INSTR_DEFAULT_STR_SIZE];
snprintf (type, INSTR_DEFAULT_STR_SIZE, "ROUTER-%s", father->type);
- newContainer (A_surfxml_router_id, type, "ROUTER");
+ container_t new = newContainer (A_surfxml_router_id, type, "ROUTER");
+
+ //register created host on the dictionary
+ xbt_dict_set (allContainers, A_surfxml_router_id, new, NULL);
}
static void instr_routing_parse_end_router ()
{
}
+static void instr_routing_parse_end_platform ()
+{
+ currentContainer = NULL;
+}
+
/*
* Support functions
*/