A Discrete-Event Network Simulator
API
candidate-queue.h
Go to the documentation of this file.
1 /*
2  * Copyright 2007 University of Washington
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Craig Dowell (craigdo@ee.washington.edu)
18  */
19 
20 #ifndef CANDIDATE_QUEUE_H
21 #define CANDIDATE_QUEUE_H
22 
23 #include "ns3/ipv4-address.h"
24 
25 #include <list>
26 #include <stdint.h>
27 
28 namespace ns3
29 {
30 
31 class SPFVertex;
32 
53 {
54  public:
61 
68  virtual ~CandidateQueue();
69 
70  // Delete copy constructor and assignment operator to avoid misuse
71  CandidateQueue(const CandidateQueue&) = delete;
73 
80  void Clear();
81 
94  void Push(SPFVertex* vNew);
95 
106  SPFVertex* Pop();
107 
119  SPFVertex* Top() const;
120 
126  bool Empty() const;
127 
135  uint32_t Size() const;
136 
145  SPFVertex* Find(const Ipv4Address addr) const;
146 
160  void Reorder();
161 
162  private:
174  static bool CompareSPFVertex(const SPFVertex* v1, const SPFVertex* v2);
175 
176  typedef std::list<SPFVertex*> CandidateList_t;
178 
186  friend std::ostream& operator<<(std::ostream& os, const CandidateQueue& q);
187 };
188 
189 } // namespace ns3
190 
191 #endif /* CANDIDATE_QUEUE_H */
A Candidate Queue used in routing calculations.
static bool CompareSPFVertex(const SPFVertex *v1, const SPFVertex *v2)
return true if v1 < v2
SPFVertex * Pop()
Pop the Shortest Path First Vertex pointer at the top of the queue.
CandidateQueue(const CandidateQueue &)=delete
SPFVertex * Top() const
Return the Shortest Path First Vertex pointer at the top of the queue.
CandidateQueue & operator=(const CandidateQueue &)=delete
uint32_t Size() const
Return the number of Shortest Path First Vertex pointers presently stored in the Candidate Queue.
void Push(SPFVertex *vNew)
Push a Shortest Path First Vertex pointer onto the queue according to the priority scheme.
void Reorder()
Reorders the Candidate Queue according to the priority scheme.
std::list< SPFVertex * > CandidateList_t
container of SPFVertex pointers
virtual ~CandidateQueue()
Destroy an SPF Candidate Queue and release any resources held by the contents.
CandidateList_t m_candidates
SPFVertex candidates.
void Clear()
Empty the Candidate Queue and release all of the resources associated with the Shortest Path First Ve...
SPFVertex * Find(const Ipv4Address addr) const
Searches the Candidate Queue for a Shortest Path First Vertex pointer that points to a vertex having ...
CandidateQueue()
Create an empty SPF Candidate Queue.
bool Empty() const
Test the Candidate Queue to determine if it is empty.
friend std::ostream & operator<<(std::ostream &os, const CandidateQueue &q)
Stream insertion operator.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
Vertex used in shortest path first (SPF) computations.
Every class exported by the ns3 library is enclosed in the ns3 namespace.