Logo ROOT  
Reference Guide
THbookKey.cxx
Go to the documentation of this file.
1// @(#)root/hbook:$Id$
2// Author: Rene Brun 20/02/2002
3
4/*************************************************************************
5 * Copyright (C) 1995-2002, 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
12#include "THbookKey.h"
13#include "THbookTree.h"
14#include "TBrowser.h"
15
17
18/** \class THbookKey
19 \ingroup Hist
20 \brief HBOOK Key
21*/
22
23
24////////////////////////////////////////////////////////////////////////////////
25///constructor
26
28{
30 fID = id;
31 char name[10];
32 snprintf(name,10,"h%d",id);
34}
35
36
37////////////////////////////////////////////////////////////////////////////////
38
40{
41}
42
43////////////////////////////////////////////////////////////////////////////////
44/// Read object from disk and call its Browse() method.
45/// If object with same name already exist in memory delete it (like
46/// TDirectory::Get() is doing), except when the key references a
47/// folder in which case we don't want to re-read the folder object
48/// since it might contain new objects not yet saved.
49
51{
52 fDirectory->cd();
53
55 if (obj && !obj->IsFolder()) {
57 obj->Delete(); // delete also collection elements
58 delete obj;
59 obj = 0;
60 }
61
62 if (!obj)
63 obj = fDirectory->Get(fID);
64
65 if (b && obj) {
66 obj->Browse(b);
67 b->SetRefreshFlag(kTRUE);
68 }
69}
70
71////////////////////////////////////////////////////////////////////////////////
72///an hbook key is not a folder
73
75{
76 Bool_t ret = kFALSE;
77
78
79 return( ret );
80}
void Class()
Definition: Class.C:29
#define b(i)
Definition: RSha256.hxx:100
const Bool_t kFALSE
Definition: RtypesCore.h:90
const Bool_t kTRUE
Definition: RtypesCore.h:89
#define ClassImp(name)
Definition: Rtypes.h:361
XFontStruct * id
Definition: TGX11.cxx:108
char name[80]
Definition: TGX11.cxx:109
#define snprintf
Definition: civetweb.c:1540
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
This class is an interface to the Hbook objects in Hbook files.
Definition: THbookFile.h:29
TObject * Get(Int_t id)
import Hbook object with identifier idd in memory
Definition: THbookFile.cxx:443
TList * GetList() const
Definition: THbookFile.h:63
virtual Bool_t cd(const char *dirname="")
change directory to dirname
Definition: THbookFile.cxx:360
HBOOK Key.
Definition: THbookKey.h:26
virtual ~THbookKey()
Definition: THbookKey.cxx:39
THbookKey()
Definition: THbookKey.h:33
virtual void Browse(TBrowser *b)
Read object from disk and call its Browse() method.
Definition: THbookKey.cxx:50
THbookFile * fDirectory
Definition: THbookKey.h:29
Bool_t IsFolder() const
an hbook key is not a folder
Definition: THbookKey.cxx:74
Int_t fID
pointer to the Hbook file
Definition: THbookKey.h:30
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:577
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Mother of all ROOT objects.
Definition: TObject.h:37
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Definition: TObject.cxx:473
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
Definition: TObject.cxx:119
virtual void Delete(Option_t *option="")
Delete this object.
Definition: TObject.cxx:169
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:443
Definition: file.py:1