Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
26namespace RooFit {
27namespace 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
#define ClassImp(name)
Definition Rtypes.h:364
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition RooAbsArg.h:72
Int_t GetSize() const
RooFIter fwdIterator() const
Create a one-time-use forward iterator for this list.
A RooRefCountList is a RooLinkedList that keeps a reference counter with each added node.
Int_t refCount(TObject *obj) const
Return reference count associated with 'obj'.
The RooSTLRefCountList is a simple collection of pointers to the template objects with reference coun...
void Add(T *obj, std::size_t initialCount=1)
Add an object or increase refCount if it is already present.
void reserve(std::size_t amount)
RooSTLRefCountList< RooAbsArg > convert(const RooRefCountList &old)
Converter from the old RooRefCountList to RooSTLRefCountList.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...