Re: PacketBase - copy() returning an auto_ptr

Hi Petr,

but I’ve ran into many troubles - copy() change is needed not only in the base class/xsl templates, but in many other sources (every copy() must returns auto_ptr ) and I finally haven’t managed to do that, so I think it would be better that you will take a look at it.

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.

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!

You might want to check my latest revision.

Regards,

Peter

Would you like to post a relpy?


This post is a reply to:
PacketBase - copy() returning an auto_ptr
Hi Peter, I was trying to do this \todo as you've suggested: Btw. another \todo could be to make copy() return an auto_ptr. This way passing ownership of the object to (more...)

Follow-ups:
Re: PacketBase - copy() returning an auto_ptr
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 (more...)