Logo ROOT  
Reference Guide
RooSTLRefCountList.cxx
Go to the documentation of this file.
1 // Author: Stephan Hageboeck, CERN, 12/2018
2 /*****************************************************************************
3  * Project: RooFit *
4  * Authors: *
5  * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
6  * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
7  * *
8  * Copyright (c) 2000-2005, Regents of the University of California *
9  * and Stanford University. All rights reserved. *
10  * *
11  * Redistribution and use in source and binary forms, *
12  * with or without modification, are permitted according to the terms *
13  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
14  *****************************************************************************/
15 
16 #include "RooSTLRefCountList.h"
17 
18 #include "RooRefCountList.h"
19 #include "RooLinkedListIter.h"
20 #include "RooAbsArg.h"
21 #include <string>
22 
23 // Template specialisation used in RooAbsArg:
25 
26 namespace RooFit {
27 namespace STLRefCountListHelpers {
28 /// Converts RooRefCountList to RooSTLRefCountList<RooAbsArg>.
29 /// This converter only yields lists with T=RooAbsArg. This is ok because this
30 /// the old RefCountList was only holding these.
33  newList.reserve(old.GetSize());
34 
35  auto it = old.fwdIterator();
36  for (RooAbsArg * elm = it.next(); elm != nullptr; elm = it.next()) {
37  newList.Add(elm, old.refCount(elm));
38  }
39 
40  return newList;
41 }
42 }
43 }
44 
RooLinkedListIter.h
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
RooLinkedList::GetSize
Int_t GetSize() const
Definition: RooLinkedList.h:60
RooAbsArg.h
RooLinkedList::fwdIterator
RooFIter fwdIterator() const
Create a one-time-use forward iterator for this list.
Definition: RooLinkedList.cxx:766
RooSTLRefCountList.h
RooSTLRefCountList::Add
void Add(T *obj, std::size_t initialCount=1)
Add an object or increase refCount if it is already present.
Definition: RooSTLRefCountList.h:51
RooSTLRefCountList::reserve
void reserve(std::size_t amount)
Definition: RooSTLRefCountList.h:102
RooFit
Definition: RooCFunction1Binding.h:29
RooSTLRefCountList< RooAbsArg >
RooRefCountList.h
RooFit::STLRefCountListHelpers::convert
RooSTLRefCountList< RooAbsArg > convert(const RooRefCountList &old)
Converter from the old RooRefCountList to RooSTLRefCountList.
Definition: RooSTLRefCountList.cxx:55
RooAbsArg
Definition: RooAbsArg.h:73
RooRefCountList::refCount
Int_t refCount(TObject *obj) const
Return reference count associated with 'obj'.
Definition: RooRefCountList.cxx:111
RooRefCountList
Definition: RooRefCountList.h:21