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: Simon Patarin
Subject: Re: [Pandora] What is the supossed way to locate a Component in the same stack???
Date: Fri, 19 Sep 2003 01:45:32 +0200 (CEST)


> 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.

> + 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).  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.

Simon





reply via email to

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