// @(#)root/table:$Id$
// Author: Valery Fine(fine@bnl.gov)   25/12/98

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/
#ifndef ROOT_TObjectSet
#define ROOT_TObjectSet

#include "TDataSet.h"

//////////////////////////////////////////////////////////////////////////////////////
//                                                                                  //
//  TObjectSet  - is a container TDataSet                                           //
//                  This means this object has an extra pointer to an embedded      //
//                  TObject.                                                        //
//  Terminology:    This TObjectSet may be an OWNER of the embeded TObject          //
//                  If the container is the owner it can delete the embeded object  //
//                  otherwsie it leaves that object "as is"                         //
//                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////

class TObjectSet : public TDataSet {
protected:
   enum EOwnerBits { kIsOwner         = BIT(23) };
   TObject *fObj;                              // TObject to be inserted

public:
   TObjectSet(const Char_t *name, TObject *obj=0,Bool_t makeOwner=kTRUE);
   TObjectSet(TObject *obj=0,Bool_t makeOwner=kTRUE);
   virtual ~TObjectSet();
   virtual TObject *AddObject(TObject *obj,Bool_t makeOwner=kTRUE);
   virtual void     Browse(TBrowser *b);
   virtual void     Delete(Option_t *opt="");
   virtual Bool_t   DoOwner(Bool_t done=kTRUE);
   virtual Long_t   HasData() const;
   virtual TObject *GetObject() const;
   virtual TDataSet *Instance() const;
   virtual Bool_t   IsOwner() const;
   virtual void     SetObject(TObject *obj);
   virtual TObject *SetObject(TObject *obj,Bool_t makeOwner);

   static TObjectSet *instance();

   ClassDef(TObjectSet,1) // TDataSet wrapper for TObject class objects
};

inline TObjectSet *TObjectSet::instance()
{ return new TObjectSet();}

inline Long_t   TObjectSet::HasData()   const {return fObj ? 1 : 0;}
inline TObject *TObjectSet::GetObject() const {return fObj;}
inline Bool_t   TObjectSet::IsOwner()   const {return TestBit(kIsOwner);}

inline void     TObjectSet::SetObject(TObject *obj) { SetObject(obj,kTRUE);}

#endif

 TObjectSet.h:1
 TObjectSet.h:2
 TObjectSet.h:3
 TObjectSet.h:4
 TObjectSet.h:5
 TObjectSet.h:6
 TObjectSet.h:7
 TObjectSet.h:8
 TObjectSet.h:9
 TObjectSet.h:10
 TObjectSet.h:11
 TObjectSet.h:12
 TObjectSet.h:13
 TObjectSet.h:14
 TObjectSet.h:15
 TObjectSet.h:16
 TObjectSet.h:17
 TObjectSet.h:18
 TObjectSet.h:19
 TObjectSet.h:20
 TObjectSet.h:21
 TObjectSet.h:22
 TObjectSet.h:23
 TObjectSet.h:24
 TObjectSet.h:25
 TObjectSet.h:26
 TObjectSet.h:27
 TObjectSet.h:28
 TObjectSet.h:29
 TObjectSet.h:30
 TObjectSet.h:31
 TObjectSet.h:32
 TObjectSet.h:33
 TObjectSet.h:34
 TObjectSet.h:35
 TObjectSet.h:36
 TObjectSet.h:37
 TObjectSet.h:38
 TObjectSet.h:39
 TObjectSet.h:40
 TObjectSet.h:41
 TObjectSet.h:42
 TObjectSet.h:43
 TObjectSet.h:44
 TObjectSet.h:45
 TObjectSet.h:46
 TObjectSet.h:47
 TObjectSet.h:48
 TObjectSet.h:49
 TObjectSet.h:50
 TObjectSet.h:51
 TObjectSet.h:52
 TObjectSet.h:53
 TObjectSet.h:54
 TObjectSet.h:55
 TObjectSet.h:56
 TObjectSet.h:57
 TObjectSet.h:58
 TObjectSet.h:59
 TObjectSet.h:60
 TObjectSet.h:61
 TObjectSet.h:62