StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TObjectSet.h
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 
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 // //
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 
52 inline TObjectSet *TObjectSet::instance()
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 
59 inline void TObjectSet::SetObject(TObject *obj) { SetObject(obj,kTRUE);}
60 
61 #endif
62 
virtual TObject * AddObject(TObject *obj, Bool_t makeOwner=kTRUE)
Aliase for SetObject method.
Definition: TObjectSet.cxx:57
virtual Bool_t DoOwner(Bool_t done=kTRUE)
Definition: TObjectSet.cxx:85
TObjectSet(const Char_t *name, TObject *obj=0, Bool_t makeOwner=kTRUE)
to be documented
Definition: TObjectSet.cxx:31
virtual void Delete(Option_t *opt="")
to be documented
Definition: TObjectSet.cxx:74
virtual void SetObject(TObject *obj)
The depricated method (left here for the sake of the backward compatibility)
Definition: TObjectSet.h:59
virtual void Browse(TBrowser *b)
Browse this dataset (called by TBrowser).
Definition: TObjectSet.cxx:65
virtual TDataSet * Instance() const
Definition: TObjectSet.cxx:99
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)
Definition: TObjectSet.h:56
virtual ~TObjectSet()
to be documented
Definition: TObjectSet.cxx:48