Hi Jean-Eric, I just realize now that TRefArray::ls and Dump functions already work as expected (beauties of inheritance). Rene Brun On Fri, 29 Nov 2002, Jean-Eric Campagne wrote: > Dear developpers, I have questions concerning TRefArray(Iter). > > My use case is the following: I have a class A (inherited from TObject) > that have as data member a > TRefArray* fDigitList; > (plus an index variable) > and a method to fill this TRefArray using > void AddDigit(TObject* a) { fDigitList->Add(a); } > > As it is clear the type of object stored in fDigitList are inherited > from TObject but are from different kind. > > I would like to Dump the class A, so I am using A->Dump(): > > ==>Dumping object at:8be69e8, name=RTrackElement, class=RTrackElement > fIndex 5 > *fDigitList ->8bf22b8 > fUniqueID 0 object unique identifier > fBits 50331648 bit field status word > =====> fDigitList: #enties = 5 > > The last line come from the fact that I have overloaded the A::Dump > method of TObject as > > virtual void Dump() const { > TObject::Dump(); > if(fDigitList) { > cout << "=====> fDigitList: #enties = " << (fDigitList->GetLast()+1) > << endl; > TIter next(fDigitList); > TObject* obj; > int iobj = 0; > while( (obj = next()) ) { > cout << "Dump Digit[" << iobj++ << "]" << endl; > obj->Dump(); > } > } > } > > My problem is that I would like to Dump the content of fDigitList not > only the pointer value. It is the reason of the iteration on the > Tobject stored in it. But as you can see I does not get any "Dump > Digit" message this means that next() return 0 even if the TRefArray is > filled. > > Looking at the code (I am using 3.3/05) I have found the method > > TObject *TRefArrayIter::Next() > > always return 0 because the code is commented! > > > 1) How I can dump the class A content and the TRefArray as well? > 2) If I have to iterate on TRefArray how I proceed? > > Regards, > Jean-Eric Campagne > > ............................................................................. > .LAL - IN2P3 - CNRS > .LAL - B.P 34 - 91898 Orsay Cedex - France > .Piece 108 > .Tel +33 (0)1 64 46 84 29 > .Fax +33 (0)1 64 46 83 97 > ........................................................................... >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:21 MET