Re: I/O Problem with Class derived from TDirectory

From: Rene Brun <brun_at_pcroot.cern.ch>
Date: Tue, 7 Jun 2005 09:43:28 +0200 (MEST)


Hi Dylan,

When deriving from TDirectory, one cannot redefine TDirectory::Streamer to do more or less than TDirectory::Streamer does. When using ACLIC, a TMyDir::Streamer function is automatically generated encapsulating TDirectory::Streamer with a header and trailer. The solution is to implememt a dummy TMyDir::Streamer simply calling TDirectory::Streamer.
You cannot use ACLIC for vthis.
Look in the attached tar file, run the script gom creating a shared lib libMyDir.so and run the modified testMyDir.C

Rene Brun

On Mon, 6 Jun 2005, Dylan Maxwell wrote:

> Dear ROOTtalk,
>
> I want to extend the capabilities of TDirectory so I've written a class
> TMyDir which inherits from TDirectory. (See the attached files) I
> compile TMyDir using ACLiC. I can create a new TMyDir within a TFile,
> but when I close the TFile and then re-open it, I get the follow error
> when I try to Get() the TMyDir object. I've included a short script,
> TestMyDir.C, that recreates the error. I'm running Fedora Core 3.
>
> *******************************************
> * *
> * W E L C O M E to R O O T *
> * *
> * Version 4.04/02 4 May 2005 *
> * *
> * You are welcome to visit our Web site *
> * http://root.cern.ch *
> * *
> *******************************************
>
> FreeType Engine v2.1.3 used to render TrueType fonts.
> Compiled for linux with thread support.
>
> CINT/ROOT C/C++ Interpreter version 5.15.169, Mar 14 2005
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> root [0] .x TestMyDir.C
> Info in <TUnixSystem::ACLiC>: creating shared library
> /mnt/clshome/maxweld/Code/cpp/LTP/src/./TMyDir_cxx.so
> TFile** mydir.root
> TFile* mydir.root
> KEY: TMyDir MyDir;1 MyDirectory
> Error in <TClass::ReadBuffer2>: class: TUUID, attempting to access a
> wrong version: 127, object skipped at offset 97
> SysError in <TFile::Seek>: cannot seek to position 60798594976055296
> in file mydir.root, retpos=1 (Invalid argument)
> Error in <TFile::ReadBuffer>: error reading all requested bytes from
> file mydir.root,
> got 153 of 3342396
>
>
> Have I missed something obvious in my implementation of TMyDir?
>
> Thank You in Advance,
> Dylan Maxwell
>

Received on Tue Jun 07 2005 - 09:43:35 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:09 MET