ROOT  6.06/09
Reference Guide
TObjectSet.h
Go to the documentation of this file.
1 // @(#)root/table:$Id$
2 // Author: Valery Fine(fine@bnl.gov) 25/12/98
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 #ifndef ROOT_TObjectSet
12 #define ROOT_TObjectSet
13 
14 #include "TDataSet.h"
15 
16 //////////////////////////////////////////////////////////////////////////////////////
17 // //
18 // TObjectSet - is a container TDataSet //
19 // This means this object has an extra pointer to an embedded //
20 // TObject. //
21 // Terminology: This TObjectSet may be an OWNER of the embeded TObject //
22 // If the container is the owner it can delete the embeded object //
23 // otherwsie it leaves that object "as is" //
24 // //
25 //////////////////////////////////////////////////////////////////////////////////////
26 
27 class TObjectSet : public TDataSet {
28 protected:
29  enum EOwnerBits { kIsOwner = BIT(23) };
30  TObject *fObj; // TObject to be inserted
31 
32 public:
33  TObjectSet(const Char_t *name, TObject *obj=0,Bool_t makeOwner=kTRUE);
34  TObjectSet(TObject *obj=0,Bool_t makeOwner=kTRUE);
35  virtual ~TObjectSet();
36  virtual TObject *AddObject(TObject *obj,Bool_t makeOwner=kTRUE);
37  virtual void Browse(TBrowser *b);
38  virtual void Delete(Option_t *opt="");
39  virtual Bool_t DoOwner(Bool_t done=kTRUE);
40  virtual Long_t HasData() const;
41  virtual TObject *GetObject() const;
42  virtual TDataSet *Instance() const;
43  virtual Bool_t IsOwner() const;
44  virtual void SetObject(TObject *obj);
45  virtual TObject *SetObject(TObject *obj,Bool_t makeOwner);
46 
47  static TObjectSet *instance();
48 
49  ClassDef(TObjectSet,1) // TDataSet wrapper for TObject class objects
50 };
51 
53 { return new TObjectSet();}
54 
55 inline Long_t TObjectSet::HasData() const {return fObj ? 1 : 0;}
56 inline TObject *TObjectSet::GetObject() const {return fObj;}
57 inline Bool_t TObjectSet::IsOwner() const {return TestBit(kIsOwner);}
58 
60 
61 #endif
62 
virtual TObject * AddObject(TObject *obj, Bool_t makeOwner=kTRUE)
Aliase for SetObject method.
Definition: TObjectSet.cxx:57
const char Option_t
Definition: RtypesCore.h:62
#define BIT(n)
Definition: Rtypes.h:120
virtual Bool_t DoOwner(Bool_t done=kTRUE)
Set / Reset the ownerships and returns the previous status of the ownerships.
Definition: TObjectSet.cxx:85
bool Bool_t
Definition: RtypesCore.h:59
virtual Bool_t IsOwner() const
Definition: TObjectSet.h:57
TObjectSet(const Char_t *name, TObject *obj=0, Bool_t makeOwner=kTRUE)
#define ClassDef(name, id)
Definition: Rtypes.h:254
TObject * fObj
Definition: TObjectSet.h:30
virtual void Delete(Option_t *opt="")
to be documented
Definition: TObjectSet.cxx:74
virtual Long_t HasData() const
Definition: TObjectSet.h:55
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:41
virtual void SetObject(TObject *obj)
The depricated method (left here for the sake of the backward compatibility)
Definition: TObjectSet.h:59
static TObjectSet * instance()
Definition: TObjectSet.h:52
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:173
long Long_t
Definition: RtypesCore.h:50
virtual void Browse(TBrowser *b)
Browse this dataset (called by TBrowser).
Definition: TObjectSet.cxx:65
virtual TDataSet * Instance() const
apply the class default ctor to instantiate a new object of the same kind.
Definition: TObjectSet.cxx:99
#define name(a, b)
Definition: linkTestLib0.cpp:5
Mother of all ROOT objects.
Definition: TObject.h:58
char Char_t
Definition: RtypesCore.h:29
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)
Definition: TObjectSet.h:56
const Bool_t kTRUE
Definition: Rtypes.h:91
TObject * obj
virtual ~TObjectSet()
to be documented
Definition: TObjectSet.cxx:48