Hi Marc,
you can just include vector<MyClass> in the same dictionary and linkdef as MyClass. Put a "+" for both, i.e.
#pragma link C++ class MyClass+;
#pragma link C++ class vector<MyClass>+;
The difference with vector<int> is that the latter is not "yours" - there would be too many instances of dictionaries for vector<int> if everybody would define his / her own. So ROOT provides one. We need to think of a way to make access to that a bit easier. vector<MyClass>, on the other hand, is just a regular class.
Cheers, Axel.
From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On
Behalf Of Marc de Kamps
Sent: Friday, 23 November 2007 19:11
To: roottalk_at_lxbuild091.cern.ch
Subject: [ROOT] Writing a vector of added class to file
Hi,
Last week I learned (with some help) how I could add a class which
internally usew a vector<double> to ROOT and successfully wrote that object
to a file.
One of the things I forgot was to add the vector dictionary in the compiled
C++ program and after this, things worked.
What if I now want to add a class which contains not a vector<double> but a
vector<MyClass>? Does the line
gROOT->ProcessLine("#include <vector>")
still load the dictionary for vector<MyClass>? Or is this where LinkDef.h
comes in. I’m confused at this point.
Thanks,
Marc
-
Dr. Marc de Kamps
Biosystems Group
School of Computing
University of Leeds
LS29JT, Leeds, UK
dekamps_at_comp.leeds.ac.uk
http:/www.comp.leeds.ac.uk/dekamps
Received on Sun Nov 25 2007 - 13:41:22 CET
This archive was generated by hypermail 2.2.0 : Mon Nov 26 2007 - 23:50:02 CET