Non-default constructor for SPFVertex
authorTom Henderson <tomh@tomh.org>
Wed, 11 Jul 2007 22:54:47 -0700
changeset 1079 89b08d079fb6
parent 1078 8d38eebf74e5
child 1080 82a244f82f80
Non-default constructor for SPFVertex
src/routing/static-route-manager.cc
src/routing/static-route-manager.h
--- a/src/routing/static-route-manager.cc	Wed Jul 11 22:37:48 2007 -0700
+++ b/src/routing/static-route-manager.cc	Wed Jul 11 22:54:47 2007 -0700
@@ -36,9 +36,17 @@
 {
 }
 
+SPFVertex::SPFVertex (StaticRouterLSA* lsa) : 
+  m_vertexType(VertexRouter), 
+  m_vertexId(lsa->m_linkStateId),
+  m_lsa(lsa),
+  m_distanceFromRoot(SPF_INFINITY) 
+{
+}
+
+
 SPFVertex::~SPFVertex ()
 {
-  delete m_lsa;
 }
 
 void
@@ -320,12 +328,8 @@
   // Initialize the shortest-path tree to only the router doing the 
   // calculation.
   //
-  v= new SPFVertex();
-  v->m_vertexType = SPFVertex::VertexRouter;
-  v->m_vertexId = root;
-  v-> m_lsa = m_lsdb->GetLSA(root);
-  // Set LSA position to LSA_SPF_IN_SPFTREE. This vertex is the root of the
-  // spanning tree. 
+  v= new SPFVertex(m_lsdb->GetLSA(root));
+  // This vertex is the root of the SPF tree
   v->m_distanceFromRoot = 0;
 
   for (;;)
--- a/src/routing/static-route-manager.h	Wed Jul 11 22:37:48 2007 -0700
+++ b/src/routing/static-route-manager.h	Wed Jul 11 22:54:47 2007 -0700
@@ -40,6 +40,7 @@
 {
 public:
   SPFVertex();
+  SPFVertex(StaticRouterLSA*);
   ~SPFVertex();
   void Initialize ();