Re:

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Thu, 12 Jun 2008 17:06:59 +0200


Hi Marc,

On 2008-06-12 16:48, Marc de Kamps wrote:
> I use a Linkdef.h, (attached) and generate the code with:
> rootcint -f dict.cxx -c RootLayerDescription.h

You should pass the Linkdef.h as the last argument, or it won't be picked up.

> In dict.cxx streaming code is generated which looks correct (all member
> variables are present in the Streamer function)

That's the old version, symptomatic of not providing the Linkdef.h with a "+" behind the class name.

> and the C++ program (code
> below) that I use to write the object indeed writes an object to file. There
> is something wrong though: I can not retrieve the object and also it is not
> named correctly! It has as key "RootLayerDescription", but should have
> "goeroeboeroe".

I guess it mostly depends what the (for me rather opaque) ToRootLayerDescription(LAYER_1); returns. I would expect it to replace whatever was contained in desc before; so a priori I would not expect desc to keep its name.

> If I carry out the corresponding code in CINT this works correctly.

Well - I think what you mean is that is does what you expect. But the compiler wins, aka I believe you might have triggered a CINT bug.

> If I use the command suggested by Axel in the mail below:
> rootcint -f dict.x -c RootLaterDescription.h Linkdef.h
>
> the streamer functions again are missing the member variables. Why?

Because the "details" of what needs to be streamed is handled internally, programatically, instead of spelling it out in a fixed, inflexible way. That's why you should use a Linkdef (and provide it to rootcint!) with a "+". Schema evolution is the keyword here.

Cheers, Axel.

> -----------------------------------------------------
>
> // write out a RootLayerDescription
> // The succes must be tested in a ROOT script
>
> RootLayerDescription desc;
> desc.SetName("goeroeboe");
> desc = ToRootLayerDescription(LAYER_1);
>
> TFile file("test/rootlayer.root","RECREATE");
> desc.Write();
> file.Close();
>
> #-----Original Message-----
> #From: owner-roottalk_at_lxbuild091.cern.ch [mailto:owner-
> #roottalk_at_lxbuild091.cern.ch] On Behalf Of Rene Brun
> #Sent: 12 June 2008 14:31
> #To: Axel Naumann
> #Cc: Marc de Kamps; roottalk_at_lxbuild091.cern.ch
> #Subject: Re: [ROOT]
> #
> #Just an addition to Axel's mail
> #You do not need to implement the Streamer function. It is generated
> #automatically by rootcint
> #(or ACLIC). For that the "+" in the LinkDef is the important point.
> #
> #Rene Brun
> #
> #Axel Naumann wrote:
> #> Hi Marc,
> #>
> #> you were unlucky enough to pick a doc format that is completely
> #> incompatible with ROOT's I/O. A data member commented with //! means
> #> "do not stream". And putting a "+" behind the class name in the
> #> LinkDef is sufficient:
> #> rootcint -f dict.x -c RootLaterDescription.h Linkdef.h
> #> should do.
> #>
> #> Cheers, Axel.
> #>
> #> On 2008-06-12 13:26, Marc de Kamps wrote:
> #>>
> #>>
> #>> Hi,
> #>>
> #>>
> #>>
> #>> I have the following problem. I have an object of type
> #>> RootLayerDescription. Within CINT I am able to use it. I can set
> #>> values of its members and write it into a file.
> #>>
> #>> If I read it back from the file in a later CINT session, however, all
> #>> member variables have the default values given by the constructor and
> #>> not the values I wanted to save.
> #>>
> #>>
> #>>
> #>> Probably I forgot something trivial, but it would be a great help to
> #>> know what it is.
> #>>
> #>>
> #>>
> #>> If I generate the dictionary file with:
> #>>
> #>> rootcint -f dict.x -c RootLaterDescription.h, I note that no code is
> #>> generated to serialize the member variables (see code below)
> #>>
> #>>
> #>>
> #>>
> #>>
> #>> One final question. If I want to use the new I/O version, my
> #>> understanding is that if I have a LinkDef.h file as the one attached,
> #>> everything is correct. Or do I have to use
> #>>
> #>> rootcint -f dict.x -c RootLaterDescription.h+
> #>>
> #>> to generate the dictionary?
> #>>
> #>>
> #>>
> #>> Thanks,
> #>>
> #>> Marc
> #>>
> #>>
> #>>
> #>> void RootLayerDescription::Streamer(TBuffer &R__b)
> #>>
> #>> {
> #>>
> #>> // Stream an object of class RootLayerDescription.
> #>>
> #>>
> #>>
> #>> UInt_t R__s, R__c;
> #>>
> #>> if (R__b.IsReading()) {
> #>>
> #>> Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
> #>>
> #>> TNamed::Streamer(R__b);
> #>>
> #>> R__b.CheckByteCount(R__s, R__c, RootLayerDescription::IsA());
> #>>
> #>> } else {
> #>>
> #>> R__c = R__b.WriteVersion(RootLayerDescription::IsA(), kTRUE);
> #>>
> #>> TNamed::Streamer(R__b);
> #>>
> #>> R__b.SetByteCount(R__c, kTRUE);
> #>>
> #>> }
> #>>
> #>> }
> #>>
> #>>
> #>>
> #>>
> #>>
> #>>
> #>>
> #>> -
> #>>
> #>> Dr. Marc de Kamps
> #>>
> #>> Biosystems Group
> #>>
> #>> School of Computing
> #>>
> #>> University of Leeds
> #>>
> #>> LS29JT, Leeds , UK
> #>>
> #>>
> #>>
> #>> dekamps_at_comp.leeds.ac.uk <mailto:dekamps_at_comp.leeds.ac.uk>
> #>>
> #>> http:/www.comp.leeds.ac.uk/dekamps
> #>>
> #>>
> #>>
> #>
>
Received on Thu Jun 12 2008 - 17:07:06 CEST

This archive was generated by hypermail 2.2.0 : Thu Jun 12 2008 - 17:50:02 CEST