A Candidate Queue used in static routing. More...
#include <candidate-queue.h>
Public Member Functions | |
CandidateQueue () | |
Create an empty SPF Candidate Queue. | |
virtual | ~CandidateQueue () |
void | Clear (void) |
Empty the Candidate Queue and release all of the resources associated with the Shortest Path First Vertex pointers in the queue. | |
void | Push (SPFVertex *vNew) |
Push a Shortest Path First Vertex pointer onto the queue according to the priority scheme. | |
SPFVertex * | Pop (void) |
Pop the Shortest Path First Vertex pointer at the top of the queue. | |
SPFVertex * | Top (void) const |
Return the Shortest Path First Vertex pointer at the top of the queue. | |
bool | Empty (void) const |
Test the Candidate Queue to determine if it is empty. | |
uint32_t | Size (void) const |
Return the number of Shortest Path First Vertex pointers presently stored in the Candidate Queue. | |
SPFVertex * | Find (const Ipv4Address addr) const |
Searches the Candidate Queue for a Shortest Path First Vertex pointer that points to a vertex having the given IP address. | |
void | Reorder (void) |
Reorders the Candidate Queue according to the priority scheme. | |
Private Types | |
typedef std::list< SPFVertex * > | CandidateList_t |
Private Member Functions | |
CandidateQueue (CandidateQueue &sr) | |
CandidateQueue & | operator= (CandidateQueue &sr) |
Private Attributes | |
CandidateList_t | m_candidates |
A Candidate Queue used in static routing.
The CandidateQueue is used in the OSPF shortest path computations. It is a priority queue used to store candidates for the shortest path to a given network.
The queue holds Shortest Path First Vertex pointers and orders them according to the lowest value of the field m_distanceFromRoot. Remaining vertices are ordered according to increasing distance. This implements a priority queue.
Although a STL priority_queue almost does what we want, the requirement for a Find () operation, the dynamic nature of the data and the derived requirement for a Reorder () operation led us to implement this simple enhanced priority queue.
Definition at line 49 of file candidate-queue.h.
typedef std::list<SPFVertex*> ns3::CandidateQueue::CandidateList_t [private] |
Definition at line 180 of file candidate-queue.h.
ns3::CandidateQueue::CandidateQueue | ( | ) |
Create an empty SPF Candidate Queue.
Definition at line 28 of file candidate-queue.cc.
References NS_LOG_FUNCTION_NOARGS.
ns3::CandidateQueue::~CandidateQueue | ( | ) | [virtual] |
Definition at line 34 of file candidate-queue.cc.
References Clear(), and NS_LOG_FUNCTION_NOARGS.
ns3::CandidateQueue::CandidateQueue | ( | CandidateQueue & | sr | ) | [private] |
Candidate Queue copy construction is disallowed (not implemented) to prevent the compiler from slipping in incorrect versions that don't properly deal with deep copies.
void ns3::CandidateQueue::Clear | ( | void | ) |
Empty the Candidate Queue and release all of the resources associated with the Shortest Path First Vertex pointers in the queue.
Definition at line 41 of file candidate-queue.cc.
References m_candidates, NS_LOG_FUNCTION_NOARGS, and Pop().
Referenced by ~CandidateQueue().
bool ns3::CandidateQueue::Empty | ( | void | ) | const |
Test the Candidate Queue to determine if it is empty.
Definition at line 97 of file candidate-queue.cc.
References m_candidates, and NS_LOG_FUNCTION_NOARGS.
SPFVertex * ns3::CandidateQueue::Find | ( | const Ipv4Address | addr | ) | const |
Searches the Candidate Queue for a Shortest Path First Vertex pointer that points to a vertex having the given IP address.
Definition at line 111 of file candidate-queue.cc.
References ns3::SPFVertex::GetVertexId(), m_candidates, and NS_LOG_FUNCTION_NOARGS.
Referenced by ns3::GlobalRouteManagerImpl::SPFNext().
CandidateQueue& ns3::CandidateQueue::operator= | ( | CandidateQueue & | sr | ) | [private] |
Candidate Queue assignment operator is disallowed (not implemented) to prevent the compiler from slipping in incorrect versions that don't properly deal with deep copies.
SPFVertex * ns3::CandidateQueue::Pop | ( | void | ) |
Pop the Shortest Path First Vertex pointer at the top of the queue.
Definition at line 71 of file candidate-queue.cc.
References m_candidates, and NS_LOG_FUNCTION_NOARGS.
Referenced by Clear(), ns3::GlobalRouteManagerImplTest::RunTests(), and ns3::GlobalRouteManagerImpl::SPFCalculate().
void ns3::CandidateQueue::Push | ( | SPFVertex * | vNew | ) |
Push a Shortest Path First Vertex pointer onto the queue according to the priority scheme.
Definition at line 53 of file candidate-queue.cc.
References ns3::SPFVertex::GetDistanceFromRoot(), m_candidates, and NS_LOG_FUNCTION.
Referenced by Reorder(), ns3::GlobalRouteManagerImplTest::RunTests(), and ns3::GlobalRouteManagerImpl::SPFNext().
void ns3::CandidateQueue::Reorder | ( | void | ) |
Reorders the Candidate Queue according to the priority scheme.
Definition at line 129 of file candidate-queue.cc.
References m_candidates, NS_LOG_FUNCTION_NOARGS, and Push().
Referenced by ns3::GlobalRouteManagerImpl::SPFNext().
uint32_t ns3::CandidateQueue::Size | ( | void | ) | const |
Return the number of Shortest Path First Vertex pointers presently stored in the Candidate Queue.
Definition at line 104 of file candidate-queue.cc.
References m_candidates, and NS_LOG_FUNCTION_NOARGS.
Referenced by ns3::GlobalRouteManagerImpl::SPFCalculate().
SPFVertex * ns3::CandidateQueue::Top | ( | void | ) | const |
Return the Shortest Path First Vertex pointer at the top of the queue.
Definition at line 85 of file candidate-queue.cc.
References m_candidates, and NS_LOG_FUNCTION_NOARGS.