Error from TStreamerInfo::Build() when TClass::GetStreamerInfo() called on class with member marked "transient"

Hi

I am running a python script that checks the dictionaries of a data class defined in classes_def.xml and classes.h shown below. The script calls TClass::GetStreamerInfo() which produces the error message shown below. Is this output expected?

edmCheckClassVersion.py -l libDataFormatsTestObjects.so -d -x DataFormats/TestObjects/src/classes_def.xml

Error in TStreamerInfo::Build: edmtest::TransientIntProduct, unknown type: edmtest::ProductWithNoDictionary dummy

The error goes away if I add this line to classes_def.xml

<class name="edmtest::ProductWithNoDictionary” transient=“true”/>

Is this the correct remedy?

Patrick Gartung

*********** class_def.xml ***************

************ classes.h *****************

namespace edmtest {

// Toy products

struct ProductWithNoDictionary {
};

struct TransientIntProduct {
explicit TransientIntProduct(int i = 0) : value(i) {}
~TransientIntProduct() {}
typedef unsigned int cms_uint32_t;
cms_uint32_t value;
ProductWithNoDictionary dummy;
};
}

namespace DataFormats_TestObjects {
struct dictionary {
edmtest::TransientIntProduct dummyw13t;
};
}

**************** excerpt from edmCheckClassVersion.py ***************

recursively check the base classes for a class pointer

as building the streamer will crash if base classes are

incomplete

def verifyBaseClasses© :
missingBase = 0

check that all bases are loaded

bases = c.GetListOfBases()
if not bases :
print "Incomplete class ", c.GetName()
return 1

for b in bases :
bc = b.GetClassPointer()
if bc :
missingBase += verifyBaseClasses(bc)
else :
print "Incomplete base class for ", c.GetName(), ": ", b.GetName()
missingBase += 1

return missingBase

def checkDictionaries(name):
c = ROOT.TClass.GetClass(name)
if not c:
raise RuntimeError(“failed to load dictionary for class '”+name+"’")

missingDict = verifyBaseClasses©
if missingDict == 0 :
si = c.GetStreamerInfo()
if si :
ts = si.GetElements()
for telem in ts :
clm = telem.GetClassPointer()
if clm and not clm.IsLoaded() :
print "Missing dictionary for ", telem.GetName(), " type ", clm.GetName();
missingDict += 1
else :
print "No streamer info for ", c.GetName()
missingDict += 1

return missingDict

Hi,

the error prompted by root is due to the fact that “ProductWithNoDictionary” is, as expected, without dictionary: for example it was not selected in any of the xmls of your framework. ROOT informs you that it could not build the streamer info for the class “edmtest::TransientIntProduct” because it does not know anything about “ProductWithNoDictionary” - ROOT cannot persist instances of a class with a datamember which is of a type not known to its type system.
By marking the data member “dummy” of type “ProductWithNoDictionary” transient, you are informing ROOT that it should not persist that particular data member, the problem does not subsist.

Cheers,
Danilo

The problem turned out to be that these statements

should have been combined into one statement

See sft.its.cern.ch/jira/browse/ROOT-7643