00001 /***************************************************************************** 00002 * Project: RooFit * 00003 * Package: RooFitCore * 00004 * File: $Id: RooTObjWrap.h,v 1.7 2007/05/11 09:11:30 verkerke Exp $ 00005 * Authors: * 00006 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu * 00007 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu * 00008 * * 00009 * Copyright (c) 2000-2005, Regents of the University of California * 00010 * and Stanford University. All rights reserved. * 00011 * * 00012 * Redistribution and use in source and binary forms, * 00013 * with or without modification, are permitted according to the terms * 00014 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) * 00015 *****************************************************************************/ 00016 #ifndef ROO_TOBJ_WRAP 00017 #define ROO_TOBJ_WRAP 00018 00019 #include "Rtypes.h" 00020 #include "TNamed.h" 00021 #include "RooLinkedList.h" 00022 00023 class RooTObjWrap : public TNamed { 00024 public: 00025 00026 RooTObjWrap(Bool_t isArray=kFALSE) : _isArray(isArray), _owning(kFALSE) {} ; 00027 RooTObjWrap(TObject* inObj, Bool_t isArray=kFALSE) : TNamed(), _isArray(isArray), _owning(kFALSE) { _list.Add(inObj) ; } 00028 RooTObjWrap(const RooTObjWrap& other) : TNamed(other), _isArray(other._isArray), _owning(kFALSE), _list(other._list) {} 00029 virtual ~RooTObjWrap() { if (_owning) _list.Delete() ; } ; 00030 00031 void setOwning(Bool_t flag) { _owning = flag ; } 00032 TObject* obj() const { return _list.At(0) ; } 00033 const RooLinkedList& objList() const { return _list ; } 00034 00035 void setObj(TObject* inObj) { 00036 if (!_isArray) { 00037 _list.Clear() ; 00038 } 00039 _list.Add(inObj) ; 00040 } 00041 00042 protected: 00043 00044 Bool_t _isArray ; 00045 Bool_t _owning ; 00046 RooLinkedList _list ; 00047 ClassDef(RooTObjWrap,2) // Container class for Int_t 00048 }; 00049 00050 #endif