Re: [ROOT] I/O on STL vector derived class?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Nov 05 2001 - 12:34:39 MET


Hi Robert,

I have added support for classes deriving directly from a STL container,
like shown in your case.
You can get the current version 3.02/03 (source and binaries)

Rene Brun

Robert Hatcher wrote:
> 
> Hi,
>   I've developed a class that derives from STL vector, ala:
> 
> #include <vector>
> #include "AltListItem.h"
> class AlternativeList : public vector<AltListItem*>
> {
> public:
>   // specialized methods, eg.
>   void   KeepTopChoices(UInt_t n=2, Bool_t keepOrder=false);
>   Bool_t CheckConsistency() const;
> 
>   // additional member variable access
>   Float_t         GetQualityFactor() const;
>   void            SetQualityFactor(Float_t quality);
> 
> protected:
>   Float_t         fQuality; // an overall evaluation of this collection
> }
> 
> What doesn't seem to work is I/O.  If I have a TObject derived class
> that has one of these as a member variable and I write it out to a
> file and then read it back in then the fQuality field is correctly
> restored but the vector itself is empty.  I know that I/O of vector
> objects themselves works, so what would it take to make this case of
> "Is A" work?
> 
> -robert
> 
> Robert W. Hatcher   | rhatcher@fnal.gov   650-840-3102
> FNAL CD/CP (MINOS)  | MS 220, PO Box 500, Batavia IL 60510



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:06 MET