[Click] finding an element in the configuration using Router::find()
Sascha Alexander Jopen
jopen at informatik.uni-bonn.de
Mon Sep 23 09:10:30 EDT 2013
Hi Hamid,
you can either use Router::elements() to iterate over all elements in
your configuration if there are several potential candiates, or use
Router::find("elemB") if you give the element to be found a name like so:
elemA :: elementA();
elemB :: elementB();
Regards,
Sascha
On 23.09.2013 14:46, Hamid Farhadi wrote:
> Hi
>
> using Router::visit_upstream/downstream() in this config elementA can
> find elementB:
> elementA()->elementB();
>
> But in this one it can not:
> elementA();
> elementB();
>
> I mean consider some elements like ControlSocket, how can I find it from
> another element, please?
>
> Here is how I use Router::visit_upstream/downstream():
>
> ElementCastTracker filter(router() , "elementB" );
> Element* e = router()->visit_upstream( this , 0 , &filter );
> elementB* b = (elementB*)filter[0]->cast( "elementB" );
>
> If the solution is Router::find(), I could not find an example of how to
> use it. when it returns an element, how should I cast it to use its members?
>
> Any help is appreciated,
> Hamid
>
>
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>
--
Dipl.-Inform. Sascha Jopen
University of Bonn Tel.: +49-228-73-54219
Institute of Computer Science 4 Fax: +49-228-73-4571
Friedrich-Ebert-Allee 144 E-mail: jopen at cs.uni-bonn.de
D-53113 Bonn, Germany
More information about the click
mailing list