The easiest way to do to setup a pointer like this is to have the python make the connection one way and in the constructor make the pointer the other way.

So the python code will instantiate a Daughter, then a Father and give the Father the pointer to the Daughter. In the constructor the Father can then can daughter->setBackPtr(this) or something similar.

Ali

On Feb 19, 2007, at 9:41 AM, James Srinivasan wrote:

I'm trying to create a configuration hierarchy between some custom
SimObjects. To simplify things, let's assume I have two custom
SimObjects, called Father and Daughter (to avoid later confusion with
Parent and Child). The python code for Father instantiates a Daughter
and from my C++ code I can do things like father->daughter and
everything is happy. What I'd like to do is add a pointer in the
opposite direction, such that I can use daughter->father in the C++
code.

After a few unsuccessful attempts using "Parent" in the Python code, I'm
now trying to do:

# construct Father
# contruct Daughter

root.daughter.father = root.father

but this results in the configuration parsing code to go into a
recursive loop. Is there a simple way to set up such a pointer?

Thanks,

James

--
[EMAIL PROTECTED]
http://www.cl.cam.ac.uk/~jrs53/
_______________________________________________
m5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/m5-users

_______________________________________________
m5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/m5-users

Reply via email to