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