Hi Venky,

This is odd, since I would expect it to work.  Assuming, of course, that the 
RoundRobinSched is attached *DIRECTLY* to the queues -- with no intervening 
elements.

One way you could test what's going on is to print out the *name* of the q 
element, with "click_chatter("%s", q->name().c_str());".  THen you can make 
sure whether you're getting the real queue.

If you want to know how to find the real upstream queue, even if there are 
intervening elements, check out how RED does this with an ElementFilter.

Eddie


Venky Rama wrote:
> hi - how can say a roundrobinscheduler element get information about an 
> upstream queue? something like 
>      Queue *q = (Queue*)input(j).element();
>      q->getColor();
>   in the downstream element does not work...
>    
>   for example, if the upstream queue has a new member called _color, then the 
> scheduler needs to know if _color of the upstream queue is say red or 
> green....
>    
>   thanks!
>   venky
>    
>   ________
>    
>   details:
>   ________
>    
>   i tried this in the scheduler's pull function but it gives weird numbers 
> instead...assume the Queue class has a simple int member which stores color 
> and which is returned by public getColor().
>    
>   Packet *
>   RoundRobinSched::pull(int)
>   {
>    int n = ninputs();
>    int i = _next;
>    for (int j = 0; j < n; j++) {
>      Queue *q = (Queue*)input(j).element();
>      click_chatter("upstream queue %i has a color %i", j, q->getColor();)
>      Packet *p = (_signals[i] ? input(i).pull() : 0);
>      i++; 
>      if (i >= n) 
>        i = 0;
>      if (p) {
>        _next = i;
>        return p;
>      }
>    }
>    return 0;
>   }
>    
>    
> 
>                       
> ---------------------------------
> See the all-new, redesigned Yahoo.com.  Check it out.
> _______________________________________________
> click mailing list
> [email protected]
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
_______________________________________________
click mailing list
[email protected]
https://amsterdam.lcs.mit.edu/mailman/listinfo/click

Reply via email to