Re: [ROOT] Equivalent of TFile::Get to get a TDirectory pointer

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Jun 02 2003 - 11:52:27 MEST


Hi Pierre-Luc,

I have removed the obsolete comment in TDirectory::Get.
You can use this function to return a pointer to a sub-directory.

Rene Brun

On Sat, 
31 May 
2003, Pierre-Luc Drouin wrote:

> Hello,
> 
> I've a class that holds a TDirectory pointer but that ignores if the
> directory structure of the TDirectory instance is entirely loaded in
> memory or not (the instance can be a TFile instance).
> 
> In a member function of this class, I want to get a pointer to a
> subdirectory of the TDirectory instance. Suppose this
> subdirectory is
> called "MySubDir". I want to get a pointer to "MySubDir" and we
> don't know if "MySubDir" is in memory or not. I wanted to use
> TDirectory::Get(), but the ROOT reference guide says that we must not use
> TDirectory::Get() when the namecycle is a TDirectory namecycle.
> 
> So what should I do? Should I cd() to "MySubDir" to load it in memory in
> the case it was not and use after FindObject("MySubDir") from the parent
> directory to get the pointer?
> 
> I've noticed that FindObjectAny("MySubDir") loads "MySubDir" in memory and
> returns a pointer to the instance. However, I don't want to look for
> "MySubDir" in the subdirectories.
> 
> Is there a nicer way to do what I want?
> 
> Thank you
> 
> Pierre-Luc Drouin
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET