[root] / trunk / core / base / inc / TDirectory.h Repository:
ViewVC logotype

Log of /trunk/core/base/inc/TDirectory.h

Parent Directory Parent Directory


Links to HEAD: (view) (download) (as text) (annotate)
Sticky Revision:

Revision 48065 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Dec 17 14:25:41 2012 UTC (2 years, 1 month ago) by pcanal
File length: 10532 byte(s)
Diff to previous 41092
Prevent use of function (WriteObject(void*,...) ) which is guaranteed to fail by making it private (it uses to work in Cint because its void* where actually ... 'typed'

Revision 41092 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Oct 3 07:30:06 2011 UTC (3 years, 3 months ago) by pcanal
File length: 10379 byte(s)
Diff to previous 27658
Whenever a thread has an associated TThread object, the value of gDirectory is now 
thread local, i.e. all modifications direct or indirect of gDirectory will not be 
seen by the other thread.   In particular this means that several I/O operations 
(including TDirectory::Write) are now thread safe (<b>as long as all the required 
TClass and TStreamerInfo has been previously setup</b>).

This model does <b>not</b> support sharing TFile amongst threads (i.e. a TFile 
must be accessed from exactly <b>one</b> thread).   This means that whenever a TFile's 
control is <i>passed</i> from a thread to another, the code must explicitly reset 
gDirectory to another value or there is a risk for this gDirectory to point to a 
stale pointer if the other thread deletes the TFile object.  A TFile deletion will 
only affect the value of the local gDirectory.

Note: gFile now always returns the file of the current directory or zero if the 
current directory is not a TDirectoryFile.   In particular this means that gFile 
itself is now read-only and can not be modified directly.

The global values gDirectory and gFile are now all accessed via a static function 
of their respective class.  The access is made transparent via a CPP macro.

gPad, gVirtualX and gInterpreter are now accessible even when their value 
is zero and they now properly support tab completion. (and the same technique is used 
for gDirectory and gPad).

Revision 27658 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Feb 28 05:34:57 2009 UTC (5 years, 10 months ago) by pcanal
File length: 10073 byte(s)
Diff to previous 24013
Remove the 'cast from type ... casts away constness' warning from most header files

Revision 24013 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon May 26 12:07:40 2008 UTC (6 years, 8 months ago) by brun
File length: 10079 byte(s)
Diff to previous 22992
Add an optional argument Bool_t forceRead to TDirectory::ReadKeys.
When this argument is called with kFALSE, ReadKeys assume that the TKey members
have already been read before this call.

Revision 22992 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Apr 5 09:43:01 2008 UTC (6 years, 9 months ago) by pcanal
File length: 10053 byte(s)
Diff to previous 22972
Use the DirectoryAutoAdd facility for the classes:
        TTree, TH1, TEventList, TEntryList, TGraph2D
(and hence their derived classes).

The instances of those classes are now added automatically 
to the current directory only when Constructe'd with arguments or Clone'd
and to the directory they are read from when their are stored
directly in a TKey. [Note: the default constructor never adds
the object to the current directory]

The directory auto add can still be disabled for instance
of TH1 and TGraph2D by setting TH1::AddDirectory.

Additionally one can disable the directory auto add for
a specific class by doing:

    TClass::GetClass("myclass")->SetDirectoryAutoAdd(0)

However you might want to also be able to restore the
behavior in which case you ought to do:

    TClass *cl = TClass::GetClass("myclass");
    ROOT::DirAutoAdd_t func = cl->GetDirectoryAutoAdd();
    cl->SetDirectoryAutoAdd(0);

TROOT::ReadingObject is marked as deprecated.. It is still
set (as it was) but is no longer used by the above mention
classes.

NOTE:  One side effect of this change, is that instnace 
of TTree, TH1, TEventList, TEntryList, TGraph2D that are
retrieved from a TMessage (i.e. from a socket) no longer
auto register themselves to the current ROOT directory.

Add a new optional parameter to TDirectory::Append: 'replace'
If replace is true (the default is false), the Append will
first remove from the directory any existing object and
print the message:

   Replacing existing OldClass: thename (Potential memory leak).

Add a new option parameter to TDirectory::CloneObject: 'autoadd'
If autoadd is true (the default), CloneObject will call the
object 'DirectoryAutoAdd' function (if any)

In TDirectory::CloneObject add support for multiple inheritance
from TObject where TObject is not the left most base class.

Fix memory leak in TGraph2D::operator= (and add TGraph2D::Clear)

Cleanup some documentation

Revision 22972 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Apr 3 19:58:33 2008 UTC (6 years, 9 months ago) by pcanal
File length: 9971 byte(s)
Diff to previous 22961
Introduce a new member function TDirectory::Remove which is the reverse of
TDirectory::Append.  This allows more 'hiding' of the internal list as
well as simplifying code (now) using Append/Remove.

Revision 22961 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Apr 3 13:32:57 2008 UTC (6 years, 9 months ago) by rdm
File length: 9930 byte(s)
Diff to previous 22793
move the directories:
  base clib cont meta metautils newdelete pcre rint thread unix utils
  winnt zip
under the new core meta directory.

Revision 22793 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Mar 20 15:48:19 2008 UTC (6 years, 10 months ago) by rdm
Original Path: trunk/base/inc/TDirectory.h
File length: 9930 byte(s)
Diff to previous 20877
make SaveObjectAs() const.

Revision 20877 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Nov 19 11:17:07 2007 UTC (7 years, 2 months ago) by rdm
Original Path: trunk/base/inc/TDirectory.h
File length: 9935 byte(s)
Diff to previous 19826
Set property svn:eol-style LF on all source and Makefiles. This should avoid
problems with Win32 line endings ending up in the repository. All MS tools
support LF eols fine.

Revision 19826 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Sep 19 19:56:11 2007 UTC (7 years, 4 months ago) by rdm
Original Path: trunk/base/inc/TDirectory.h
File length: 9935 byte(s)
Diff to previous 19825
imported svn:keywords Id property

Revision 19825 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Sep 19 19:49:10 2007 UTC (7 years, 4 months ago) by rdm
Original Path: trunk/base/inc/TDirectory.h
File length: 9986 byte(s)
Diff to previous 19668
remove :$ from tag line

Revision 19668 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Aug 22 19:48:29 2007 UTC (7 years, 5 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 9996 byte(s)
Diff to previous 18682
From Philippe:
Add Warning messages in case object.Write is called and there is no directory/file to write. The warnings are illustrated by the following example session:
root [0] n = new TNamed("myname","my title")
(class TNamed*)0x956340
root [1] n->Write()
Error in <TROOT::WriteTObject>: The current directory (Rint) is not
associated with a file. The object (myname) has not been written.
(Int_t)(0)
root [2] gDirectory = 0;
root [3] n->Write()
Error in <TNamed::Write>: The current directory (gDirectory) is null. The
object (myname) has not been written.
(Int_t)(0)
root [4] .q

Revision 18682 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon May 7 09:40:41 2007 UTC (7 years, 8 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 10010 byte(s)
Diff to previous 18676
Fix coding conventions (well, I hope)

Revision 18676 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat May 5 17:41:15 2007 UTC (7 years, 8 months ago) by pcanal
Original Path: trunk/base/inc/TDirectory.h
File length: 10008 byte(s)
Diff to previous 18672
Fix for older compiler (solaris)

Revision 18672 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri May 4 22:15:36 2007 UTC (7 years, 8 months ago) by pcanal
Original Path: trunk/base/inc/TDirectory.h
File length: 9980 byte(s)
Diff to previous 17538
Extend the functionality of TDirectory::TContext
The TContext objects will not longer cd back to a directory
that was deleted between creation and their deletion.
For example:
   f->cd();
   {
     TDirectory::TContext ctxt(0);
     .... do something that change gDirectory.
     delete f;
   }
In the prevision implementation this lead to a f->cd() (i.e. core dump).
In the new implementation this leads to a gROOT->cd().
With this improvement we now strong recomment to switch code pattern
similar to:
   TDirectory *cursav = gDirectory;
   ... do something that changes gDirectory;
   if (cursav) cursav->cd();
(which also leads to a core if cursav is directly or indirectly deleted)
to
   TDirectory::TContext ctxt(0);
   ... do something that changes gDirectory;

CVS ----------------------------------------------------------------------

Revision 17538 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun Jan 28 18:27:46 2007 UTC (7 years, 11 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 9209 byte(s)
Diff to previous 17533
-Implement the following new functions: Some of these functions were
implemented (temporarily) in the now obsolete class TVirtualIO/TFileIO.
   virtual TObject    *CloneObject(const TObject *obj);
   virtual TObject    *FindObjectAnyFile(const char * /*name*/) const {return 0;}
   virtual TFile      *OpenFile(const char * /*name*/, Option_t * /*option*/ = "",
                            const char * /*ftitle*/ = "", Int_t /*compress*/ = 1,
                            Int_t /*netopt*/ = 0) {return 0;}
   virtual Int_t       SaveObjectAs(const TObject * /*obj*/, const char * /*filename*/="", Option_t * /*option*/="");
   virtual void        SetTRefAction(TObject * /*ref*/, TObject * /*parent*/) {}

Revision 17533 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Jan 26 15:47:58 2007 UTC (7 years, 11 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 8645 byte(s)
Diff to previous 17527
Fix a typo

Revision 17527 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Jan 26 15:39:16 2007 UTC (7 years, 11 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 8627 byte(s)
Diff to previous 17419
Add the following new functions:
  virtual Int_t   ReadTObject(TObject *obj, const char *keyname);
  virtual Int_t   WriteTObject(const TObject *obj, const char *name=0, Option_t *option="");

Add an optional argument bufsize in the following functions
  virtual Int_t   Write(const char *name=0, Int_t opt=0, Int_t bufsize=0);
  virtual Int_t   Write(const char *name=0, Int_t opt=0, Int_t bufsize=0) const ;
  virtual Int_t   WriteObjectAny(const void *obj, const char *classname, const char *name, Option_t *option="", Int_t bufsize=0);
  virtual Int_t   WriteObjectAny(const void *obj, const TClass *cl, const char *name, Option_t *option="", Int_t bufsize=0);

Add the following static member
  static Bool_t fgAddDirectory;   //!flag to add histograms, graphs,etc to the directory
and the functions
  static  void     AddDirectory(Bool_t add=kTRUE);
    // Sets the flag controlling the automatic add objects like histograms, TGraph2D, etc
    // in memory
    //
    // By default (fAddDirectory = kTRUE), these objects are automatically added
    // to the list of objects in memory.
    // Note that in the classes like TH1, TGraph2D supporting this facility,
    // one object can be removed from its support directory
    // by calling object->SetDirectory(0) or object->SetDirectory(dir) to add it
    // to the list of objects in the directory dir.
    //
    //  NOTE that this is a static function. To call it, use;
    //     TDirectory::AddDirectory

  static  Bool_t   AddDirectoryStatus();
    // static function: see TDirectory::AddDirectory for more comments

 These two functions are good alternatives to the same functions in TH1.
 The functions in TH1 are still kept for back compatibility.

Revision 17419 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Jan 22 05:58:29 2007 UTC (8 years ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 8263 byte(s)
Diff to previous 15491
WARNING!!!  This is an important change.

This is the continuation of the effort to structure libCore into
independent sub-packages.

A new class TDirectoryFile is introduced. It derives from TDirectory
and takes from TDirectory all the I/O functions.

All the classes (except TROOT) deriving from TDirectory are now derived
from TDirectoryFile. TDirectory keeps the previous API for back compatibility
with several functions made virtual.

This change should be back compatible, except if the user codes creates
a file sub-directory by direct invokation of the TDirectory constructor
instead of calling TDirectory::mkdir.

Note that TMapFile is not yet fully adapted to the new scheme.

Revision 15491 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Jun 20 18:17:34 2006 UTC (8 years, 7 months ago) by pcanal
Original Path: trunk/base/inc/TDirectory.h
File length: 9228 byte(s)
Diff to previous 15134
From Sergei Linev:
1. Functionality of TDirectory::ReadAll() extended. One can call dir->ReadAll("dirs") to read only subdirectories.
   dir->ReadAll("dirs*") will read complete subdirectories tree.

2. In TDirectory::Delete(): if subdirectory is delete, first all subdirs will be read (via ReadAll("dirs")) and than
   keys of subdirectories will  be removed. As a result, there no lost frames in the ROOT file.

3. New method TDirectory::rmdir(const char* name), which internally calls TDirectory::Delete(name + ";*");

4. TDirectory::SetName() is implemented to add comment about its lack
of functionality for now (Once changed, if the directory was written
already once, it is not consistent with the keys list of mother directory.

5. New TFile::IsBinary method, which indicate that file has binary or non-binary (xml or sql) format.
   Uses BIT(15) of TFile object.

6. New methods of TFile for TDirectory I/O
      virtual Long64_t DirCreateEntry(TDirectory*) { return 0; }
      virtual Int_t    DirReadKeys(TDirectory*) { return 0; }
      virtual void     DirWriteKeys(TDirectory*) {}
      virtual void     DirWriteHeader(TDirectory*) {}
   They have no use for binary directory I/O, but called when TDirectory should be stored in non-binary file.

7. TDirectory::Streamer() adjusted to work in non-binary mode.

Revision 15134 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue May 23 04:47:42 2006 UTC (8 years, 8 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 9062 byte(s)
Diff to previous 15047
From Federico Carminati:

"I have implemented all copy and equal operators needed to silence all
warnings in AliRoot, as requested. I have implemented shallow copies as
would do the default operators synthetized by the compiler.
Most operators are protected. If users complain, you just have to move
them into the public area, but class derivation is of course supported.
It has been a terrible job, I have modified 278 files, but the changes
are backward compabile, and this goes a long way to permitting user to
use the effc++ flag with root headers."

Revision 15047 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon May 15 11:01:14 2006 UTC (8 years, 8 months ago) by rdm
Original Path: trunk/base/inc/TDirectory.h
File length: 9032 byte(s)
Diff to previous 15040
coding conventions (put methods after data members, after Fed's changes).

Revision 15040 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun May 14 10:23:27 2006 UTC (8 years, 8 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 9051 byte(s)
Diff to previous 13976
From Federico:
More headers changed to support the gcc option effc++

Revision 13976 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Feb 1 18:54:51 2006 UTC (8 years, 11 months ago) by pcanal
Original Path: trunk/base/inc/TDirectory.h
File length: 8980 byte(s)
Diff to previous 13910
From Sergei Linev:
Move the CreateKey method from TDirectory to TFile
(to allow their overloading in the class derived from TFile)

Revision 13910 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Jan 24 21:27:30 2006 UTC (9 years ago) by pcanal
Original Path: trunk/base/inc/TDirectory.h
File length: 9157 byte(s)
Diff to previous 13284
From Sergei Linev:
1) In normal constructor I add new argument - mother of directory.
   If it is not specified (for instance, if user creates TDirectory himself), gDirectory will be used.
   In principle, fMother was before, but now it consecutively used in most TDirecory methods, related to
   parent/child relationship.
2) Together with directory fMother member file pointer fFile propogated to all childs.
   Consequently, each directory knows to which file it belongs.
3) When streamed from the file, fFile memeber is assigned from TBuffer::GetParent(). fFile is enougth
   to read keys from the file. Mother directory is assigned later in TKey::ReadObj().


TDirectory::GetPath() uses static variable and will fails in multithread application.
   I introduce new GetPath() method and TString fPathBuffer to produce correct full path.
   Old code was moved in GetPathStatic() method. To optimize memory usage, one can replace TString
   by const char* (as it was before).

Revision 13284 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Nov 18 17:44:16 2005 UTC (9 years, 2 months ago) by pcanal
Original Path: trunk/base/inc/TDirectory.h
File length: 8800 byte(s)
Diff to previous 12876
From Sergey:
Make the creation of the TKey object into a 'virtual function'
to support the various types of TKey (TKeyXML, TKeySQL).

Revision 12876 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Sep 30 08:52:23 2005 UTC (9 years, 3 months ago) by pcanal
Original Path: trunk/base/inc/TDirectory.h
File length: 8616 byte(s)
Diff to previous 12825
add a TContext constructor where gDirectory is implied: to use simply to TDirectory::TContext ctxt(newdir);

Revision 12825 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Sep 23 13:04:53 2005 UTC (9 years, 4 months ago) by rdm
Original Path: trunk/base/inc/TDirectory.h
File length: 8388 byte(s)
Diff to previous 12362
From Andreas:
here are my modifications to interface the Grid file catalog
(AliEn in this case) with TChain data sets. Some changes are just
one-liner changes to make some base class things virtual or to set
some members. With these changes one can do:

// connect
TGrid::Connect("alien://");

// query
TGridResult* result = gGrid->Query("/alice/cern.ch/user/p/peters/analysis/miniesd/","*.root","","");

or

TGridResult* result = gGrid->Query("/alice/cern.ch/user/p/peters/analysis/miniesd/","*.root","","-l 50");  // to query maximum 50 files

result->Print(""); // or result->Print("l") or result->Print("all"); => Tells you also the complete size of the TDSet (the ALICE one is 68 GB)

// build chain for ALICE files
TChain* mychain = new TChain("esdTree","AliceSession");

// Get a list of FileInfo Objects
// -> I cannot use directly a list of FileInfo objects in TGridResult,
//    because TGridResult can be also a list of jobs etc ....

TList* list = result->GetFileInfoList()

// add them to a chain
mychain->AddFileInfoList(list);    // adds all
mychain->AddFileInfoList(list,10); // adds only the first 10

// to use PROOF then, you need to do
mychain->Lookup();                 // open's all files via TAlienFile over
                                      the redirector and replaces the
                                      alien URL with the physical location
                                      of the file on the cluster
                                      (including the access token)

mychain->SetProof();
mychain->Draw("ESD.fTrigger");

Revision 12362 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jul 21 20:52:25 2005 UTC (9 years, 6 months ago) by pcanal
Original Path: trunk/base/inc/TDirectory.h
File length: 8388 byte(s)
Diff to previous 11826
Add a new member function, TDirectory::GetDirectory, which factors out
the code of TDirectory::cd and its static counterpart TDirectory::Cd.

TDirectory::GetDirectory can be used to quietly find out if a
directory exist:
   TDirectory *mydir = myfile->GetDirectory(somepath);
   if (mydir==0) mydir->mkdir(somepath);
   myfile->cd(somepath);


TDirectory *GetDirectory(const char *namecycle,
                Bool_t printError = false,
                const char *funcname_for_error_reporting = "GetDirectory");

Revision 11826 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu May 19 17:28:15 2005 UTC (9 years, 8 months ago) by pcanal
Original Path: trunk/base/inc/TDirectory.h
File length: 8258 byte(s)
Diff to previous 9619
From Markus,

Introduce a new class TDirectory::TContext to keep track and
restore the current directory.  With this construct C++
exceptions will be guaranteed to properly restore the
current directory pointer.

For example code like:
   TDirectory *sav = gDirectory;
   mydirectory->cd();
   if (...) {
      ....
      sav->cd();
      return;
   } else if (...) {
      ....
      sav->cd();
      return;
   }
   sav->cd;
   return;
can be replaced with the simplier and exception safe:
   TDirectory::TContext context(gDirectory,mydirectory);
   if (...) {
      ....
      return;
   } else if (...) {
      ....
      return;
   }
   return;

TDirectory::WriteTObject and TDirectory::WriteObjectAny now
store the object directly in 'this' directory (instead
of storing it in the (possibly unrelated) current directory).

TObject::Write has been modified accordingly (it contained the
main example of code relying on the previous behavior)

This patches correct a the problem demonstrated by
the test currentFileKey in roottest/root/io/interface

Revision 9619 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Jul 30 01:12:28 2004 UTC (10 years, 5 months ago) by rdm
Original Path: trunk/base/inc/TDirectory.h
File length: 7513 byte(s)
Diff to previous 9359
From Philippe:
This patch implements a const Write and keeps the existing non-const
Write. If somebody derived from TObject and overload Write(), they
will be reminded to implement the const version with a warning
similar to:

include/TCollection.h(45): warning #654: overloaded virtual function "TObject::Write" is only partially overridden in class "TCollection"
 class TCollection : public TObject {

The implementation of the non-const Write is simple: call the const Write().

Exceptions are TFile and TDirectory which actually can only implement
non const Write (and hence const Write outputs an error message).

Revision 9359 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jul 1 04:55:05 2004 UTC (10 years, 6 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 7427 byte(s)
Diff to previous 9127
From Philippe:
This patches renames TDirectory::GetObjectAny into TDirectory::GetObject.
Since this interface has not been 'released' yet, no backward compatibility
is provided.

Revision 9127 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Jun 4 16:28:31 2004 UTC (10 years, 7 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 7442 byte(s)
Diff to previous 9120
From Philippe:
This patch rename WriteObject(const TObject*, const char*, Option_t)
into WriteTObject(const TObject*,const char*, Option_t)
This prevent any ambiguity with the template
     WriteObject(const T*, const char*, Option_t)

Revision 9120 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Jun 4 05:16:22 2004 UTC (10 years, 7 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 7419 byte(s)
Diff to previous 9119
Move the inline definition of the templated WriteObject to TDirectory.cxx.
The inline definition requires TClass.h. Many classes did not compile.

Revision 9119 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Jun 4 00:39:37 2004 UTC (10 years, 7 months ago) by rdm
Original Path: trunk/base/inc/TDirectory.h
File length: 7587 byte(s)
Diff to previous 9114
From Philippe:
work around a MS 6 compiler deficiency.

Revision 9114 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jun 3 21:05:24 2004 UTC (10 years, 7 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 7425 byte(s)
Diff to previous 9097
From Philippe:
This patches put in sync the compiled and interpreted interface to TDirectory::ReadObjectAny
and TDirectory::WriteObject.

In particular to save __any__ objects (including TObject*) in both
compiled code and interpreted code, just do:
        ptrclass *ptr;
        directory->WriteObject(ptr,"name");

Note that WriteObjectAny(T*,const char*) is renamed WriteObject.

To read back an object, the prefered interface for both compiled code
and interpreted code for non TObject* is (It also works with TObject*).
        ptrclass *ptr = 0;
        directory->GetObjectAny("name",ptr);

Note that void* GetObjectAny(const char*) was renamed GetObjectAnyUnchecked.

To emulate the template member function behavior in interpreted code,
we introduce a semi-handed coded dictionary which provided hand-written
function wrappers.  The hand-written wrappers are stored in ManualBase4Body.h
A pre-prepared dictionary (ManualBase4.cxx) is including ManualBase4Body.h and
should have to be regenerated only when the CINT dictionary format changes.
So there are 4 new files:
        base/inc/LinkDef4.h
        base/src/ManualBase4.cxx
        base/src/ManualBase4.h
        base/src/ManualBase4Body.h

Revision 9097 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Jun 2 17:03:51 2004 UTC (10 years, 7 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 7280 byte(s)
Diff to previous 8926
From Philippe:
This patch improves the current TDirectory::ReadObject.  In particular, in the previous code
only the following syntax was supported:
        finalclass *ptr;
        directory->WriteObjectAny(ptr,"finalclass","name");
Any other syntax or variation of the types would lead to splicing and/or crash.

Instead the idiom is
        ptrclass *ptr; // can point to ptrclass or any derived class
        directory->WriteObjectAny(ptr,"ptrclass","name");
In compiled code this can be simplified as:
        ptrclass *ptr;
        directory->WriteObjectAny(ptr,"name");

Also GetObjectAny always return the finaltype address and still need to be used as
        finalclass *ptr = (finalclass) directory->GetObjectAny("name");
For better checks, the user can use
        ptrclass *ptr = (ptrclass*) directory->GetObjectAnyChecked("name","ptrclass");
In compiled code, the following is recommended:
        ptrclass *ptr = 0;
        directory->GetObjectAny("name",ptr);

Revision 8926 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri May 14 08:26:31 2004 UTC (10 years, 8 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 6772 byte(s)
Diff to previous 8849
Implement new functions
   -void   *GetObjectAny(const char *namecycle);
    to read an object non deriving from TObject)

   -Int_t  WriteObjectAny(const void *obj, const char *classname, const char *name)
    This function is a variant of the already existing TDirectory::WriteObjectAny.
    With this function, the user does not need to know about TClass.

TDirectory::Get has been modify to be able to return also a non-TObject.

Revision 8849 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon May 10 13:49:39 2004 UTC (10 years, 8 months ago) by rdm
Original Path: trunk/base/inc/TDirectory.h
File length: 6595 byte(s)
Diff to previous 8844
made a few more methods const correct.

Revision 8844 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon May 10 12:08:57 2004 UTC (10 years, 8 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 6577 byte(s)
Diff to previous 7810
Add a new member:
   Int_t       fBufferSize;      //Default buffer size to create new TKeys
Add the following functions:
   virtual Int_t   GetBufferSize();
   virtual void    SetBufferSize(Int_t bufsize);
   virtual Int_t   WriteObject(const TObject *obj, const char *name=0, Option_t *option="");
   virtual Int_t   WriteObjectAny(const void *obj, const TClass *cl, const char *name, Option_t *option="");

the fBufferSize member may be used to specify the buffer size used
when creating a new key in the directory. If the member is null (default),
the buffer size used is the average buffer size for all keys created so far.

The new functions WriteObject and WriteObjectAny may be used to
write a TObject* or any object non deriving from TObject.
WriteObject is now called from TObject::Write.

Revision 7810 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Dec 30 13:16:51 2003 UTC (11 years ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 6199 byte(s)
Diff to previous 5933
Mega patch to add support for large files (bigger than 2 GBytes)
----------------------------------------------------------------

  ==========>NEW VERSION 4.00/00 <===========

Because this new version has a considerable number of changes,
and new important additions by Philippe are scheduled for the coming days
we are starting a new major version 4.
  -Support for large files
  -Automatic schema evolution for foreign classes
  -New data type Double32_t

Large files are currently tested only under Linux with gcc3.2.
Support for other systems will be gradually added in the coming days.
By default under Linux, files are created with the option LARGEFILE.
Note that when creating a Tree, the default maximum size for a Tree
is set to 1.9 GBytes. You can change this default value by calling
  TTree::SetMaxTreeSize(Long64_t maxsize)

The implementation of this new feature has required changes in many places.
The files produced by this new version can still be read by old ROOT versions
if their size if smaller than 2 GBytes. And obviously, the new version
can digest old ROOT files.

WARNING: note the following backward incompatibility:
 -TSystem::GetPathInfo has a new signature: (also TUnixSystem, TWinNTSystem, etc)
  old: GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime);
  new: GetPathInfo(const char *path, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime);

 -TFile::SysSeek and TFile::SysStat have a new signature (also TNetFile, TWebFile, etc)
  old:  Int_t    SysSeek(Int_t fd, Long_t offset, Int_t whence);
        Int_t    SysStat(Int_t fd, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime);
  new:  Long64_t SysSeek(Int_t fd, Long64_t offset, Int_t whence);
        Int_t    SysStat(Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime);

 -TTree::SetMaxTreeSize has a new signature:
  old:  void TTree::SetMaxTreeSize(Int_t maxsize)
  new:  void TTree::SetMaxTreeSize(Long64_t maxsize)

  All references to Seek_t have been replaced by Long64_t.

Revision 5933 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Jan 17 13:58:37 2003 UTC (12 years ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 6199 byte(s)
Diff to previous 5840
Add new getter function:
    virtual Int_t       GetNbytesKeys() const

Revision 5840 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jan 2 22:36:30 2003 UTC (12 years ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 6132 byte(s)
Diff to previous 5518
Implement a new function TDirectory::SetWritable (thanks to Bill Tanenbaum).
SetWritable recursively sets the fWritable flag for all subdirs (if any)
of the directory for which SetWritable is called.

Revision 5518 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Oct 31 07:27:37 2002 UTC (12 years, 2 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 6072 byte(s)
Diff to previous 5045
Make const all Copy functions.
WARNING: If your class implements a Copy function deriving
from TObject or one of the ROOT classes, you must make
your Copy function const.

Revision 5045 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 2 18:54:37 2002 UTC (12 years, 5 months ago) by rdm
Original Path: trunk/base/inc/TDirectory.h
File length: 6067 byte(s)
Diff to previous 4857
In root v3.03/07 the following simple commands fail:

 root [] TFile f("f.root","recreate","",0);  f.mkdir("d"); f.Write();
 root [] TFile f("f.root","","",0);  f.cd("d");
Error in <TObjArray::At>: index -22985 out of bounds (size: 13, this: 0x0877cbc0)
Error in <TObjArray::AddAt>: out of bounds at -22985 in 877cbc0
Error in <TBuffer::CheckByteCount>: object of class TUUID read too few bytes: 18 instead of 934433390
Warning in <TBuffer::CheckByteCount>: TUUID::Streamer() not in sync with data on file, fix Streamer()

It basically means that most files with a sub-directories are not readable
(with the current version of root, but will be readable with this fix).

This is due to the fact that while writing ROOT uses TUUID::FillBuffer(),
which does NOT save the TUUID::Class_Version and while reading ROOT
uses TUUID::Streamer() which tries to read a version number!

The fix is to add the writing of the version number to TUUID::FillBuffer(),
to increase the version number of TDirectory, to use TDirectory's old
version number (i.e. 2) to provoke reading TUUID without version number,
and for higher version number TDirectory read the full TUUID.

Fix by Philippe, modified slightly by me.

Revision 4857 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Jul 9 21:05:09 2002 UTC (12 years, 6 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 6069 byte(s)
Diff to previous 3740
Add a new member TUUID fUUID. Each directory has now a universal unique id.
This identifier is persistent. A TDirectory has its bit kHasUUID set to 1.
A TDirectory/TFile is now referencable by a TRef.

Revision 3740 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Jan 23 15:48:05 2002 UTC (13 years ago) by rdm
Original Path: trunk/base/inc/TDirectory.h
File length: 5914 byte(s)
Diff to previous 3584
add TList.h where needed (so these classes compile fine if we decide to
remove TList.h from TNamed.h).

Revision 3584 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Jan 5 17:15:09 2002 UTC (13 years ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 5868 byte(s)
Diff to previous 2974
TDirectory::GetKey changed to const
New functions:
TKey *TDirectory::FindKey(const char *keyname) const
   // Find key with name keyname in the current directory

TKey *TDirectory::FindKeyAny(const char *keyname) const
   // Find key with name keyname in the current directory or
   // its subdirectories.
   // NOTE that If a key is found, the directory containing the key becomes
   // the current directory

TObject *TDirectory::FindObjectAny(const char *aname) const
   // Find object by name in the list of memory objects of the current
   // directory or its sub-directories.
   // After this call the current directory is not changed.
   // To automatically set the current directory where the object is found,
   // use FindKeyAny(aname)->ReadObj().

Revision 2974 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Oct 4 16:52:47 2001 UTC (13 years, 3 months ago) by rdm
Original Path: trunk/base/inc/TDirectory.h
File length: 5680 byte(s)
Diff to previous 2219
remove "const" qualifier from some non pointer and reference arguments.
When passing by value this qualifier is redundant and causes warnings in
the dictionary when CINT tries to cast to, e.g. a (const int).

Revision 2219 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed May 16 10:21:12 2001 UTC (13 years, 8 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 5686 byte(s)
Diff to previous 1205
Add two new functions TDirectory::GetCreationDate and GetModificationDate.

Revision 1205 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Dec 13 15:13:57 2000 UTC (14 years, 1 month ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 5562 byte(s)
Diff to previous 608
      W A R N I N G   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     ==================================================================
A very long list of changes in this pre-release of version 3.00.
We have modified the signature of many functions (in particular TObject)
to introduce more constness in the system.
You must change your code if your class derives from TObject and uses
one of the modified functions such as ls, Print, Compare, Hash, etc.
The modified functions in TObject have the following signature:
   virtual TObject    *Clone() const;
   virtual Int_t       Compare(const TObject *obj) const;
   virtual void        Delete(Option_t *option=""); // *MENU*
   virtual void        DrawClass() const; // *MENU*
   virtual void        DrawClone(Option_t *option="") const; // *MENU*
   virtual void        Dump() const; // *MENU*
   virtual TObject    *FindObject(const TObject *obj) const;
   virtual char       *GetObjectInfo(Int_t px, Int_t py) const;
   virtual ULong_t     Hash() const;
   virtual void        Inspect() const; // *MENU*
   virtual Bool_t      IsEqual(const TObject *obj) const;
   virtual void        ls(Option_t *option="") const;
   virtual void        Print(Option_t *option="") const;

A similar operation has been done with classes such as TH1, TVirtualPad,
TTree, etc.

Revision 608 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Sep 8 07:41:01 2000 UTC (14 years, 4 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 5497 byte(s)
Diff to previous 587
Several classes modified to :
 - take into account the renaming of kObjInCanvas to kMustCleanup
 - the introduction of FindObject instead of GetPrimitive

Revision 587 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Sep 6 14:13:10 2000 UTC (14 years, 4 months ago) by rdm
Original Path: trunk/base/inc/TDirectory.h
File length: 5384 byte(s)
Diff to previous 568
made several getters constant. Also added Add() (calling Append()) to be
consistent with TFolders.

Revision 568 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Sep 5 09:21:24 2000 UTC (14 years, 4 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 5314 byte(s)
Diff to previous 42
The following headers and classes have been modified to take into account;
  - the new signature of IsFolder (now const)
  - the new TObject::FindObject
  - the fact that the static functions of TObject have been moved to TROOT.

Revision 42 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed May 24 10:31:48 2000 UTC (14 years, 8 months ago) by brun
Original Path: trunk/base/inc/TDirectory.h
File length: 5311 byte(s)
Diff to previous 3
- Change return type from void to Int_t for several read/write functions   in several classes. The Read functions return the number of bytes read,   the Write functions the number of bytes written.

Revision 3 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue May 16 17:00:58 2000 UTC (14 years, 8 months ago) by rdm
Original Path: trunk/base/inc/TDirectory.h
File length: 5255 byte(s)
Copied from: branches/rdm/base/inc/TDirectory.h revision 2
Diff to previous 2
This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches.

Revision 2 - (view) (download) (as text) (annotate) - [select for diffs]
Added Tue May 16 17:00:58 2000 UTC (14 years, 8 months ago) by rdm
Original Path: branches/rdm/base/inc/TDirectory.h
File length: 5255 byte(s)
Initial import of ROOT into CVS

This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.

  Diffs between and
  Type of Diff should be a

Sort log by:

Subversion Admin
ViewVC Help
Powered by ViewVC 1.0.9