Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
[simgrid.git] / src / surf / surf_routing.hpp
index 7fdd860..6096197 100644 (file)
@@ -48,28 +48,27 @@ public:
  */
 class As {
 public:
-  xbt_dynar_t p_indexNetworkElm;
+  xbt_dynar_t p_indexNetworkElm = xbt_dynar_new(sizeof(char*),NULL);
   xbt_dict_t p_bypassRoutes;    /* store bypass routes */
   routing_model_description_t p_modelDesc;
   e_surf_routing_hierarchy_t p_hierarchy;
-  char *p_name;
-  As *p_routingFather;
-  xbt_dict_t p_routingSons;
-  NetCard *p_netElem;
-  xbt_dynar_t p_linkUpDownList;
+  char *p_name = nullptr;
+  As *p_routingFather = nullptr;
+  xbt_dict_t p_routingSons = xbt_dict_new_homogeneous(NULL);
+  NetCard *p_netcard;
+  xbt_dynar_t p_linkUpDownList = NULL;
 
-  /**
-   * @brief The As constructor
-   */
   As(){};
+  /* Close that AS: no more content can be added to it */
+  virtual void Seal()=0;
 
-  /**
-   * @brief The As destructor
-   */
   virtual ~As(){
-       xbt_free(p_name);
-       if (p_netElem)
-               delete p_netElem;
+    xbt_dict_free(&p_routingSons);
+    xbt_dynar_free(&p_indexNetworkElm);
+    xbt_dynar_free(&p_linkUpDownList);
+    xbt_free(p_name);
+    if (p_netcard)
+      delete p_netcard;
   };
 
   /**
@@ -145,10 +144,11 @@ public:
  */
 XBT_PUBLIC_CLASS RoutingPlatf {
 public:
+  RoutingPlatf(void *loopback);
   ~RoutingPlatf();
-  As *p_root;
+  As *p_root = nullptr;
   void *p_loopback;
-  xbt_dynar_t p_lastRoute;
+  xbt_dynar_t p_lastRoute = xbt_dynar_new(sizeof(sg_routing_link_t),NULL);
   xbt_dynar_t getOneLinkRoutes(void);
   xbt_dynar_t recursiveGetOneLinkRoutes(As *rc);
   void getRouteAndLatency(NetCard *src, NetCard *dst, xbt_dynar_t * links, double *latency);
@@ -158,7 +158,7 @@ public:
  * Callbacks *
  *************/
 
-XBT_PUBLIC_DATA(simgrid::xbt::signal<void(NetCard*)>) routingEdgeCreatedCallbacks;
+XBT_PUBLIC_DATA(simgrid::xbt::signal<void(NetCard*)>) netcardCreatedCallbacks;
 XBT_PUBLIC_DATA(simgrid::xbt::signal<void(As*)>) asCreatedCallbacks;
 
 }