[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: deque in fq.cc



Sean Shunxing Xie wrote:
> 
> Hi,
> 
>    I am new to NS and C++. I have a question regarding deque function calls in fq.cc.
> The following code is in function update().
> 
>                 Queue * q = fs_[i].q_;
>                 if (q != 0) {
>                         if (fs_[i].hol_ == 0) {
>                                 Packet* p = q->deque();
> 
> My question is this: Which deque will be called when "Packet* p = q->deque();" is executed?
> 
> A similar question about the deque function calls in  drop-tail.cc:
> 
> Packet* DropTail::deque()
> {
>         return q_->deque();
> }
> 
> Which function is called? I think it should call the virtual function function in PacketQueue class (in
> queue.h), but it didn't. Anyone can give me some help?
> 
> Sean

Well, in Droptail q_ is a PacketQueue so virtual Packet*
PacketQueue::deque() is called (why not?).
FQ is a more complex structure, it's a multiple queue. In update() since
Queue * q = ..., it seems Queue::deque() is called, but this is a pure
virtual function
	virtual Packet* deque() = 0;
In fact the real queue objects used by FQ are set by tcl: FQclassifier
-> unknown-flow -> new-flow -> install (take a look at ns-queue.tcl
about FQLink). The type of these queues is queueManagement_ which is set
to Droptail (in ns-default.tcl).
So, at the end, I think Droptail::deque() will be call!
Hope this help...

Max