Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
routing: inline 2 functions
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 8 Mar 2016 18:03:01 +0000 (19:03 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 8 Mar 2016 18:03:01 +0000 (19:03 +0100)
src/surf/sg_platf.cpp
src/surf/surf_routing.hpp
src/surf/xml/platf_private.hpp

index fbf5989..55010c7 100644 (file)
@@ -796,9 +796,19 @@ static void surf_config_models_setup()
  * @param AS_id name of this autonomous system. Must be unique in the platform
  * @param wanted_routing_type one of Full, Floyd, Dijkstra or similar. Full list in the variable routing_models, in src/surf/surf_routing.c
  */
  * @param AS_id name of this autonomous system. Must be unique in the platform
  * @param wanted_routing_type one of Full, Floyd, Dijkstra or similar. Full list in the variable routing_models, in src/surf/surf_routing.c
  */
-void routing_AS_begin(sg_platf_AS_cbarg_t AS)
+void sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS)
 {
 {
-  XBT_DEBUG("routing_AS_begin");
+  if (!surf_parse_models_setup_already_called) {
+    /* Initialize the surf models. That must be done after we got all config, and before we need the models.
+     * That is, after the last <config> tag, if any, and before the first of cluster|peer|AS|trace|trace_connect
+     *
+     * I'm not sure for <trace> and <trace_connect>, there may be a bug here
+     * (FIXME: check it out by creating a file beginning with one of these tags)
+     * but cluster and peer create ASes internally, so putting the code in there is ok.
+     */
+    surf_parse_models_setup_already_called = 1;
+    surf_config_models_setup();
+  }
 
   xbt_assert(nullptr == xbt_lib_get_or_null(as_router_lib, AS->id, ROUTING_ASR_LEVEL),
       "Refusing to create a second AS called \"%s\".", AS->id);
 
   xbt_assert(nullptr == xbt_lib_get_or_null(as_router_lib, AS->id, ROUTING_ASR_LEVEL),
       "Refusing to create a second AS called \"%s\".", AS->id);
@@ -855,54 +865,24 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS)
 
   simgrid::surf::netcardCreatedCallbacks(netcard);
   simgrid::surf::asCreatedCallbacks(new_as);
 
   simgrid::surf::netcardCreatedCallbacks(netcard);
   simgrid::surf::asCreatedCallbacks(new_as);
-}
-
-void sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS)
-{
-  if (!surf_parse_models_setup_already_called) {
-    /* Initialize the surf models. That must be done after we got all config, and before we need the models.
-     * That is, after the last <config> tag, if any, and before the first of cluster|peer|AS|trace|trace_connect
-     *
-     * I'm not sure for <trace> and <trace_connect>, there may be a bug here
-     * (FIXME: check it out by creating a file beginning with one of these tags)
-     * but cluster and peer create ASes internally, so putting the code in there is ok.
-     *
-     * TODO, There used to be a guard protecting here against
-     * xbt_dynar_length(sg_platf_AS_begin_cb_list) because we don't want to
-     * initialize the models if we are parsing the file to get the deployment.
-     * That could happen if the same file would be used for platf and deploy:
-     * it'd contain AS tags even during the deploy parsing. Removing that guard
-     * would result of the models to get re-inited when parsing for deploy.
-     * Currently using the same file for platform and deployment is broken
-     * however. This guard will have to ba adapted in order to make this feature
-     * work again.
-     */
-    surf_parse_models_setup_already_called = 1;
-    surf_config_models_setup();
-  }
-
-  routing_AS_begin(AS);
   if (TRACE_is_enabled())
     sg_instr_AS_begin(AS);
 }
 
   if (TRACE_is_enabled())
     sg_instr_AS_begin(AS);
 }
 
-void sg_platf_new_AS_end()
-{
-  routing_AS_end();
-  if (TRACE_is_enabled())
-    sg_instr_AS_end();
-}
 /**
  * \brief Specify that the current description of AS is finished
  *
  * Once you've declared all the content of your AS, you have to close
  * it with this call. Your AS is not usable until you call this function.
  */
 /**
  * \brief Specify that the current description of AS is finished
  *
  * Once you've declared all the content of your AS, you have to close
  * it with this call. Your AS is not usable until you call this function.
  */
-void routing_AS_end()
+void sg_platf_new_AS_end()
 {
   xbt_assert(current_routing, "Cannot seal the current AS: none under construction");
   current_routing->Seal();
   current_routing = static_cast<simgrid::surf::AsImpl*>(current_routing->father());
 {
   xbt_assert(current_routing, "Cannot seal the current AS: none under construction");
   current_routing->Seal();
   current_routing = static_cast<simgrid::surf::AsImpl*>(current_routing->father());
+
+  if (TRACE_is_enabled())
+    sg_instr_AS_end();
 }
 
 /** @brief Add a link connecting an host to the rest of its AS (which must be cluster or vivaldi) */
 }
 
 /** @brief Add a link connecting an host to the rest of its AS (which must be cluster or vivaldi) */
index af8f610..2e04910 100644 (file)
@@ -31,7 +31,6 @@ namespace surf {
  * Classes *
  ***********/
 
  * Classes *
  ***********/
 
-class XBT_PRIVATE RoutingModelDescription;
 class XBT_PRIVATE Onelink;
 class RoutingPlatf;
 
 class XBT_PRIVATE Onelink;
 class RoutingPlatf;
 
index f80fb19..f57f02c 100644 (file)
@@ -244,8 +244,6 @@ typedef struct s_sg_platf_AS_cbarg {
 typedef struct probabilist_event_generator *probabilist_event_generator_t;
 
 /********** Routing **********/
 typedef struct probabilist_event_generator *probabilist_event_generator_t;
 
 /********** Routing **********/
-void routing_AS_begin(sg_platf_AS_cbarg_t AS);
-void routing_AS_end(void);
 void routing_cluster_add_backbone(Link* bb);
 /*** END of the parsing cruft ***/
 
 void routing_cluster_add_backbone(Link* bb);
 /*** END of the parsing cruft ***/