Re: [ROOT] how to save a single variable?

From: Valery Fine (fine@bnl.gov)
Date: Mon Aug 14 2000 - 03:12:28 MEST


Hi, Aihong

I do not now the entire task you fight with.

May be  TTable class can help you.
(see: http://root.cern.ch/root/html/TTable.html )
It does allow to create the arrays of the plain C-structures and save it with its 
descriptions all together. For each member of the C-structure the description keeps
the  "name", "type" and size. To access those several methods are provided as well:


virtual             Int_t GetColumnIndex(const Char_t* columnName) const
virtual const Char_t* GetColumnName(Int_t columnIndex) const
virtual           UInt_t GetColumnSize(Int_t columnIndex) const
virtual             Int_t GetColumnSize(const Char_t* columnName = 0) const

virtual TTable::EColumnType GetColumnType(Int_t columnIndex) const
virtual TTable::EColumnType GetColumnType(const Char_t* columnName = 0) const

virtual           UInt_t GetDimensions(Int_t columnIndex) const
virtual             Int_t GetDimensions(const Char_t* columnName = 0) const
virtual const UInt_t* GetIndexArray(Int_t columnIndex) const

virtual Long_t GetNRows() const
                   

Of course the C-structure can be the trivial and contains only one simple data-member.

Hope this helps,
                                  Valery

----- Original Message ----- 
From: Aihong Tang <aihong@cnr.physics.kent.edu>
To: <roottalk@pcroot.cern.ch>
Sent: 12 августа 2000 г. 11:21
Subject: [ROOT] how to save a single variable?


> Hi, 
> 
> What I am trying to do is quite simple: Save an integer or float(and their
> name) in a root file and read it back by name. Since an number itself is
> not an object, I have to embedd it into an object so that I can save it.
> I am sure that there are a lot of work around.
> 
> But my question is: is there a dedicated class for this purppose? (like
> TNumber::TNumber(char* name, char* title, Int_t/Float_t number). )
> 
> Thanks!
> 
> Aihong
> 
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:31 MET