Home | News | Documentation | Download

StreamerInfo::Build when reading custom classes. Warning on std::tuple and std::pair

Dear Experts
I have a framework where i compile my own classes.
When i try to “read” from disk some object i save
I get this warning

Warning in <TStreamerInfo::Build>: pair<TString,tuple<bool,double,double> >: tuple<bool,double,double> has no streamer or dictionary, data member "second" will not be saved

According to what is discussed in this thread


Either the ROOT version i have is not able to generate the streamer for those classes or i miss something in my LinkDef about namespace std; usage or actually move to specify std:: everywhere.
Can I rule out the first option?

Thanks in advance ,
Renato

$|=>root --version
ROOT Version: 6.18/04
Built for linuxx8664gcc on Sep 11 2019, 15:38:23
From tags/v6-18-04@v6-18-0

To give more context , i have a class inheriting from TObject which saves a private member as :

../../kernel/inc/FitConfiguration.hpp:    map< TString, tuple< bool, double, double > > m_namedRangeFits;

thus i expect the Warning on the pair stuff comes from this.

Actually i just realized i have also all those warnigns when “writing” to disk

Warning in <TStreamerInfo::Build>: pair<TString,tuple<bool,double,double> >: tuple<bool,double,double> has no streamer or dictionary, data member "second" will not be saved
Warning in <TStreamerInfo::Build>: pair<TString,tuple<EventType,TString,TString> >: tuple<EventType,TString,TString> has no streamer or dictionary, data member "second" will not be saved
Warning in <TStreamerInfo::Build>: pair<pySample::Sample,tuple<pyPdfType::PdfType,TString,TString,TString,TString,double> >: tuple<pyPdfType::PdfType,TString,TString,TString,TString,double> has no streamer or dictionary, data member "second" will not be saved
Warning in <TStreamerInfo::Build>: pair<pyBrem::Brem,tuple<pyPdfType::PdfType,TString,TString,TString,TString,double> >: tuple<pyPdfType::PdfType,TString,TString,TString,TString,double> has no streamer or dictionary, data member "second" will not be saved
Warning in <TStreamerInfo::Build>: pair<pair<FitParameterConfig,pyRatioType::RatioType>,ParameterWrapper>: pair<FitParameterConfig,pyRatioType::RatioType> has no streamer or dictionary, data member "first" will not be saved

where the pyXX::XX are enumerator classes and FitParameterConfig,EventType are custom classes

I tried to add

#pragma link C++ class std::tuple<bool,double,double>+;
#pragma link C++ class std::pair<TString,std::tuple<bool,double,double>>+;

on top of my LinkDef,
And the other ones which relies on a given class i compile in this scheme

#pragma link C++ namespace pyPrj;
#pragma link C++ enum pyPrj::Prj;
#pragma link C++ namespace pyAnalysis;
#pragma link C++ enum pyAnalysis::Analysis;
#pragma link C++ namespace pySample;
#pragma link C++ enum pySample::Sample;
#pragma link C++ namespace pyQ2Bin;
#pragma link C++ enum pyQ2Bin::Q2Bin;
#pragma link C++ namespace pyYear;
#pragma link C++ enum pyYear::Year;
#pragma link C++ namespace pyPolarity;
#pragma link C++ enum pyPolarity::Polarity;
#pragma link C++ namespace pyTrigger;
#pragma link C++ enum pyTrigger::Trigger;
#pragma link C++ namespace pyTriggerConf;
#pragma link C++ enum pyTriggerConf::TriggerConf;
#pragma link C++ namespace pyBrem;
#pragma link C++ enum pyBrem::Brem;
#pragma link C++ namespace pyPdfType;
#pragma link C++ enum pyPdfType::PdfType;
#pragma link C++ namespace pyOpenMode;
#pragma link C++ enum pyOpenMode::OpenMode;
#pragma link C++ namespace pyBlindMode;
#pragma link C++ enum pyBlindMode::BlindMode;
#pragma link C++ defined_in "EnumeratorSvc.hpp";


/*
This when saving fits to disk...
Warning in <TStreamerInfo::Build>: pair<TString,tuple<bool,double,double> >: tuple<bool,double,double> has no streamer or dictionary, data member "second" will not be saved
Warning in <TStreamerInfo::Build>: pair<TString,tuple<EventType,TString,TString> >: tuple<EventType,TString,TString> has no streamer or dictionary, data member "second" will not be saved
Warning in <TStreamerInfo::Build>: pair<pySample::Sample,tuple<pyPdfType::PdfType,TString,TString,TString,TString,double> >: tuple<pyPdfType::PdfType,TString,TString,TString,TString,double> has no streamer or dictionary, data member "second" will not be saved
Warning in <TStreamerInfo::Build>: pair<pyBrem::Brem,tuple<pyPdfType::PdfType,TString,TString,TString,TString,double> >: tuple<pyPdfType::PdfType,TString,TString,TString,TString,double> has no streamer or dictionary, data member "second" will not be saved
Warning in <TStreamerInfo::Build>: pair<pair<FitParameterConfig,pyRatioType::RatioType>,ParameterWrapper>: pair<FitParameterConfig,pyRatioType::RatioType> has no streamer or dictionary, data member "first" will not be saved
*/
#pragma link C++ class std::tuple<EventType,TString,TString>+;
#pragma link C++ class std::pair<pySample::Sample,std::tuple<pyPdfType::PdfType,TString,TString,TString,TString,double> >+;
#pragma link C++ class std::pair<pySample::Sample,std::tuple<pyPdfType::PdfType,TString,TString,TString,TString,double> >+;
#pragma link C++ class std::pair<pyBrem::Brem,std::tuple<pyPdfType::PdfType,TString,TString,TString,TString,double> >+;
#pragma link C++ class std::tuple<pyPdfType::PdfType,TString,TString,TString,TString,double>+; //needed as private in FitConfiguration.hpp

#pragma link C++ class FitConfiguration+;
#pragma link C++ defined_in "FitConfiguration.hpp";

so the tuple, pair stuff after the LinkDef knows about enumerators, and before the class which uses it as private member.
Is this the recommended way?
If i move around the LinkDef orders, i get some Warning Unused class stuff.
Currently testing if Warnings will be gone with that. But any help in the meanwhile is welcome.
Thanks

Is this the recommended way?

Yes. With v6.24 those pragma link for std::pair should no longer be necessary but also won’t hurt.

Ok, most of my errors are gone. I am left with

Warning in <TStreamerInfo::Build>: pair<pair<FitParameterConfig,pyRatioType::RatioType>,ParameterWrapper>: pair<FitParameterConfig,pyRatioType::RatioType> has no streamer or dictionary, data member "first" will not be saved

However i am not sure for this how to further debug what to add in.

You would need a dictionary for

  • FitParameterConfig
  • pyRatioType::RatioType
  • pair<FitParameterConfig,pyRatioType::RatioType> (the one explicitly complained about)
  • ParameterWrapper
  • pair<pair<FitParameterConfig,pyRatioType::RatioType>,ParameterWrapper>

To check if you do already have those either use grep :slight_smile: or from the ROOT prompt, use:

auto c = TClass::GetClass("someclassname");
If (!c || !c->IsLoaded())
    printf("Problem: dictionary for someclassname is missing\n");

Thanks a lot!
I will use this strategy to better ensure my framework is complete in this respect.

I moved around those pragmas before /after the place where i expect for some custom class i compile the private members to be the pair i mentioned and now i never get the Warning!
Thanks again for the help

You may also be interested by the method TClass::GetMissingDictionaries

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