Skip to content
Snippets Groups Projects
Commit 3cffef96 authored by Philippe Canal's avatar Philippe Canal
Browse files

Since the Collection objects do have a name and the Clone method does allow...

Since the Collection objects do have a name and the Clone method does allow (in other cases) for the name to change, add a TCollection::Clone to implement the name change properly


git-svn-id: http://root.cern.ch/svn/root/trunk@37411 27541ba8-7e3a-0410-8455-c3a389f83636
parent c0ffbf94
No related branches found
No related tags found
No related merge requests found
......@@ -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; }
......
......@@ -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
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment