Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
23 class RooTObjWrap : public TNamed {
24 public:
25 
26  RooTObjWrap(Bool_t isArray=kFALSE) : _isArray(isArray), _owning(kFALSE) {} ;
27  RooTObjWrap(TObject* inObj, Bool_t isArray=kFALSE) : TNamed(), _isArray(isArray), _owning(kFALSE) { if (inObj) _list.Add(inObj) ; }
28  RooTObjWrap(const RooTObjWrap& other) : TNamed(other), _isArray(other._isArray), _owning(kFALSE), _list(other._list) {}
29  virtual ~RooTObjWrap() { if (_owning) _list.Delete() ; } ;
30 
31  void setOwning(Bool_t 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 
42 protected:
43 
44  Bool_t _isArray ;
45  Bool_t _owning ;
46  RooLinkedList _list ;
47  ClassDef(RooTObjWrap,2) // Container class for Int_t
48 };
49 
50 #endif