I/O
File Format
TFile::MakeProject
Extend TFile::MakeProject to support genreflex, cases of user's data model where
the 2 distincts pointers point to a single object and more cases where we are
missing the StreamerInfo and need to guess whether the symbol represent an enum,
a class or a namespace.
To use genreflex, call MakeProject with the "genreflex" option, for example:
file->MakeProject(libdir,"*","NEW+genreflex");
To make sure the library created by MakeProject does not double delete an object,
tell the StreamerElement representing one of the pointers pointing to the object
to never delete the object. For example:
TClass::AddRule("HepMC::GenVertex m_event attributes=NotOwner");
MakeProject now implements a move constructor for each classes. For the implementation, we 'use' the 'copy constructor' until the C++ compilers properly support the official move constructor notation. Implementing a move constructor avoid having to delete and reconstruct resource during a std::vector resize and avoid the double delete induced by using the default copy constructor.
Misc.
- Enable the use of the I/O customization rules on data members that are either a variable size array or a fixed size array. For example:
#pragma read sourceClass = "ACache" targetClass = "ACache" version = "[8]" \
source = "Int_t *fArray; Int_t fN;" \
target = "fArray" \
code = "{ fArray = new Char_t[onfile.fN]; Char_t* gtc=fArray; Int_t* gti=onfile.fArray; for(Int_t i=0; i
- New option to hadd, -O requesting the (re)optimization of the basket size (by avoid the fast merge technique). The equivalent in TFileMerger is to call
merger->SetFastMethod(kFALSE)
- To make sure that the class emulation layer of ROOT does not double delete an object,
tell the StreamerElement representing one of the pointers pointing to the object
to never delete the object. For example:
TClass::AddRule("HepMC::GenVertex m_event attributes=NotOwner");
- The handling of memory by the collection proxy has been improved in the case of a
collection of pointers which can now become owner of its content.
The default, for backward compatibility reasons and to avoid double delete (at the expense
of memory leaks), the container of pointers are still not owning their content
unless they are a free standing container (i.e. itself not contained in another
object).
To make a container of pointers become owner of its content do something like:
TClass::AddRule("ObjectVector<LHCb::MCRichDigitSummary> m_vector options=Owner");
For MakeProject, use file->GetStreamerInfoCache() instead of the TClass GetStreamerInfo.
- TH1::Streamer and TGraph2D::Streamer no longer reset the kCanDelete bit directly so that the user can give
ownership of the object to the canvas they are stored with. However, if they are saved on their own, the mechanism
that associates them to the current directory (DirectoryAutoAdd) will now reset the bit to avoid any possible
ownsership confusion.
- Added TFile::SetOffset and TFile::ReadBuffer(char *buf, Long64_t pos, Int_t len); to drastically reduce
the number of fseek done on the physical file when using the TTreeCache.