Re: Which objects are stored by TFile::Write()?

Valery Fine (Valeri.Faine@cern.ch)
Sat, 31 May 1997 20:11:39 +0100


> Jacek M. Holeczek wrote:
> >
> > I would also like to propose another extension. It would be nice if root
> > files could keep ascii files ( also compressed ), for example with c++
> > macros used to analyze/display other objects in the same root file ( or
> > maybe with some calibration parameters ).
> > Jacek.

I think the idea was to introduce TMacro class derived
from TSystemFile and TObjArray( for example) of the TObjString
objects with 4 methods
class TMacro : ....
{
private:
Text_t *fMacroFile; // name of the temporary file to keep
// this object for this session
public:
TMacro::TMacro(Text_t *name,Text_t title, Text_t *importfilename=0);
TMacro::Import(Text_t *filename=0); // filename = 0 means import from temp file
TMacro::Export(Text_t *filename=0); // filename = 0 means export to the temp file
TMacro::Edit(Option_t *EditorName="edit",Option_t *extraoptions="");
TMacro::View(Option_t *ViewerName="more",Option_t *extraoptions="");
TMacro::Load(); // Aka .L command of CINT
TMacro::Execute(); // Aka .x command of CINT
TMacro::Compile(); // Invoke the local compiler and produce the local DLL (share lib)

...
}

This assumes NO external file provided just a temporary one (any
way it is created by CINT) to pass it to the
TAppication::ProcessFile(). So no clashewith the current directory
unless Export() is called.

Is it what you begged ?
I think it could be implemented.
I'd like to mention that View and Edit methods can be applied
with ANY kind of the file since they just create a temporary file and
invoke the external utility to treat that file like this
(via TSystem::Exec). The user can customize this class easily (I hope).

//______________________________
void TMacro::View(Option_t *ViewerName,Option_t *extraoptions)
{
Char_t *buffer = new Char_t[128];
sprintf(buffer,"%s %s %s",EditorFileName,fMacroFile,extraoptions);
TSystem::Exec(buffer);
delete buffer;
}
//______________________________
TMacro::~TMacro(){
if (fMacroFile)
{
if (Modified()) Import();
gSystem->Unlink(fMacroFile);
}
}

In fact this way the source of ROOT itself (or any other ROOT-based application)
may be kept with ROOT file and installed from there too.

Valery
=================================================================
Dr. Valery Fine Telex : 911621 dubna su
-----------
LCTA/Joint Inst.for NuclearRes Phone : +7 09621 6 40 80
141980 Dubna, Moscow region Fax : +7 09621 6 51 45
Russia mailto:fine@main1.jinr.dubna.su

Dr. Valeri Faine
------------ Phone: +41 22 767 6468
CERN FAX : +41 22 767 7910
CH-1211 Geneva, 23 mailto:fine@mail.cern.ch
Switzerland http://nicewww.cern.ch/~fine