XML and Root

Hi,

I have a follow-up question on using XML and root.

I have a class that embeds (includes as a member variable) another
class via a pointer:

class acquisition: public TObject
{
Int_t num_events;
Int_ t num_sequences;

crate *the_crate

}

The class crate is derived from TObject.

When i write the object to an xml file, it does not seem to serialize the data for crate. It only dumps the pointer. Why is that? In general, if I have embedded objects, are they all written to a TFile when I use the Write() message?

Also, I note in my xml file that the member variable names are not shown. My LinkDef.h file seems ok and is:

#ifdef CINT

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class acquisition+;

#endif

Also, I note that the xml writer doesn’t support certain objects such as trees. is there plan to support this in the future? What is the status of the xml development?

Do you know what the problems are?

Thanks in advance.

Jon

Here is the class definition:

That second class embeds a third class and so on. These second and
third classes are pointers.

When I write an .xml file I note that I only see the first class data
written there. That is, the second and third embedded classes are not
written. Is it possible to have these embedded objects written to the
.xml file aslo?

In general, when I call the write function for an object, will it save
all the embedded objects?

Thanks.

Jon

The simple case that you describe should work with XML.
Could you provide the shortest possible set of files reproducing the problem.
Please indicate which version of ROOT

Rene

Hi,

I am attaching the files. Please take a look mainly at testmainframe.cpp (in acquire sequence). That is where I set up the TFile and XML request. The objects I am trying to store are acquisition which includes a pointer to crate. Crate includes a TObjectArray of dig objects. Dig objects include a TObject array of channel objects, etc.

I am finding that the xml output does not store the member variables for crate or anything further embedded from acquisition. Also, i am finding that the xml file does not list the names of the member variables. I am sure my LinkDef file is right.

Any help would be greatly appreciated.

Thanks in advance.

Jon
code.cpp (20.7 KB)

you sent only one file code.cpp. This file requires several other files (*.h).
Please send also the way you invoke your classses to reproduce the problem.

Rene

Hi,

Can I e-mail you the source code directly. I am having problems with the attachment posting on the site since there are a number of files.

Thank you.

Best Regards,

Jon
crate.h (288 Bytes)
acquisition.h (859 Bytes)
acquisition.cpp (949 Bytes)

Rene,

I have fixed part of my problem. The answer was a problem in my Makefile and the dictionary generation.

However, I have another question/problem.

Some of my classes have a TObjArray as a class member. For example, I have a digitizer object that has a class member that is a TObjArray of channel objects. I notice that my xml file doesn’t seem to include alll the data for the TObjArray member variables (it certainly doesn’t include the member variables of the objects that are stored in the TObjArray).

Does the xml writer work with TObjArrays of other objects.

In addition, when I write a ROOT file (not xml), I assume it will write out all objects stored in a TObjArray that is nested in a class.

Please let me know

Thank you.

Jon

In the list of files that you sent code.cpp and acquisition.cpp are the same.
You did not send a test script, so I cannot test your problem.

[quote]When I write an .xml file I note that I only see the first class data
written there. That is, the second and third embedded classes are not
written. Is it possible to have these embedded objects written to the
.xml file aslo? [/quote]

embedded objects in a class or cllection like TObjArray should be written too.

Rene