Logo ROOT  
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
35{
36}
37
38////////////////////////////////////////////////////////////////////////////////
39/// Constructor.
40
41TKeyMapFile::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}
#define b(i)
Definition: RSha256.hxx:100
#define ClassImp(name)
Definition: Rtypes.h:361
#define gDirectory
Definition: TDirectory.h:229
char name[80]
Definition: TGX11.cxx:109
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
Utility class for browsing TMapFile objects.
Definition: TKeyMapFile.h:20
virtual void Browse(TBrowser *b)
Browse the contained objects.
Definition: TKeyMapFile.cxx:50
TKeyMapFile()
Default constructor.
Definition: TKeyMapFile.cxx:34
TMapFile * fMapFile
Pointer to map file.
Definition: TKeyMapFile.h:26
This class implements a shared memory region mapped to a file.
Definition: TMapFile.h:25
TObject * Get(const char *name, TObject *retObj=nullptr)
Return pointer to object retrieved from shared memory.
Definition: TMapFile.cxx:777
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Mother of all ROOT objects.
Definition: TObject.h:37
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
Definition: TObject.cxx:119