diff --git a/core/cont/inc/TCollection.h b/core/cont/inc/TCollection.h index 9c8d2611a87e3a25e5ef69cb7de15b5bf04b538d..34f2b334bbfb5f6d88bc3bef74ee7a28dd64b75f 100644 --- a/core/cont/inc/TCollection.h +++ b/core/cont/inc/TCollection.h @@ -78,6 +78,7 @@ public: void Browse(TBrowser *b); Int_t Capacity() const { return fSize; } virtual void Clear(Option_t *option="") = 0; + virtual TObject *Clone(const char *newname="") const; Int_t Compare(const TObject *obj) const; Bool_t Contains(const char *name) const { return FindObject(name) != 0; } Bool_t Contains(const TObject *obj) const { return FindObject(obj) != 0; } diff --git a/core/cont/src/TCollection.cxx b/core/cont/src/TCollection.cxx index 9677c24debc101c150bd8a03549547bb62cc5279..c632446f3316b1ab83b5da9ed920b89cf5b30322 100644 --- a/core/cont/src/TCollection.cxx +++ b/core/cont/src/TCollection.cxx @@ -125,6 +125,18 @@ void TCollection::Browse(TBrowser *b) TObject::Browse(b); } +//______________________________________________________________________________ +TObject *TCollection::Clone(const char *newname) const +{ + // Make a clone of an collection using the Streamer facility. + // If newname is specified, this will be the name of the new collection. + + TCollection *new_collection = (TCollection*)TObject::Clone(newname); + if (newname && strlen(newname)) new_collection->SetName(newname); + return new_collection; +} + + //______________________________________________________________________________ Int_t TCollection::Compare(const TObject *obj) const {