ROOT logo
// @(#)root/hbook:$Id: THbookKey.cxx 35944 2010-09-30 16:04:10Z brun $
// Author: Rene Brun   20/02/2002

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

#include "THbookKey.h"
#include "THbookTree.h"
#include "TBrowser.h"

ClassImp(THbookKey)


//______________________________________________________________________________
THbookKey::THbookKey(Int_t id, THbookFile *file)
{
   //constructor
   fDirectory = file;
   fID = id;
   char name[10];
   snprintf(name,10,"h%d",id);
   SetName(name);
}


//______________________________________________________________________________
THbookKey::~THbookKey()
{
}

//______________________________________________________________________________
void THbookKey::Browse(TBrowser *b)
{
   // Read object from disk and call its Browse() method.
   // If object with same name already exist in memory delete it (like
   // TDirectory::Get() is doing), except when the key references a
   // folder in which case we don't want to re-read the folder object
   // since it might contain new objects not yet saved.

   fDirectory->cd();
   
   TObject *obj = fDirectory->GetList()->FindObject(GetName());
   if (obj && !obj->IsFolder()) {
      if (obj->InheritsFrom(TCollection::Class()))
         obj->Delete();   // delete also collection elements
      delete obj;
      obj = 0;
   }

   if (!obj)
      obj = fDirectory->Get(fID);

   if (b && obj) {
      obj->Browse(b);
      b->SetRefreshFlag(kTRUE);
   }
}

//______________________________________________________________________________
Bool_t THbookKey::IsFolder() const
{
   //an hbook key is not a folder
   Bool_t ret = kFALSE;


   return( ret );
}
 THbookKey.cxx:1
 THbookKey.cxx:2
 THbookKey.cxx:3
 THbookKey.cxx:4
 THbookKey.cxx:5
 THbookKey.cxx:6
 THbookKey.cxx:7
 THbookKey.cxx:8
 THbookKey.cxx:9
 THbookKey.cxx:10
 THbookKey.cxx:11
 THbookKey.cxx:12
 THbookKey.cxx:13
 THbookKey.cxx:14
 THbookKey.cxx:15
 THbookKey.cxx:16
 THbookKey.cxx:17
 THbookKey.cxx:18
 THbookKey.cxx:19
 THbookKey.cxx:20
 THbookKey.cxx:21
 THbookKey.cxx:22
 THbookKey.cxx:23
 THbookKey.cxx:24
 THbookKey.cxx:25
 THbookKey.cxx:26
 THbookKey.cxx:27
 THbookKey.cxx:28
 THbookKey.cxx:29
 THbookKey.cxx:30
 THbookKey.cxx:31
 THbookKey.cxx:32
 THbookKey.cxx:33
 THbookKey.cxx:34
 THbookKey.cxx:35
 THbookKey.cxx:36
 THbookKey.cxx:37
 THbookKey.cxx:38
 THbookKey.cxx:39
 THbookKey.cxx:40
 THbookKey.cxx:41
 THbookKey.cxx:42
 THbookKey.cxx:43
 THbookKey.cxx:44
 THbookKey.cxx:45
 THbookKey.cxx:46
 THbookKey.cxx:47
 THbookKey.cxx:48
 THbookKey.cxx:49
 THbookKey.cxx:50
 THbookKey.cxx:51
 THbookKey.cxx:52
 THbookKey.cxx:53
 THbookKey.cxx:54
 THbookKey.cxx:55
 THbookKey.cxx:56
 THbookKey.cxx:57
 THbookKey.cxx:58
 THbookKey.cxx:59
 THbookKey.cxx:60
 THbookKey.cxx:61
 THbookKey.cxx:62
 THbookKey.cxx:63
 THbookKey.cxx:64
 THbookKey.cxx:65
 THbookKey.cxx:66
 THbookKey.cxx:67
 THbookKey.cxx:68
 THbookKey.cxx:69
 THbookKey.cxx:70
 THbookKey.cxx:71
 THbookKey.cxx:72