22 #include "ns3/assert.h"
23 #include "candidate-queue.h"
24 #include "global-route-manager-impl.h"
37 default: os <<
"unknown";
break;
43 operator<< (std::ostream& os,
const CandidateQueue& q)
45 typedef CandidateQueue::CandidateList_t List_t;
46 typedef List_t::const_iterator CIter_t;
47 const CandidateQueue::CandidateList_t& list = q.m_candidates;
49 os <<
"*** CandidateQueue Begin (<id, distance, LSA-type>) ***" << std::endl;
50 for (CIter_t iter = list.begin (); iter != list.end (); iter++)
53 << (*iter)->GetVertexId () <<
", "
54 << (*iter)->GetDistanceFromRoot () <<
", "
55 << (*iter)->GetVertexType () <<
">" << std::endl;
57 os <<
"*** CandidateQueue End ***";
77 while (!m_candidates.empty ())
90 CandidateList_t::iterator i = std::upper_bound (
91 m_candidates.begin (), m_candidates.end (), vNew,
94 m_candidates.insert (i, vNew);
101 if (m_candidates.empty ())
107 m_candidates.pop_front ();
115 if (m_candidates.empty ())
120 return m_candidates.front ();
127 return m_candidates.empty ();
134 return m_candidates.size ();
141 CandidateList_t::const_iterator i = m_candidates.begin ();
143 for (; i != m_candidates.end (); i++)
#define NS_LOG_FUNCTION(parameters)
SPFVertex * Pop(void)
Pop the Shortest Path First Vertex pointer at the top of the queue.
#define NS_LOG_COMPONENT_DEFINE(name)
SPFVertex * Top(void) const
Return the Shortest Path First Vertex pointer at the top of the queue.
Vertex used in shortest path first (SPF) computations. See RFC 2328, Section 16.
uint32_t Size(void) const
Return the number of Shortest Path First Vertex pointers presently stored in the Candidate Queue...
static bool CompareSPFVertex(const SPFVertex *v1, const SPFVertex *v2)
return true if v1 < v2
void Clear(void)
Empty the Candidate Queue and release all of the resources associated with the Shortest Path First Ve...
uint32_t GetDistanceFromRoot(void) const
Get the distance from the root vertex to "this" SPFVertex object.
#define NS_LOG_LOGIC(msg)
std::ostream & operator<<(std::ostream &os, const Angles &a)
void Push(SPFVertex *vNew)
Push a Shortest Path First Vertex pointer onto the queue according to the priority scheme...
CandidateQueue()
Create an empty SPF Candidate Queue.
Ipv4 addresses are stored in host order in this class.
SPFVertex * Find(const Ipv4Address addr) const
Searches the Candidate Queue for a Shortest Path First Vertex pointer that points to a vertex having ...
virtual ~CandidateQueue()
bool Empty(void) const
Test the Candidate Queue to determine if it is empty.
VertexType GetVertexType(void) const
Get the Vertex Type field of a SPFVertex object.
VertexType
Enumeration of the possible types of SPFVertex objects.
void Reorder(void)
Reorders the Candidate Queue according to the priority scheme.
Ipv4Address GetVertexId(void) const
Get the Vertex ID field of a SPFVertex object.