I achieved something of a breakthrough today with class Pin. It now knows nothing at all about Switches. Switches now work by adding and removing wires between their pins. This is a vastly more elegant solution. =P
Really, to close a switch the code is merely: foo = new Wire(pinA, pinB). and to open the switch, delete foo; That's all there is to it, basically. ;) It still doesn't look right to have pin contain sets of pointers to itself. However this is the core of the code that creates subcircuits for simulation. I spent the morning studying the Zoltan code and concluded that I was basically right, that there shouldn't be a loop to delete wires there (and that's why it was segfaulting.). What I did put there was an assertion check to make sure the e-connector was correctly removed from the circuit. If ECNode is implemented correctly, then pins should be told that the wire is gone, which should safely start the process that deletes the wire. For the same reason, there is no destructor in Switch because the act of deleting the switch will delete its pins which will delete all associated wires. -- New president: Here we go again... Chemistry.com: A total rip-off. Powers are not rights. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Ktechlab-devel mailing list Ktechlab-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ktechlab-devel