Log of /trunk/core/base/src/TDirectory.cxx
Parent Directory
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: 37519 byte(s)
Diff to
previous 41043
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
41043 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Sep 28 09:26:40 2011 UTC (3 years, 3 months ago) by
pcanal
File length: 37182 byte(s)
Diff to
previous 40819
In TDirectory::SaveObjectAs, use to TContext to make sure to revert gDirectory even if the file opening failed. Use TString::Form rather than ::Form
Revision
37531 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Dec 10 20:38:06 2010 UTC (4 years, 1 month ago) by
pcanal
File length: 37214 byte(s)
Diff to
previous 36409
Fix several memory leaks (TSchemaRuleSet, TClass, TFolder, stress, TStreamerInfo, TFile, TFree)
Introduce a new preprocessor symbol (R__COMPLETE_MEM_TERMINATION) that allows for
better tracking of memory leak. When ROOT is compiled with this symbols is defined,
globally held objects will be deleted at the time of the process termination.
With this symbol defined, some tests (root.exe -b -l -q ; test/stress ;) run under
'valgrind --leak-check=yes' with no memory leak reports (but still a few still
reacheable blocks). However, this does not yet support (i.e. segfault at termination)
the case where TFunctions are created on the 'CINT' stack (and thus fails roottest) and
some uses of CINT functions for fitting ... and probably also fails on Windows.
Revision
36408 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Oct 22 09:21:49 2010 UTC (4 years, 3 months ago) by
brun
File length: 37194 byte(s)
Diff to
previous 36239
In the mkdir functions, one can now create a tree of sub-directories
// Create a sub-directory and return a pointer to the created directory.
// Returns 0 in case of error.
// Returns 0 if a directory with the same name already exists.
// Note that the directory name may be of the form "a/b/c" to create a hierarchy of directories.
// In this case, the function returns the pointer to the "a" directory if teh operation is successful.
Revision
27633 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Feb 27 00:51:37 2009 UTC (5 years, 10 months ago) by
pcanal
File length: 36668 byte(s)
Diff to
previous 27600
Insure that for TDirectory and TDirectoryFile's FindObjectAny correctly look
into their subdirectories list of memory objects. This solves the Savannah
report #47334
Revision
27600 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Feb 25 08:17:22 2009 UTC (5 years, 10 months ago) by
brun
File length: 36224 byte(s)
Diff to
previous 25450
From Matthew Strait:
* Fix spelling and grammar errors
* Fold long lines so they don't spill off the right side
* Add spaces for readability
* Standardize notation and style within sections.
Revision
25450 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Sep 18 21:13:42 2008 UTC (6 years, 4 months ago) by
pcanal
File length: 36221 byte(s)
Diff to
previous 23822
Import the code from the branch dev/datamodelevolution revision 25436
This implements the infrastructure for the new Data Model Evolution Scheme.
This Data Model Evolution is brought to your courtesy of BNL/STAR/ATLAS/Fermi/Cern
Current Capabilities:
Assign values to transient data members
Rename classes
Rename data members
Change the shape of the data structures or convert one class structure to another
Change the meaning of data members
Ability to access the TBuffer directly when needed
Ensure that the objects in collections are handled in the same way as the ones stored separately
Supported in object-wise, member-wise and split modes.
Coming soon:
Make things operational also in bare ROOT mode
Ability to transform data before writing
Support for changing the class type of nested object in a split branch
Support for access to onfile version of nested objects from within the parent rule
LinkDef rule syntax:
Setting a transient member:
#pragma read sourceClass="ACache" targetClass="ACache" source="" version="[1-]" target="zcalc" \
code="{ zcalc = false; }"
Setting a new member from 2 removed members
#pragma read sourceClass="ACache" targetClass="ACache" source="int x; int y; char c" version="[8]" target="z" \
code="{ z = onfile.x*1000 + onfile.y*10; }"
Renaming a class
#pragma read sourceClass="ACache" version="[8]" targetClass="Axis" \
source="int x; int y;" target="z" \
code="{ z = onfile.x*1000 + onfile.y*
#pragma read sourceClass="ACache" version="[9]" targetClass="Axis";
Selection XML syntax
<read sourceClass="ACache" targetClass="ACache" source="" version="[1-]" target="zcalc">
<![CDATA[
{ zcalc = false; }
]]></read>
Revision
23822 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue May 13 13:24:22 2008 UTC (6 years, 8 months ago) by
brun
File length: 36288 byte(s)
Diff to
previous 22992
From Axel:
patch improves
Warning in <TROOT::Append>: Replacing existing TH1: Rint (Potential memory leak).
by printing the object's name instead of the directory's.
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: 36265 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: 34765 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: 34929 byte(s)
Diff to
previous 22825
move the directories:
base clib cont meta metautils newdelete pcre rint thread unix utils
winnt zip
under the new core meta directory.
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/src/TDirectory.cxx
File length: 35032 byte(s)
Diff to
previous 18677
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
18677 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun May 6 07:49:10 2007 UTC (7 years, 8 months ago) by
brun
Original Path:
trunk/base/src/TDirectory.cxx
File length: 34505 byte(s)
Diff to
previous 18672
Fix a problem when saving a canvas in a ROOT file and gDirectory is gROOT.
In this case gDirectory->OpenFile calls a dummy function.
The call to TDirectory::OpenFile is replaced by a call to TFile::Open
via gROOT->ProcessLine.
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/src/TDirectory.cxx
File length: 34448 byte(s)
Diff to
previous 17594
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/src/TDirectory.cxx
File length: 33231 byte(s)
Diff to
previous 17527
-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
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/src/TDirectory.cxx
File length: 30837 byte(s)
Diff to
previous 17443
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/src/TDirectory.cxx
File length: 29840 byte(s)
Diff to
previous 16261
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
15808 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Jul 14 19:49:59 2006 UTC (8 years, 6 months ago) by
pcanal
Original Path:
trunk/base/src/TDirectory.cxx
File length: 63707 byte(s)
Diff to
previous 15779
Prevent TFile::Close and TDirectory::Close from manipulating gDirectory.
This is necessary since there is no guarantee that the current directory
before the call to TFile::Close will still be a valid object after
the close (it might be deleted as a side-effect of the Close).
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/src/TDirectory.cxx
File length: 64205 byte(s)
Diff to
previous 14831
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
14831 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Apr 25 09:28:42 2006 UTC (8 years, 9 months ago) by
brun
Original Path:
trunk/base/src/TDirectory.cxx
File length: 59608 byte(s)
Diff to
previous 14745
In TFile add a new transient member fMustFlush.
By default this member is set kTRUE. However when calling TFile::Write
a considerable amount of time may be gained by setting this flag to kFALSE
in case the file has a deep directory structure.
Revision
14745 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Apr 19 08:22:26 2006 UTC (8 years, 9 months ago) by
rdm
Original Path:
trunk/base/src/TDirectory.cxx
File length: 59591 byte(s)
Diff to
previous 13987
Change the TError.h macros:
Assert -> R__ASSERT
Check -> R__CHECK
Change the TCollection.h macro:
ForEach -> R__FOR_EACH
This to avoid potential problems due too trivial macro names.
The old macros will be removed in the next release. Currently
they will print out warning messages with the advice to move
to the new macro names.
Revision
13949 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Jan 30 09:01:12 2006 UTC (8 years, 11 months ago) by
rdm
Original Path:
trunk/base/src/TDirectory.cxx
File length: 60056 byte(s)
Diff to
previous 13923
TStreamerInfo was including TFile.h, TROOT.h and TClonesArray.h iso of
forward declaring them. This caused massif recompilation if e.g.
TFile.h was changed. Correct some sources that did not include
TFile.h because it was coming via TStreamerInfo.h.
Revision
13911 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Jan 24 21:28:54 2006 UTC (9 years ago) by
pcanal
Original Path:
trunk/base/src/TDirectory.cxx
File length: 60020 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().
In TDirectory::ReadAll() cast to TNamed was used to find and delete existing object,
but some TObject also can return correct names (like TCanvas).
Revision
12877 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Sep 30 08:56:03 2005 UTC (9 years, 3 months ago) by
pcanal
Original Path:
trunk/base/src/TDirectory.cxx
File length: 58464 byte(s)
Diff to
previous 12711
Make TDirectory::Get and TDirectory::GetObject rely on recursivity
rather than changing the current directory to handle pathname. This solves
a problem appearing when the object looked-for has the same name as one
of the containing directory (eg. gDirectory->GetObject("a/b/a", obj);
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/src/TDirectory.cxx
File length: 57921 byte(s)
Diff to
previous 12128
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
12123 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Jun 22 20:18:12 2005 UTC (9 years, 7 months ago) by
brun
Original Path:
trunk/base/src/TDirectory.cxx
File length: 59898 byte(s)
Diff to
previous 11916
From Constantin Loizides
This patch implements:
- decentralized, automatic mutex initialization,
see R__LOCKGUARD2 in TVirtualMutex
- PROOF parallel startup fixes
- more thread protection (in base, cont, meta, rest to be done)
- cleanups
From Eddy Offermann:
TString::Atoi and Atof are made const.
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/src/TDirectory.cxx
File length: 59728 byte(s)
Diff to
previous 10902
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
10902 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Jan 12 18:02:28 2005 UTC (10 years ago) by
brun
Original Path:
trunk/base/src/TDirectory.cxx
File length: 59409 byte(s)
Diff to
previous 10845
From Philippe:
TDirectory:
update TDirectory::GetObject to be able to retrieve TObject from
the in-memory list (to match the behavior of TObject::Get).
stress:
update to use TDirectory new object retrieval interface. This will
allow testing of their availability in interpreted code.
TChainElement:
Insure the proper default initialization of new data members
TTree:
slight warning message fix
TTreeFormula:
Update to a problem in case of splitted top level STL container
Fix for TTree::Scan of strings when they are inside a collection
(the first element __was__ repeated instead of the sub-sequent elements).
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/src/TDirectory.cxx
File length: 58602 byte(s)
Diff to
previous 9419
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
9236 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Jun 17 17:31:00 2004 UTC (10 years, 7 months ago) by
brun
Original Path:
trunk/base/src/TDirectory.cxx
File length: 58299 byte(s)
Diff to
previous 9227
In TDirectory::WriteTObject and WriteObjectAny, fix a problem
when writing an object to a subdirectory and options "OverWrite" or "WriteDelete"
are specified. Note that when these functions are called, the current directory "gDirectory"
is not necessarily this directory.
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/src/TDirectory.cxx
File length: 58164 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
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/src/TDirectory.cxx
File length: 58156 byte(s)
Diff to
previous 9098
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/src/TDirectory.cxx
File length: 57398 byte(s)
Diff to
previous 9015
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/src/TDirectory.cxx
File length: 55080 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
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/src/TDirectory.cxx
File length: 52835 byte(s)
Diff to
previous 8076
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/src/TDirectory.cxx
File length: 46258 byte(s)
Diff to
previous 6804
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
6186 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Feb 26 10:11:51 2003 UTC (11 years, 10 months ago) by
brun
Original Path:
trunk/base/src/TDirectory.cxx
File length: 46448 byte(s)
Diff to
previous 5840
Implement all the changes required to process files > 2 GBytes.
Activating this option will imply changing Seek_t to long long.
We hope that Masa will implement the longlong type by default
in the not too distant future in CINT.
The file format remains compatible for files smaller than the
threshold set in TFile::kStartBigFile = 2 GigaBytes.
The changes are the following:
in TFile
========
Remove the enum kBegin, kUnits (not used anymore).
Add new enum kStartBigFile
When creating a new file (in TFile::Init) fBEGIN is now set to 100
bytes instead of 64. TFile::WriteHeader is called assuming that
the file will be smaller than kStartBigFile.
When closing the file, if the file is bigger than kStartBigFile,
a new format is used in WriteHeader using 64 bits to store all
values of type Seek_t and the file version (fVersion) is set
to fVersion+1000000.
All functions like TFile::Map, TFile::Recover have been adapted
to follow the new convention.
in TDirectory
=============
TDirectory::Sizeof has been modified to return 12 bytes in addition
for fSeekDir, fSeekParent and fSeekKeys when writing a directory
in a file bigger than kStartBigFile.
The TDirectory constructor is setting a temporary bit to inform
the function Sizeof that it has to return 12 addtional bytes.
TDirectory::FillBuffer writes fSeekDir, fSeekParent and fSeekKeys
with 64 bits if necessary. The version number of the directory
is set to TDirectory class version + 1000 in this case.
Corresponding changes in TDirectory::ReadBuffer and TDirectory::Streamer.
in TFree
========
TFree::Sizeof has been moved to the implementation file.
Like for TDirectory, the functions FillBuffer and ReadBuffer have been
modified to write fFirst and fLast in 64 bits if necessary.
When writing in 64 bits mode, the TFree version is incremented by 1000.
in TKey and TBasket
===================
Same changesas in TDirectory in teh functions FillBuffer, ReadBuffer
and Streamer. The TKey version number is incremented by 1000
when writing in 64 bits mode.
Revision
5076 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Aug 7 11:03:46 2002 UTC (12 years, 5 months ago) by
brun
Original Path:
trunk/base/src/TDirectory.cxx
File length: 43959 byte(s)
Diff to
previous 5050
In TDirectory::Append, SetBit(kMustCleanup) for the object.
This will force RecursiveRemove to be called when the object
will be deleted.
With this change, any TObject may be added to a TDirectory.
When the object will be deleted, it will be automatically removed
from any TDirectory referencing it.
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/src/TDirectory.cxx
File length: 43861 byte(s)
Diff to
previous 4859
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
3959 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Feb 11 09:08:10 2002 UTC (12 years, 11 months ago) by
brun
Original Path:
trunk/base/src/TDirectory.cxx
File length: 43505 byte(s)
Diff to
previous 3758
Add new code from Susan Kasahara to accomodate another
use case for this particular situation in which the file has been
opened by the writer but no keys have been written to the file.
This additional use case is a daq -> dispatcher configuration running at a
detector site in which a dispatcher serves data from the data file while
the daq is still writing to it. To support this, the daq writer uses
TDirectory::SaveSelf, and the dispatcher reader uses TDirectory::ReadKeys
as is described under TDirectory::ReadKeys. This works well as long as at
least 1 key has been written to the file by the daq writer.
When the file has been opened by the writer, but no key has yet been
written to the file, one must be able to open the file with no error message
reported, and have TDirectory::ReadKeys return the number of keys = 0.
Revision
3758 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Jan 25 16:40:08 2002 UTC (13 years ago) by
brun
Original Path:
trunk/base/src/TDirectory.cxx
File length: 43434 byte(s)
Diff to
previous 3748
Add the following comments in TDirectory::Get
//
// VERY IMPORTANT NOTE:
// In case the class of this object derives from TObject but not
// as a first inheritance, one must cast the return value twice.
// Example1: Normal case:
// class MyClass : public TObject, public AnotherClass
// then on return, one can do:
// MyClass *obj = (MyClass*)directory->Get("some object of MyClass");
//
// Example2: Special case:
// class MyClass : public AnotherClass, public TObject
// then on return, one must do:
// MyClass *obj = (MyClass*)((void*)directory->Get("some object of MyClass");
//
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/src/TDirectory.cxx
File length: 42879 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
2768 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Aug 30 13:04:17 2001 UTC (13 years, 4 months ago) by
brun
Original Path:
trunk/base/src/TDirectory.cxx
File length: 40227 byte(s)
Diff to
previous 2648
Fix a problem in TDirectory::Cd1 and TDirectory::cd1.
The input argument of type const char* was overwritten inside the function.
Only one character was replaced. This was OK with compiled code.
However when the functions were called from CINT, this was generating a seg fault.
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/src/TDirectory.cxx
File length: 39137 byte(s)
Diff to
previous 1076
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
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/src/TDirectory.cxx
File length: 38612 byte(s)
Diff to
previous 533
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.
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.