TClonesArray.h

Go to the documentation of this file.
00001 // @(#)root/cont:$Id: TClonesArray.h 33807 2010-06-10 07:23:32Z brun $
00002 // Author: Rene Brun   11/02/96
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, 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_TClonesArray
00013 #define ROOT_TClonesArray
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TClonesArray                                                         //
00019 //                                                                      //
00020 // An array of clone TObjects. The array expands automatically when     //
00021 // adding elements (shrinking can be done by hand).                     //
00022 //                                                                      //
00023 //////////////////////////////////////////////////////////////////////////
00024 
00025 #ifndef ROOT_TObjArray
00026 #include "TObjArray.h"
00027 #endif
00028 
00029 class TClass;
00030 
00031 
00032 class TClonesArray : public TObjArray {
00033 
00034 protected:
00035    TClass       *fClass;       //!Pointer to the class
00036    TObjArray    *fKeep;        //!Saved copies of pointers to objects
00037 
00038 public:
00039    enum {
00040       kForgetBits     = BIT(0),   // Do not create branches for fBits, fUniqueID
00041       kNoSplit        = BIT(1),   // Array not split by TTree::Branch
00042       kBypassStreamer = BIT(12)   // Class Streamer not called (default)
00043    };
00044 
00045    TClonesArray();
00046    TClonesArray(const char *classname, Int_t size = 1000, Bool_t call_dtor = kFALSE);
00047    TClonesArray(const TClass *cl, Int_t size = 1000, Bool_t call_dtor = kFALSE);
00048    TClonesArray(const TClonesArray& tc);          
00049    virtual         ~TClonesArray();
00050    TClonesArray& operator=(const TClonesArray& tc);  
00051    virtual void     Compress();
00052    virtual void     Clear(Option_t *option="");
00053    virtual void     Delete(Option_t *option="");
00054    virtual void     Expand(Int_t newSize);
00055    virtual void     ExpandCreate(Int_t n);
00056    virtual void     ExpandCreateFast(Int_t n);
00057    TClass          *GetClass() const { return fClass; }
00058    virtual void     SetOwner(Bool_t enable = kTRUE);
00059 
00060    void             AddFirst(TObject *) { MayNotUse("AddFirst"); }
00061    void             AddLast(TObject *) { MayNotUse("AddLast"); }
00062    void             AddAt(TObject *, Int_t) { MayNotUse("AddAt"); }
00063    void             AddAtAndExpand(TObject *, Int_t) { MayNotUse("AddAtAndExpand"); }
00064    Int_t            AddAtFree(TObject *) { MayNotUse("AddAtFree"); return 0; }
00065    void             AddAfter(const TObject *, TObject *) { MayNotUse("AddAfter"); }
00066    void             AddBefore(const TObject *, TObject *) { MayNotUse("AddBefore"); }
00067    void             BypassStreamer(Bool_t bypass=kTRUE);
00068    Bool_t           CanBypassStreamer() const { return TestBit(kBypassStreamer); }
00069    void             SetClass(const char *classname,Int_t size=1000);
00070    void             SetClass(const TClass *cl,Int_t size=1000);
00071    
00072    void             AbsorbObjects(TClonesArray* tc); 
00073    void             MultiSort(Int_t nTCs, TClonesArray** tcs, Int_t upto = kMaxInt);
00074    virtual TObject *RemoveAt(Int_t idx);
00075    virtual TObject *Remove(TObject *obj);
00076    virtual void     RemoveRange(Int_t idx1, Int_t idx2);
00077    virtual void     Sort(Int_t upto = kMaxInt);
00078 
00079    TObject         *New(Int_t idx);
00080    TObject         *AddrAt(Int_t idx);
00081    TObject         *&operator[](Int_t idx);
00082    TObject         *operator[](Int_t idx) const;
00083 
00084    ClassDef(TClonesArray,4)  //An array of clone objects
00085 };
00086 
00087 inline TObject *TClonesArray::AddrAt(Int_t idx)
00088 {
00089    return operator[](idx);
00090 }
00091 
00092 #endif

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