TVirtualStreamerInfo.h

Go to the documentation of this file.
00001 // @(#)root/meta:$Id: TVirtualStreamerInfo.h 35394 2010-09-17 19:40:12Z pcanal $
00002 // Author: Rene Brun   05/02/2007
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TVirtualStreamerInfo
00013 #define ROOT_TVirtualStreamerInfo
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TVirtualStreamerInfo   Abstract Interface class                      //
00019 //                                                                      //
00020 // Abstract Interface describing Streamer information for one class.    //
00021 //                                                                      //
00022 //////////////////////////////////////////////////////////////////////////
00023 
00024 #ifndef ROOT_TNamed
00025 #include "TNamed.h"
00026 #endif
00027 
00028 class TFile;
00029 class TClass;
00030 class TObjArray;
00031 class TStreamerElement;
00032 class TStreamerBasicType;
00033 class TVirtualCollectionProxy;
00034 class TClassStreamer;
00035 namespace ROOT { class TCollectionProxyInfo; }
00036 
00037 class TVirtualStreamerInfo : public TNamed {
00038 
00039 protected:
00040    Bool_t            fOptimized;         //! true if the Streamer has been optimized
00041    Bool_t            fIsBuilt;           //! true if the StreamerInfo has been 'built'
00042 
00043 protected:
00044    static  Bool_t    fgCanDelete;        //True if ReadBuffer can delete object
00045    static  Bool_t    fgOptimize;         //True if optimization on
00046    static  Bool_t    fgStreamMemberWise; //True if the collections are to be stream "member-wise" (when possible).
00047    static TVirtualStreamerInfo  *fgInfoFactory;
00048 
00049    TVirtualStreamerInfo(const TVirtualStreamerInfo& info);
00050    TVirtualStreamerInfo& operator=(const TVirtualStreamerInfo&);
00051 
00052 public:
00053 
00054    //status bits
00055    enum { kCannotOptimize        = BIT(12),
00056           kIgnoreTObjectStreamer = BIT(13),  // eventhough BIT(13) is taken up by TObject (to preserverse forward compatibility)
00057           kRecovered             = BIT(14),
00058           kNeedCheck             = BIT(15),
00059           kIsCompiled            = BIT(16)
00060    };
00061 
00062    enum EReadWrite {
00063       kBase        =  0,  kOffsetL = 20,  kOffsetP = 40,  kCounter =  6,  kCharStar = 7,
00064       kChar        =  1,  kShort   =  2,  kInt     =  3,  kLong    =  4,  kFloat    = 5,
00065       kDouble      =  8,  kDouble32=  9,
00066       kUChar       = 11,  kUShort  = 12,  kUInt    = 13,  kULong   = 14,  kBits     = 15,
00067       kLong64      = 16,  kULong64 = 17,  kBool    = 18,  kFloat16 = 19,
00068       kObject      = 61,  kAny     = 62,  kObjectp = 63,  kObjectP = 64,  kTString  = 65,
00069       kTObject     = 66,  kTNamed  = 67,  kAnyp    = 68,  kAnyP    = 69,  kAnyPnoVT = 70,
00070       kSTLp        = 71,
00071       kSkip        = 100, kSkipL = 120, kSkipP   = 140,
00072       kConv        = 200, kConvL = 220, kConvP   = 240,
00073       kSTL         = 300, kSTLstring = 365,
00074       kStreamer    = 500, kStreamLoop = 501,
00075       kCache       = 600,  // Cache the value in memory than is not part of the object but is accessible via a SchemaRule
00076       kArtificial  = 1000, 
00077       kCacheNew    = 1001,
00078       kCacheDelete = 1002,
00079       kMissing     = 99999
00080    };
00081 
00082 //      Some comments about EReadWrite
00083 //      kBase    : base class element
00084 //      kOffsetL : fixed size array
00085 //      kOffsetP : pointer to object
00086 //      kCounter : counter for array size
00087 //      kCharStar: pointer to array of char
00088 //      kBits    : TObject::fBits in case of a referenced object
00089 //      kObject  : Class  derived from TObject
00090 //      kObjectp : Class* derived from TObject and with    comment field //->Class
00091 //      kObjectP : Class* derived from TObject and with NO comment field //->Class
00092 //      kAny     : Class  not derived from TObject
00093 //      kAnyp    : Class* not derived from TObject with    comment field //->Class
00094 //      kAnyP    : Class* not derived from TObject with NO comment field //->Class
00095 // kAnyPnoVT: Class* not derived from TObject with NO comment field //->Class and Class has NO virtual table
00096 // kSTLp    : Pointer to STL container.
00097 //      kTString        : TString, special case
00098 //      kTObject        : TObject, special case
00099 //      kTNamed  : TNamed , special case
00100 
00101 
00102 
00103    TVirtualStreamerInfo();
00104    TVirtualStreamerInfo(TClass * /*cl*/);
00105    virtual            ~TVirtualStreamerInfo();
00106    virtual void        Build() = 0;
00107    virtual void        BuildCheck() = 0;
00108    virtual void        BuildEmulated(TFile *file) = 0;
00109    virtual void        BuildOld() = 0;
00110    virtual Bool_t      BuildFor( const TClass *cl ) = 0;
00111    virtual void        CallShowMembers(void* obj, TMemberInspector &insp) const = 0;
00112    virtual void        Clear(Option_t *) = 0;
00113    virtual Bool_t      CompareContent(TClass *cl,TVirtualStreamerInfo *info, Bool_t warn, Bool_t complete) = 0;
00114    virtual void        Compile() = 0;
00115    virtual void        ForceWriteInfo(TFile *file, Bool_t force=kFALSE) = 0;
00116    virtual Int_t       GenerateHeaderFile(const char *dirname, const TList *subClasses = 0, const TList *extrainfos = 0) = 0;
00117    virtual TClass     *GetActualClass(const void *obj) const = 0;
00118    virtual TClass     *GetClass() const  = 0;
00119    virtual UInt_t      GetCheckSum() const = 0;
00120    virtual Int_t       GetClassVersion() const = 0;
00121    virtual ULong_t    *GetElems()   const = 0;
00122    virtual TObjArray  *GetElements() const = 0;
00123    virtual Int_t       GetOffset(const char *) const = 0;
00124    virtual Int_t      *GetOffsets() const = 0;
00125    virtual Version_t   GetOldVersion() const = 0;
00126    virtual Int_t       GetOnFileClassVersion() const = 0;
00127    virtual Int_t       GetNumber()  const = 0;
00128    virtual Int_t       GetSize()    const = 0;
00129    virtual TStreamerElement   *GetStreamerElement(const char*datamember, Int_t& offset) const = 0;
00130            Bool_t      IsBuilt() const { return fIsBuilt; }
00131            Bool_t      IsCompiled() const { return TestBit(kIsCompiled); }
00132            Bool_t      IsOptimized() const { return fOptimized; }
00133            Int_t       IsRecovered() const { return TestBit(kRecovered); }
00134    virtual void        ls(Option_t *option="") const = 0;
00135    virtual TVirtualStreamerInfo *NewInfo(TClass *cl) = 0;
00136    virtual void       *New(void *obj = 0) = 0;
00137    virtual void       *NewArray(Long_t nElements, void* ary = 0) = 0;
00138    virtual void        Destructor(void* p, Bool_t dtorOnly = kFALSE) = 0;
00139    virtual void        DeleteArray(void* p, Bool_t dtorOnly = kFALSE) = 0;
00140 
00141    virtual void        SetCheckSum(UInt_t checksum) = 0;
00142    virtual void        SetClass(TClass *cl) = 0;
00143    virtual void        SetClassVersion(Int_t vers) = 0;
00144    static  Bool_t      SetStreamMemberWise(Bool_t enable = kTRUE);
00145    virtual void        TagFile(TFile *fFile) = 0;
00146    virtual void        Update(const TClass *oldClass, TClass *newClass) = 0;
00147 
00148    static TStreamerBasicType *GetElementCounter(const char *countName, TClass *cl);
00149 
00150    static Bool_t       CanOptimize();
00151    static Bool_t       GetStreamMemberWise();
00152    static void         Optimize(Bool_t opt=kTRUE);
00153    static Bool_t       CanDelete();
00154    static void         SetCanDelete(Bool_t opt=kTRUE);
00155    static void         SetFactory(TVirtualStreamerInfo *factory);
00156 
00157    virtual TVirtualCollectionProxy *GenEmulatedProxy(const char* class_name) = 0;
00158    virtual TClassStreamer *GenEmulatedClassStreamer(const char* class_name) = 0;
00159    virtual TVirtualCollectionProxy *GenExplicitProxy( const ::ROOT::TCollectionProxyInfo &info, TClass *cl ) = 0;
00160    virtual TClassStreamer *GenExplicitClassStreamer( const ::ROOT::TCollectionProxyInfo &info, TClass *cl ) = 0;
00161    static TVirtualStreamerInfo *Factory();
00162 
00163    //WARNING this class version must be the same as TStreamerInfo
00164    ClassDef(TVirtualStreamerInfo,6)  //Abstract Interface describing Streamer information for one class
00165 };
00166 
00167 #endif

Generated on Tue Jul 5 14:11:41 2011 for ROOT_528-00b_version by  doxygen 1.5.1