[xsd-users] Sending arguments down the Hierarchy
Wahid
hamishagi at yahoo.com
Sun Mar 18 22:40:34 EDT 2012
Hello,
I am using C++/parser in my project. I am working in "type map"s to delegate information/arguments between the parsers.
Here is a scenario that I made it very clear and simple to understand:
(scenario is a bit lengthy but the question is VERY small)
My XML:
<SimMobility_t>
<GeoSpatial_t>
<RoadNetwork_t>
<Links>
<Link_t>
...........
one of my classes: (pertaining to the above <RoadNetwork_t> element)
class RoadNetwork {
........
std::vector<Link*> links;
...........
}
Now a portion of my map file:
.......
links Link* Link;
link_t Link Link;
......
After generating skel and pimpl files, I declare a variable for the above class in the generated "RoadNetwork_t_pimpl" class:
class RoadNetwork_t_pimpl: public virtual RoadNetwork_t_pskel
{
.....
private:
RoadNetwork RN;
};
As you can see RN has a member called "links" which is a vector of "link"s . Right?
And you agree that the order of call backs is as follows:
SimMobility_t_pimpl:: pre ()
GeoSpatial_t_pimpl:: pre ()
RoadNetwork_t_pimpl:: pre ()
Links_pimpl::pre()
link_t_pimpl::pre()
........
Links_pimpl::Link (Link link)
...
...
right? :)
I can almost shoot my question now:
I update RoadNetwork_t_pimpl::RN in RoadNetwork_t_pimpl:: pre () referencing to my RoadNetwork singleton:
void RoadNetwork_t_pimpl::
pre ()
{
RN=..........::GetInstance().getNetwork(); //RN is a vecor of "link"s
}
and as the "link" information are read in the xml, I would like to create "link" objects in
link_t_pimpl::pre() .Later, after I updated the object, I would like to push it to RN.
QUESTION is: I don't know how to send RN as a variable from RoadNetwork_t_pimpl to
link_t_pimpl.
more explanation: map file allows me to send argument only in
Inside "Links_pimpl::Link(Link link)" which is a few calls after link_t_pimpl::pre() while, I guess, I need the argument at my disposal when the control is calling "link_t_pimpl::pre()" itself.
Any suggestions please?
May be i am writing my program in an inefficient way. In that case also help me please.
Many thanks
vahid
More information about the xsd-users
mailing list