Hi Peter,
OK, so I changed PacketBase fist, then went ahead to change the templates. Then I realized that the derived (generated) cannot return auto_ptr <DerivedPacket> because it is not polymorphic with auto_ptr <BasePacket> as is the case of DerivedPacket and PacketBase. Hence, I had to change the templates to always return auto_ptr <BasePacket>.
I also had to modify PacketStub (in Generics, BitTorrent), BadPacket, Packet. The Kad packets are not using packet-gen, so I removed them from the build process and will add them again once they get converted.
You might want to check my latest revision.
Nice work! I’ve checked it (and other revisions as well) and everything seems fine to me.
I had some problems initially with packet-gen. Somehow the replace() XSLT function failed to work and the result was invalid syntax in the header guards. It took me almost an hour to find a workaround! I tried the latest version of Saxon but there was no change. Finally I came to the idea to try with a different Java virtual machine, took the one from Sun and it worked. Probably something is wrong with java-gcj… no idea!
Hmm, I don’t know - I’ve managed to generate them successfully (when I was trying to change the copy() function return type) with saxon8.jar and Sun’s java.
It’s great to have it done, because now there is no doubt who owns the returned object.
