30#ifndef roofit_roofitcore_RooFit_RooCollectionProxy_h
31#define roofit_roofitcore_RooFit_RooCollectionProxy_h
42template <
class RooCollection_t>
63 template <
class Other_t>
65 R__SUGGEST_ALTERNATIVE(
"Copying a collection proxy and giving it a name different from the original proxy "
66 "doesn't make sense in the context of how this class is used. The copy constructor that "
67 "doesn't take a name as the first parameter should be preferred.")
77 template <
class Other_t>
89 template <
class Other_t>
97 RooCollection_t::setName(
other.GetName());
104 RooCollection_t::add(
other);
124 const char *
name()
const override {
return RooCollection_t::GetName(); }
143#ifdef ROOFIT_MEMORY_SAFE_INTERFACES
147#ifdef ROOFIT_MEMORY_SAFE_INTERFACES
162 for (
auto const &arg : list) {
175 RooCollection_t::operator=(
other);
195 throw std::runtime_error(
196 "Attempt to add elements to a RooSetProxy or RooListProxy without owner!"
197 " Please avoid using the RooListProxy default constructor, which should only be used by IO.");
209template <
class RooCollection_t>
213 bool ret = RooCollection_t::add(var,
silent);
225template <
class RooCollection_t>
229 bool ret = RooCollection_t::addOwned(var,
silent);
231 _owner->addServer((
RooAbsArg &)var, _defValueServer, _defShapeServer);
241template <
class RooCollection_t>
247 _owner->addServer((
RooAbsArg &)var, _defValueServer, _defShapeServer);
257template <
class RooCollection_t>
262 if (!RooCollection_t::isOwning())
272template <
class RooCollection_t>
276 if (
ret && !RooCollection_t::isOwning()) {
286template <
class RooCollection_t>
289 if (!RooCollection_t::isOwning()) {
290 for (
auto const &arg : *
this) {
291 if (!RooCollection_t::isOwning()) {
292 _owner->removeServer(*arg);
297 RooCollection_t::removeAll();
304template <
class RooCollection_t>
308 if (RooCollection_t::empty()) {
321 for (
auto const &arg : *
this) {
324 error |= !RooCollection_t::replace(*arg, *
newArg);
329template <
class RooCollection_t>
331 std::unordered_map<RooAbsArg *, RooAbsArg *>
const &
replacements)
334 for (
auto const &arg : *
this) {
337 error |= !RooCollection_t::replace(*arg, *
newArgFound->second);
347template <
class RooCollection_t>
354 os <<
name() <<
"=(";
356 for (
auto const &arg : *
this) {
#define R__SUGGEST_ALTERNATIVE(ALTERNATIVE)
#define ClassDefOverride(name, id)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
const_iterator end() const
Common abstract base class for objects that represent a value and a "shape" in RooFit.
void registerProxy(RooArgProxy &proxy)
Register an RooArgProxy in the proxy list.
void unRegisterProxy(RooArgProxy &proxy)
Remove proxy from proxy list.
Abstract container object that can hold multiple RooAbsArg objects.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
virtual bool addOwned(RooAbsArg &var, bool silent=false)
Add an argument and transfer the ownership to the collection.
virtual RooAbsArg * addClone(const RooAbsArg &var, bool silent=false)
Add a clone of the specified argument to list.
Abstract interface for proxy classes.
Concrete proxy for RooArgSet or RooArgList objects.
RooCollectionProxy & operator=(RooCollectionProxy &&other)=delete
void removeAll() override
Remove all argument inset using remove(const RooAbsArg&).
bool changePointer(const RooAbsCollection &newServerSet, bool nameChange=false, bool factoryInitMode=false) override
Process server change operation on owner.
bool defShapeServer() const
void print(std::ostream &os, bool addContents=false) const override
Printing name of proxy on ostream.
RooCollectionProxy & operator=(const RooCollection_t &other)
Assign values of arguments on other set to arguments in this set.
bool changePointer(std::unordered_map< RooAbsArg *, RooAbsArg * > const &replacements) override
void initializeAfterIOConstructor(RooAbsArg *owner, const Other_t &other)
Initializes this RooCollection proxy from another proxy.
bool addOwned(RooAbsArg &var, bool silent=false) override
Overloaded RooCollection_t::addOwned() method insert object into owning set and registers object as s...
RooCollectionProxy & operator=(RooCollectionProxy const &other)=delete
bool remove(const RooAbsCollection &list, bool silent=false, bool matchByNameOnly=false)
Remove each argument in the input list from our list using remove(const RooAbsArg&).
~RooCollectionProxy() override
bool add(const RooAbsArg &var, bool silent=false) override
Overloaded RooCollection_t::add() method inserts 'var' into set and registers 'var' as server to owne...
RooAbsArg * addClone(const RooAbsArg &var, bool silent=false) override
Overloaded RooCollection_t::addClone() method insert clone of object into owning set and registers cl...
bool add(const RooAbsArg &var, bool valueServer, bool shapeServer, bool silent)
Overloaded RooCollection_t::add() method insert object into set and registers object as server to own...
RooCollectionProxy(const char *inName, RooAbsArg *owner, const Other_t &other)
Copy constructor.
const char * name() const override
bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false) override
Remove object 'var' from set and deregister 'var' as server to owner.
RooCollectionProxy(RooAbsArg *owner, const Other_t &other)
Copy constructor.
bool replace(const RooAbsArg &var1, const RooAbsArg &var2) override
Replace object 'var1' in set with 'var2'.
bool defValueServer() const
RooCollectionProxy(const char *inName, const char *, RooAbsArg *owner, bool defValueServer=true, bool defShapeServer=false)
Construct proxy with given name and description, with given owner The default value and shape dirty p...