pandora-users
[Top][All Lists]
Advanced

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

Re: [Pandora] What is the supossed way to locate a Component in the same


From: uaca
Subject: Re: [Pandora] What is the supossed way to locate a Component in the same stack???
Date: Fri, 19 Sep 2003 08:05:26 +0200
User-agent: Mutt/1.3.28i

Hi Simon

nice to hear you

On Fri, Sep 19, 2003 at 01:45:32AM +0200, Simon Patarin wrote:
> 
> 
> > I found locateComponent(Component *start, const text &id) method,
> > but it's not clear for me how to use it:
> 
> You're right, this is not really obvious, and actually rather clumsy.

nice to hear this too, I thought I'm getting too much dumb ;-)

> > + because of the text id (wich is different type that component_id)
> 
> You should not worry about that: "symbol_id_t" is just an integer
> representing the hashed value (using string_hahs()) of the (full)
> component name. Moreover there is an implicit conversion from "text" to
> "long" (and hence "symbol_id_t"). In brief you only need to give the name
> of the component you are looking for at this point, e.g.
> "PcapHandlerComponent".
> 
> > + Becuase I don't know how to get the Component in the start of the stack
> 
> A reference to the first component of a stack is stored in the
> corresponding dispatcher in the (private :)) firstComponent field.
> 
> > any suggestion will be greatly appreciated
> 
> My final recommandation: do not use this function! :) It's buggy: you
> cannot be sure to find the component you're looking for, even if it exists
> (the crawling method is wrong, look at Component::apply() for a "good"
> one). Rather, could you tell me in which context you would need to look
> for a component refernce? It would certainly help me to design a proper
> interface (I can see several problems regarding to demultiplexed
> components and identical components replicated at different locations in
> the stack).  

The intendend purpose is to call PcapComponent stats functions from my
component and adding this info to dumps my component already does 
periodically.

> Anyway if you need a "quick and dirty" fix you may consider
> StackDesc::store (each component holds a reference to its StackDesc in
> Component::compStack). The (private, again :)) "store" holds the
> references to all current components indexed by their position in the
> stack defintion (e.g. the first component will have index #0). You can
> then pick any pointer in there.

Ok, I'll try that later

Thanks so much Simon

regards
        Ulisses

                Debian GNU/Linux: a dream come true
-----------------------------------------------------------------------------
"Computers are useless. They can only give answers."            Pablo Picasso

--->    Visita http://www.valux.org/ para saber acerca de la    <---
--->    AsociaciĆ³n Valenciana de Usuarios de Linux              <---
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]