Details on the use of rootcint are given at: http://root.cern.ch/root/RootCintMan.html To run your example below, I recommend the following procedure. 1- Make a file test.hh (standard class definition) 2- Make a file LinkDef.h 3- rootcint -f test_cint.cc -c -I$ROOTSYS/include test.hh LinkDef.h where: //----file test.hh #include <TObject.h> class VECTOR { protected: int Size; double* V; public: VECTOR(); ClassDef(VECTOR,1) }; //----end of file.hh //----file LinkDef.h #ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class VECTOR; #endif //----end of LinkDef.h When running the rootcint command, you will get the following output: Note: operator new() masked c Note: operator delete() masked c class VECTOR in test.hh line 2 original base of virtual func *** Datamember VECTOR::V: pointer to fundamental type (need manual intervention) The warning message about "fundamental type" means that rootcint was not able to completly generate the code for VECTOR::Streamer. Here is the code generated: //______________________________________________________________________________ void VECTOR::Streamer(TBuffer &R__b) { // Stream an object of class VECTOR. if (R__b.IsReading()) { Version_t R__v = R__b.ReadVersion(); R__b >> Size; //R__b.ReadArray(V); } else { R__b.WriteVersion(VECTOR::IsA()); R__b << Size; //R__b.WriteArray(V, __COUNTER__); } } Because V is a pointer to a double, Root has no way to know the length of what is pointed by V. In your case, it makes a good guess. You should replace the two commented statements above: //R__b.ReadArray(V); //R__b.WriteArray(V, __COUNTER__); respectively by: R__b.ReadFastArray(V, Size); R__b.WriteFastArray(V, Size); (see TBuffer.h) for a list of useful service functions that can be called. Note also that the class VECTOR defined above is already in Root (see class TArrayD). Rene Brun Pasha Murat wrote: > I've been trying to figure out how to use linear algebra classes with ROOT. > There are 2 basically different types of linear algebra packages on the market: > > - the ones using templated classes for vectors and matrices > - the ones not using templates > > In one of the previous postings I asked about how to use templated classes > with 'rootcint'. - May be it is just not possible? > > Using non-templated classes reveals other problems, an example is enclosed > below. > > I'd appreciate any comments, > thanks, Pasha. > > ----------------------------------------------- test.hh > #include "root/Rtypes.h" > class VECTOR { > protected: > int Size; > double* V; > public: > VECTOR(); > ClassDef(VECTOR,1) > }; > > #ifdef __CINT__ > #pragma link off all globals; > #pragma link off all classes; > #pragma link off all functions; > #pragma link C++ class VECTOR; > #endif > ------------------------------------------------ > /cdf/upgrade/tracking/murat/g3/test/glob>rootcint -f test_cint.cc -c -I../include -I$ROOTSYS/include test.hh > Note: operator new() masked c > Warning: Link requested for undefined class test FILE: LINE:0 > -------------------------------------------------------------------------------- > > It looks like the file name matters here (does it really ? ) - if > I rename test.hh into VECTOR.hh the diagnostics is quite different: > > -------------------------------------------------------------------------------- > /cdf/upgrade/tracking/murat/g3/test/glob>mv test.hh VECTOR.hh > /cdf/upgrade/tracking/murat/g3/test/glob>rootcint -f test_cint.cc -c -I../include -I$ROOTSYS/include VECTOR.hh > Note: operator new() masked c > class VECTOR in VECTOR.hh line 2 original base of virtual func > *** Datamember VECTOR::V: pointer to fundamental type (need manual intervention) > > -------------------------------------------------------------------------------- > > - The 1st question here is what's wrong with having pointer to double ? > - It is also interesting to know what kind of "manual intervention" > user is supposed to provide
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:20 MET