Do not depend on the parsing state in this function.
XBT_PUBLIC_DATA(xbt_lib_t) storage_type_lib;
XBT_PUBLIC_DATA(int) ROUTING_STORAGE_TYPE_LEVEL; //Routing storage_type level
XBT_PUBLIC_DATA(xbt_lib_t) storage_type_lib;
XBT_PUBLIC_DATA(int) ROUTING_STORAGE_TYPE_LEVEL; //Routing storage_type level
-/* The callbacks to register for the routing to work */
-void routing_AS_begin(sg_platf_AS_cbarg_t AS);
-void routing_AS_end(sg_platf_AS_cbarg_t AS);
-
-void routing_parse_init(sg_platf_host_cbarg_t host);
-void routing_cluster_add_backbone(void* bb);
-
SG_END_DECL()
#endif /* _SURF_SURF_H */
SG_END_DECL()
#endif /* _SURF_SURF_H */
xbt_graph_t instr_routing_platform_graph (void);
void instr_routing_platform_graph_export_graphviz (xbt_graph_t g, const char *filename);
xbt_graph_t instr_routing_platform_graph (void);
void instr_routing_platform_graph_export_graphviz (xbt_graph_t g, const char *filename);
+/********** Routing **********/
+void routing_AS_begin(sg_platf_AS_cbarg_t AS);
+void routing_AS_end(sg_platf_AS_cbarg_t AS);
+void routing_add_host(As* as, sg_platf_host_cbarg_t host);
+void routing_cluster_add_backbone(void* bb);
+As* routing_get_current();
+
SG_END_DECL()
#endif /* _SURF_SURF_H */
SG_END_DECL()
#endif /* _SURF_SURF_H */
void sg_platf_new_host(sg_platf_host_cbarg_t host)
{
void sg_platf_new_host(sg_platf_host_cbarg_t host)
{
- routing_parse_init(host);
+ As* current_routing = routing_get_current();
+ if (current_routing)
+ routing_add_host(current_routing, host);
surf_cpu_model_pm->createCpu(
host->id,
host->power_peak,
surf_cpu_model_pm->createCpu(
host->id,
host->power_peak,
/* Global vars */
RoutingPlatf *routing_platf = NULL;
/* Global vars */
RoutingPlatf *routing_platf = NULL;
-As *current_routing = NULL;
/* global parse functions */
extern xbt_dynar_t mount_list;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route, surf, "Routing part of surf");
/* global parse functions */
extern xbt_dynar_t mount_list;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route, surf, "Routing part of surf");
+/** The current AS in the parsing */
+static As *current_routing = NULL;
+As* routing_get_current()
+{
+ return current_routing;
+}
+
static void routing_parse_peer(sg_platf_peer_cbarg_t peer); /* peer bypass */
// static void routing_parse_Srandom(void); /* random bypass */
static void routing_parse_peer(sg_platf_peer_cbarg_t peer); /* peer bypass */
// static void routing_parse_Srandom(void); /* random bypass */
/**
* \brief Add a "host" to the network element list
*/
/**
* \brief Add a "host" to the network element list
*/
-void routing_parse_init(sg_platf_host_cbarg_t host)
+void routing_add_host(As* current_routing, sg_platf_host_cbarg_t host)
- if (! current_routing)
- return;
-
if (current_routing->p_hierarchy == SURF_ROUTING_NULL)
current_routing->p_hierarchy = SURF_ROUTING_BASE;
xbt_assert(!sg_host_by_name(host->id),
if (current_routing->p_hierarchy == SURF_ROUTING_NULL)
current_routing->p_hierarchy = SURF_ROUTING_BASE;
xbt_assert(!sg_host_by_name(host->id),