SPFVertex constructor
authorTom Henderson <tomh@tomh.org>
Tue, 10 Jul 2007 13:28:07 -0700
changeset 1062 ea9b7839421d
parent 1060 78028417caeb
child 1063 98fe4e27c65a
SPFVertex constructor
src/routing/static-route-manager.cc
src/routing/static-route-manager.h
--- a/src/routing/static-route-manager.cc	Tue Jul 10 12:38:51 2007 -0700
+++ b/src/routing/static-route-manager.cc	Tue Jul 10 13:28:07 2007 -0700
@@ -15,6 +15,7 @@
  */
 #include <utility>
 #include <vector>
+#include <queue>
 #include "ns3/assert.h"
 #include "ns3/fatal-error.h"
 #include "ns3/debug.h"
@@ -26,6 +27,15 @@
 
 namespace ns3 {
 
+SPFVertex::SPFVertex () : 
+  m_vertexType(VertexUnknown), 
+  m_vertexId("255.255.255.255"), 
+  m_lsa(0),
+  m_distanceFromRoot(SPF_INFINITY), 
+  m_stat(false)
+{
+}
+
 SPFVertex::~SPFVertex ()
 {
   delete m_lsa;
@@ -191,6 +201,9 @@
 StaticRouteManager::SPFCalculate(Ipv4Address root)
 {
   NS_DEBUG("StaticRouteManager::SPFCalculate ()");
+   // Make a priority queue of int using a vector container
+   //    priority_queue<int, vector<int>, less<int> > pq;
+  //priority_queue<SPFVertex*, vector<SPFVertex*>, less<int> > candidate;
   /*
  *  struct pqueue* candidate;
  *  struct vertex* v;
--- a/src/routing/static-route-manager.h	Tue Jul 10 12:38:51 2007 -0700
+++ b/src/routing/static-route-manager.h	Tue Jul 10 13:28:07 2007 -0700
@@ -26,6 +26,8 @@
 
 namespace ns3 {
 
+const uint32_t SPF_INFINITY = 0xffffffff;
+
 /**
  * \brief Vertex used in shortest path first (SPF) computations
  *
@@ -34,10 +36,12 @@
 class SPFVertex
 {
 public:
+  SPFVertex();
   ~SPFVertex();
 
   enum VertexType {
-    VertexRouter = 1,
+    VertexUnknown = 0,
+    VertexRouter,
     VertexNetwork
   } m_vertexType;
 
@@ -51,6 +55,8 @@
   type_listOfSPFVertex::iterator m_iter;
 
   uint32_t m_distanceFromRoot;
+
+  bool m_stat;  // true if LSA is in SPF tree already
 };
 
 /**