TStreamer cannot convert an object from type to the identical type

I am trying enable reflection for a class I am developing named Espresso::RooGLMFunction. Its member objects include

    ...
    std::unique_ptr<Espresso::GLMCalibrationFunction> m_calfun;
    ...

The problem entry appears to be m_calfun, a smart pointer to another of my classes (whose details I can provide if necessary). I enabled reflection for this class and all member classes from my library with standard options (i.e. not adding any lines in XML customizing the separate fields). On face value, this seems to work. In particular, a RooGLMFunction object can be saved in a RooWorkspace without any errors or warnings. However, when I attempt to load the workspace, I get this error:

root [2] ws_GEN->Print("v")
Warning in <TStreamerInfo::BuildOld>: Cannot convert Espresso::RooGLMFunction::m_calfun from type: Espresso::GLMCalibrationFunction to type: Espresso::GLMCalibrationFunction, skip element

Obviously, Espresso::GLMCalibrationFunction and Espresso::GLMCalibrationFunction are the same type, and no conversion is necessary, so I suspect that the error message isn’t telling the whole story. Is there an issue due to the fact that this member object is a unique_ptr? (In my copy constructor for RooGLMFunction, m_calfun is cloned properly).

Which version of ROOT are you using?

I am using 6.08/02 – sorry for not providing this originally.

Hi,

streaming of unique_ptrs is supported. Can you share the header and selection xml?

Cheers,
D

1 Like

The error turned out to have unrelated causes from typos in the XML.

Hi,

it’s great that you could solve your issue :slight_smile:
I am a bit confused by all the deleted posts: it would be very useful for the other users (and our future selves!) to have some additional details in this thread.

Cheers,
D

The deleted posts contain a whole lot of confusing (and somewhat private) code, which ended up being entirely unrelated to the problem – so it really would be more of a distraction to our future selves. If I remember the actual offending bit of code, I will post it; but I think it was one of those cases where several things are wrong simultaneously.

Ok, thanks for clarifying and caring about keeping a clean forum!

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