Logo ROOT   6.16/01
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
27class TObjectSet : public TDataSet {
28protected:
29 enum EOwnerBits { kIsOwner = BIT(23) };
30 TObject *fObj; // TObject to be inserted
31
32public:
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
55inline Long_t TObjectSet::HasData() const {return fObj ? 1 : 0;}
56inline TObject *TObjectSet::GetObject() const {return fObj;}
57inline Bool_t TObjectSet::IsOwner() const {return TestBit(kIsOwner);}
58
59inline void TObjectSet::SetObject(TObject *obj) { SetObject(obj,kTRUE);}
60
61#endif
62
#define b(i)
Definition: RSha256.hxx:100
char Char_t
Definition: RtypesCore.h:29
long Long_t
Definition: RtypesCore.h:50
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:324
#define BIT(n)
Definition: Rtypes.h:82
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
static TObjectSet * instance()
Definition: TObjectSet.h:52
virtual Long_t HasData() const
Definition: TObjectSet.h:55
virtual TObject * AddObject(TObject *obj, Bool_t makeOwner=kTRUE)
Aliase for SetObject method.
Definition: TObjectSet.cxx:57
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)
Definition: TObjectSet.h:56
virtual void SetObject(TObject *obj)
The depricated method (left here for the sake of the backward compatibility)
Definition: TObjectSet.h:59
virtual TDataSet * Instance() const
apply the class default ctor to instantiate a new object of the same kind.
Definition: TObjectSet.cxx:99
virtual Bool_t DoOwner(Bool_t done=kTRUE)
Set / Reset the ownerships and returns the previous status of the ownerships.
Definition: TObjectSet.cxx:85
TObjectSet(const Char_t *name, TObject *obj=0, Bool_t makeOwner=kTRUE)
to be documented
Definition: TObjectSet.cxx:31
TObject * fObj
Definition: TObjectSet.h:30
virtual void Delete(Option_t *opt="")
to be documented
Definition: TObjectSet.cxx:74
virtual void Browse(TBrowser *b)
Browse this dataset (called by TBrowser).
Definition: TObjectSet.cxx:65
virtual ~TObjectSet()
to be documented
Definition: TObjectSet.cxx:48
virtual Bool_t IsOwner() const
Definition: TObjectSet.h:57
Mother of all ROOT objects.
Definition: TObject.h:37
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172