[Click] dynamic_cast ?
Eddie Kohler
kohler at cs.ucla.edu
Mon Nov 9 10:48:09 EST 2009
Harald, thanks -- I'll check a variant of this in! But clear() functions
generally return void, and so will this one.
Eddie
Harald Schiöberg wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Eddie Kohler wrote:
>> Hi Harald,
>>
>> Click elements don't know what element(s) are connected to a push input
>> port, or a pull output port. This is because it is valid for one or
>> more elements to connect there.
>>
>> So if e->input_is_push(i), then e->input(i).element() == 0.
>>
>> To find the element or elements connected to a push input port, use
>> Router functions to traverse the element graph. I've just checked in a
>> rework of this functionality that should help you. On current mainline,
>> you could say:
>>
>> #include <click/routervisitor.hh>
>> ...
>> ElementNeighborTracker tracker(router());
>> router()->visit_upstream(this, 0, &tracker);
>> tracker.elements() // is a vector containing exactly those elements
>> // that are connected to [0]this
>>
>> Does this make sense?
>
> Thanks a lot, works and makes perfect sense.
>
> attached a small patch that I found very useful when using that stuff...
>
> Harald
>
>
> - --
> Harald Schiöberg
> Technische Universität Berlin | T-Laboratories | FG INET
> www: http://www.net.t-labs.tu-berlin.de
> Phone: +49-(0)30-8353-58476 | Fax: +49-(0)391 534 783 47
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFK9/kNy8wrZ9OvkU0RAhdPAJ9AsxLZpBnJGxxcZ7lbj7AiDcy6NQCgvliE
> B0JdVik2y+79tH655btbJBI=
> =zGnz
> -----END PGP SIGNATURE-----
>
More information about the click
mailing list