Question about TFile

Reid D Rivenburgh (reid@lanl.gov)
29 Oct 1997 13:26:43 -0800


Hi,

I have a question about TFile. In our application we're developing a
class that will act as a sort of database, having a convenient
interface for persistently storing and retrieving ROOT objects. One
of its members will be a TFile, which will do most of the work of
storing and retrieving. My question, then, is how will this class
(and possibly multiple instances of it) having a TFile interere with
other TFiles created by the main program? In most ROOT examples I've
seen and in code I've written, there's only ever one TFile in
existence at a time. The TROOT class seems to maintain a "current
TFile" for when an object calls its Write() method. When I create one
of these database objects, though, I probably don't want its TFile to
become the current one. And, I don't want the database object to
write every object in memory to its TFile, just the ones I tell it to
write. Is there any hope of achieving this, or is it not the intended
use for a TFile? Is there a better approach? It's a bit confusing
(though I did read an old roottalk thread about TFiles, and that
helped some).

Thanks for any info,
Reid