Hi Gero,
On Mon, 2007-06-18 at 11:31 +0200, Linev Sergei wrote:
> Hi, Gero
>
> One more comment about XML I/O.
> You can convert your object directly to the xml string without overhead of TFile structures.
> In this case code will look like:
>
> {
> TH1F *h = new TH1F("h","test",100,-3,3);
> h->FillRandom("gaus",1000);
>
> TString sbuf = TBufferXML::ConvertToXML(h);
>
> cout << sbuf << endl;
> }
>
> If you produce xml string with same format, later you can reconstruct object by:
>
> {
> TString sbuf;
> // get your xml string from text file
>
> TObject* obj = TBufferXML::ConvertFromXML(sbuf);
> }
True, you can do this, but you circumvent the virtual interface provided by TFile. One should really be careful _not_ to use "implementation" code when there's a virtual interface that does the job for you.
Using virtual interfaces is the core of OOP, and circumventing them is asking for trouble and makes the code suffer from Fortrantitis :-)
Yours,
--
___ | Christian Holm Christensen
|_| | -------------------------------------------------------------
| | Address: Sankt Hansgade 23, 1. th. Phone: (+45) 35 35 96 91
_| DK-2200 Copenhagen N Cell: (+45) 24 61 85 91
_| Denmark Office: (+45) 353 25 404
____| Email: cholm_at_nbi.dk Web: www.nbi.dk/~cholm
| |
Received on Mon Jun 18 2007 - 18:45:13 CEST
This archive was generated by hypermail 2.2.0 : Tue Jun 19 2007 - 23:50:01 CEST