Logo ROOT   6.14/05
Reference Guide
TKeyMapFile.cxx
Go to the documentation of this file.
1 // @(#)root/io:$Id$
2 // Author: Rene Brun 23/07/97
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 
12 /**
13 \class TKeyMapFile
14 \ingroup IO
15  Utility class for browsing TMapFile objects.
16 
17  When the browser is invoked for a TMapFile, a TKeyMapFile object
18  is created for each object in the mapped file.
19  When a TKeyMapFile object is clicked in the browser, a new copy
20  of this object is copied into the local directory and the action
21  corresponding to object->Browse is executed (typically Draw).
22 */
23 
24 #include "TKeyMapFile.h"
25 #include "TDirectory.h"
26 #include "TMapFile.h"
27 #include "TBrowser.h"
28 
30 
31 ////////////////////////////////////////////////////////////////////////////////
32 /// Default constructor.
33 
34 TKeyMapFile::TKeyMapFile() : TNamed(), fMapFile(0)
35 {
36 }
37 
38 ////////////////////////////////////////////////////////////////////////////////
39 /// Constructor.
40 
41 TKeyMapFile::TKeyMapFile(const char *name, const char *classname, TMapFile *mapfile)
42  : TNamed(name,classname)
43 {
44  fMapFile = mapfile;
45 }
46 
47 ////////////////////////////////////////////////////////////////////////////////
48 /// Browse the contained objects.
49 
51 {
52  TObject *obj = gDirectory->Get((char*)GetName());
53  delete obj;
54  obj = fMapFile->Get(GetName(),0);
55 
56  if( b && obj )
57  obj->Browse( b );
58 }
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Utility class for browsing TMapFile objects.
Definition: TKeyMapFile.h:20
This class implements a shared memory region mapped to a file.
Definition: TMapFile.h:26
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
Definition: TObject.cxx:119
TObject * Get(const char *name, TObject *retObj=0)
Return pointer to object retrieved from shared memory.
Definition: TMapFile.cxx:770
virtual void Browse(TBrowser *b)
Browse the contained objects.
Definition: TKeyMapFile.cxx:50
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
TKeyMapFile()
Default constructor.
Definition: TKeyMapFile.cxx:34
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
TMapFile * fMapFile
Pointer to map file.
Definition: TKeyMapFile.h:26
#define ClassImp(name)
Definition: Rtypes.h:359
Mother of all ROOT objects.
Definition: TObject.h:37
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
#define gDirectory
Definition: TDirectory.h:213
char name[80]
Definition: TGX11.cxx:109