[Click] dynamic_cast ?

Harald Schiöberg harald at net.t-labs.tu-berlin.de
Mon Nov 9 06:12:13 EST 2009


-----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-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: elementtracker_clear.diff
Type: text/x-diff
Size: 981 bytes
Desc: not available
Url : http://amsterdam.lcs.mit.edu/pipermail/click/attachments/20091109/de07819c/attachment.diff 


More information about the click mailing list