Linear Collider Forum

Home » Software Tools » LCIO » copy constructor for LCFixedObject
Re: copy constructor for LCFixedObject [message #1314 is a reply to message #1313] Tue, 27 November 2007 00:32 Go to previous message
Messages: 125
Registered: July 2005
Location: CERN
Hello Adrian,

I would use it as a starting point. The default copy constructor calls the copy constructor of its parent, so one would prevent using it in all derived classes. But I don't know if this would compile.

One can always write a copy constructor for your own class by explicitly making it call the default constructor of the parent and implementing the copy functionality manually. But this has to be done deliberately and is what should be in the Clone() function, if I understand it correctly.

I don't know if a "per class" clone function makes sense. Suppose I have a collection with track-hypotheses, each of them containing pointers to hits, but all tracks are pointing to the same hits. Then a clone of the track has to point to copied hits (because one wants to keep them in memory while loading the next event from the file), but one does not want n copies of the hits collection.

How about a clone() method for the LCEvent, which copies everything once and adapts the pointers in the classes to points to the copied objects?



Martin Killenberg

Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:new LCIO release v01-09
Next Topic:getEventMap(), memory consumption
Goto Forum:

Current Time: Fri Dec 6 07:04:29 Pacific Standard Time 2019
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.1.
Copyright ©2001-2010 FUDforum Bulletin Board Software