00001 // @(#)root/io:$Id: TKeyMapFile.cxx 34913 2010-08-20 19:18:35Z pcanal $ 00002 // Author: Rene Brun 23/07/97 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 ////////////////////////////////////////////////////////////////////////// 00013 // // 00014 // Utility class for browsing TMapFile objects. // 00015 // When the browser is invoked for a TMapFile, a TKeyMapFile object // 00016 // is created for each object in the mapped file. // 00017 // When a TKeyMapFile object is clicked in the browser, a new copy // 00018 // of this object is copied into the local directory and the action // 00019 // corresponding to object->Browse is executed (typically Draw). // 00020 // // 00021 ////////////////////////////////////////////////////////////////////////// 00022 00023 #include "TKeyMapFile.h" 00024 #include "TDirectory.h" 00025 #include "TMapFile.h" 00026 #include "TBrowser.h" 00027 00028 ClassImp(TKeyMapFile) 00029 00030 //______________________________________________________________________________ 00031 TKeyMapFile::TKeyMapFile() : TNamed(), fMapFile(0) 00032 { 00033 // Default constructor. 00034 } 00035 00036 //______________________________________________________________________________ 00037 TKeyMapFile::TKeyMapFile(const char *name, const char *classname, TMapFile *mapfile) 00038 : TNamed(name,classname) 00039 { 00040 // Constructor. 00041 fMapFile = mapfile; 00042 } 00043 00044 //______________________________________________________________________________ 00045 void TKeyMapFile::Browse(TBrowser *b) 00046 { 00047 // Browse the contained objects 00048 TObject *obj = gDirectory->Get((char*)GetName()); 00049 delete obj; 00050 obj = fMapFile->Get(GetName(),0); 00051 00052 if( b && obj ) 00053 obj->Browse( b ); 00054 }