00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "BaBar/BaBar.hh"
00010
00011 #include "CdbRooReadonly/CdbRooRoContextSaver.hh"
00012
00013 #include "CdbBase/CdbDebugStream.hh"
00014
00015 #include <TDirectory.h>
00016
00017 std::string
00018 CdbRooRoContextSaver::depth( const bool enterVsLeave )
00019 {
00020 static std::string current = "";
00021 if( enterVsLeave ) {
00022 const std::string result = current;
00023 current += " ";
00024 return result;
00025 }
00026 if( current.size( ) >= 2 )
00027 current.resize( current.size( ) - 2 );
00028 return current;
00029 }
00030
00031 CdbRooRoContextSaver::CdbRooRoContextSaver( ) :
00032 _path( gDirectory->GetPath( ))
00033 {
00034 CDB_DEBUG_STREAM << " ** CdbRooRoContextSaver ** " << depth( true ) << "SAVED : '" << _path << "'\n";
00035 }
00036
00037 CdbRooRoContextSaver::~CdbRooRoContextSaver( )
00038 {
00039 const std::string indent = depth( false );
00040
00041 CDB_DEBUG_STREAM << " ** CdbRooRoContextSaver ** " << indent << "LEFT : '" << gDirectory->GetPath( ) << "'\n";
00042 gDirectory->Cd( _path.c_str( ));
00043 CDB_DEBUG_STREAM << " ** CdbRooRoContextSaver ** " << indent << "RESTORED : '" << _path << "'\n";
00044 }
00045
00046
00047
00048