ROOT I/O - classes w/ and w/o "version" header on-disk


I am in the process of regularizing groot’s I/O system and while planning for the refactoring, it occurred to me I didn’t completely grasp the mental model for when the on-disk representation of a value (of some type) had the 4+2 bytes header (usually holding a version + byte count).

for example, a TString doesn’t need such a header, but a std::string does.
and std::vector<T> needs it, but in some cases, doesn’t (usually, IIUC, the decision whether to include a header is related to whether the container is “nested” or not).

is there a formalized document that specifies all this, or a rationale one can hang to?

also: is this mechanism specified in next-gen I/O, a.k.a RNTuple ? (apologies, I haven’t read in details the RNTuple on-disk representation specifications. yet.)

thanks for any (BSD-friendly) pointer,

TString is special (treated as a char array per se). I think/guess the same was originally planned for std::string but something happened somewhere and it got treated “as” the other STL collection (but only sort of) …

The STL collections should always be prefixed by the version info (convoluted with the memberwise or objectwise bit).

The only exception would be in the case of the outer class in a TBaskets (where the version info is redundant).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.