Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooTObjWrap.h
Go to the documentation of this file.
1/// \cond ROOFIT_INTERNAL
2
3/*****************************************************************************
4 * Project: RooFit *
5 * Package: RooFitCore *
6 * File: $Id: RooTObjWrap.h,v 1.7 2007/05/11 09:11:30 verkerke Exp $
7 * Authors: *
8 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
9 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
10 * *
11 * Copyright (c) 2000-2005, Regents of the University of California *
12 * and Stanford University. All rights reserved. *
13 * *
14 * Redistribution and use in source and binary forms, *
15 * with or without modification, are permitted according to the terms *
16 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
17 *****************************************************************************/
18
19#ifndef ROO_TOBJ_WRAP
20#define ROO_TOBJ_WRAP
21
22#include "Rtypes.h"
23#include "TNamed.h"
24#include "RooLinkedList.h"
25
26class RooTObjWrap : public TNamed {
27public:
28
29 RooTObjWrap(bool isArray=false) : _isArray(isArray), _owning(false) {} ;
30 RooTObjWrap(TObject *inObj, bool isArray = false) : _isArray(isArray), _owning(false)
31 {
32 if (inObj)
33 _list.Add(inObj);
34 }
35 RooTObjWrap(const RooTObjWrap& other) : TNamed(other), _isArray(other._isArray), _owning(false), _list(other._list) {}
36 ~RooTObjWrap() override { if (_owning) _list.Delete() ; } ;
37
38 void setOwning(bool flag) { _owning = flag ; }
39 TObject* obj() const { return _list.At(0) ; }
40 const RooLinkedList& objList() const { return _list ; }
41
42 void setObj(TObject* inObj) {
43 if (!_isArray) {
44 _list.Clear() ;
45 }
46 if (inObj) _list.Add(inObj) ;
47 }
48
49protected:
50
51 bool _isArray ;
52 bool _owning ;
53 RooLinkedList _list ;
54 ClassDefOverride(RooTObjWrap,2) // Container class for Int_t
55};
56
57#endif
58
59/// \endcond
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
void Clear(Option_t *o=nullptr) override
Remove all elements from collection.
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Mother of all ROOT objects.
Definition TObject.h:41
virtual void Delete(Option_t *option="")
Delete this object.
Definition TObject.cxx:248