Logo ROOT  
Reference Guide
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_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
42protected:
43
47 ClassDef(RooTObjWrap,2) // Container class for Int_t
48};
49
50#endif
const Bool_t kFALSE
Definition: RtypesCore.h:101
bool Bool_t
Definition: RtypesCore.h:63
#define ClassDef(name, id)
Definition: Rtypes.h:325
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:38
TObject * At(int index) const
Return object stored in sequential position given by index.
void Delete(Option_t *o=0)
Remove all elements in collection and delete all elements NB: Collection does not own elements,...
virtual void Add(TObject *arg)
Definition: RooLinkedList.h:67
void Clear(Option_t *o=0)
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(Bool_t isArray=kFALSE)
Definition: RooTObjWrap.h:26
RooTObjWrap(TObject *inObj, Bool_t isArray=kFALSE)
Definition: RooTObjWrap.h:27
void setOwning(Bool_t flag)
Definition: RooTObjWrap.h:31
const RooLinkedList & objList() const
Definition: RooTObjWrap.h:33
RooTObjWrap(const RooTObjWrap &other)
Definition: RooTObjWrap.h:28
void setObj(TObject *inObj)
Definition: RooTObjWrap.h:35
Bool_t _owning
Definition: RooTObjWrap.h:45
Bool_t _isArray
Definition: RooTObjWrap.h:44
virtual ~RooTObjWrap()
Definition: RooTObjWrap.h:29
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
Mother of all ROOT objects.
Definition: TObject.h:37