Re: once again about TClonesArray
Pasha Murat (murat@cdfsga.fnal.gov)
Thu, 24 Dec 1998 17:40:53 -0600 (CST)
Victor Perevoztchikov writes:
> Hi Pasha,
> ...
> > This would allow to decouple to a certain extent the use of TClonesArray's and
> > the generation of the dictionaries which would be very nice from the point of
> > view of general design.
>
> TClonesArray and TObjArray have principal difference.
>
> In TObjArray user creates the object and then saves its pointer into TObjArray.
>
> In TCloneArray creation is made inside TCloneArray class by special new operator
> which allows reuse space. The same with delete, which actually did not do
> real delete but only marks this part of memory as a free.
>
> But in C++ you can not create the object defined by textual name of class. In TCloneArray
> there is only text name of class. Somewhere must be compiled code like
> "pointer = new Classname();"
> This code is provided by CINT and then this code is compiled. Access to this compiled
> code is possible only via CINT dictionary.
>
> So, TCloneArray is principally linked with CINT and CINT dictionary.
Dear Victor: let me disagree with what you're saying. Yes, to store an object in
TClonesArray you're supposed to use `new with placement'. However if you look at
its implementation (see NEW_NewDelete.cxx) you'll see that it has nothing to do
with CINT. So it should be possible to store objects in TClonesArray, retrieve them,
sort them etc without generating dictionaries for these objects. Only when one
asks for a dictionary explicitly - for example, when writing TClonesArray out in
split mode, - the absense of it could be an obstacle.
Merry Christmas, pasha