Re: Memory Mapped TList

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Wed Sep 22 1999 - 18:45:36 MEST


Hi Colin,


Colin Partridge wrote:
> 
> I have two questions about TMapFIle:
> 
> 1. If a TList is mapped to a TMapFile.  Is it possible to access objects in
> the list from a consumer process.
>
Yes. For example in the producer:

TList *l = new TList;
l->Add(histo1);    // assume name "histo1"
l->Add(histo2);
mfile->Add(l, "list");  // give name since list has no name by default

In the consumer:

TList *l = (TList*)mfile->Get("list");
TH1 *h = (TH1*)l->FindObject("histo1");
h->Draw();

Everytime when you do mfile->Get("list") you will get an updated copy
of the list and its contents (assuming the producer did update the list).

> 
> 2. Is it possible to access the objects in a TMapFile if you don't know
> their names.
> 
No, object have to be stored with a name in the TMapFile.

Cheers, Fons.


> Thanks
> --
> Colin Partridge
> stack@lineone.net
> http://website.lineone.net/~stack/

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:39 MET