Log of /trunk/io/io/inc/TBufferFile.h
Parent Directory
Revision
49019 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Mar 31 17:18:33 2013 UTC (21 months, 3 weeks ago) by
pcanal
File length: 26886 byte(s)
Diff to
previous 40872
Import revision 48931 from the v5-34-00 patch branch:
Add the concept of implicit rules to (centrally) support automatic translation of
STL collection from numeric type to other numeric type or for when the contained
class has some rules. Currently enabled only when the target is an std::vector.
Implement the transformation from STL container of numeric to any other numeric
type (both in TGenCollectionStreamer and TStreamerInfo[Actions]).
Migrate more of the conversions to TStreamerInfoActions.
Fix the Conversion of a Double32 or Float16 inside a collection of object to another
type (the previous implemetation was not supporting the customization of the factor
nor the number of bits).
Add TBuffer::ReadFastArrayWithNbits and WithFactor for use in the StreamerInfo Actions.
TStreamerInfoActions:
Introduce WithFactorMarker and NoFactorMarker to allow for less code duplicaton when
supporting Float16_t and Double32_t.
Replace the collection-memberwise action from loop over simple operation to using
ReadFastArray (to be compatible with TBufferXML).
Revision
40872 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Sep 13 21:33:33 2011 UTC (3 years, 4 months ago) by
pcanal
File length: 26506 byte(s)
Diff to
previous 39548
From Chris Jones:
Put in place the infrastructure to optimize the I/O writes in the same way we optimized the I/O reads.
Rename TBuffer::ReadSequence to TBuffer::ApplySequence as they can be used both for reading and writing. The 3 new signatures:
1. virtual Int_t ApplySequence(const TStreamerInfoActions::TActionSequence &sequence, void *object);
2. virtual Int_t ApplySequenceVecPtr(const TStreamerInfoActions::TActionSequence &sequence, void *start_collection, void *end_collection);
3. virtual Int_t ApplySequence(const TStreamerInfoActions::TActionSequence &sequence, void *start_collection, void *end_collection);
The 1st version is optimized to read a single object. The 2nd version is optimized to read the content of TClonesArrays and vectors of pointers to objects.
The 3rd version is used to streamed any collections.
In TBranchElement, introduce a set FillLeaves member functions to precalculate many of the (existing) conditional. Introduction support for the StreamerInfo write actions and sequences.
Revision
39548 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Jun 2 21:16:27 2011 UTC (3 years, 7 months ago) by
pcanal
File length: 26503 byte(s)
Diff to
previous 39134
Add the function TBuffer::AutoExpand to centralize the automatic
buffer extension policy. This enable the ability to tweak it later
(for example instead of always doubling the size, increasing by
only at most 2Mb or take hints from the number of entries already
in a TBasket).
Revision
39134 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri May 6 19:19:17 2011 UTC (3 years, 8 months ago) by
pcanal
File length: 26269 byte(s)
Diff to
previous 36061
Avoid the error messages similar to:
Error in <TBufferFile::ReadVersion>: Could not find the StreamerInfo with a checksum of -849380031 for the class "NeverWritten" in memberwise.root.
which is spurrious when it is issued when unstreaming a memberwised streamed collection which is always empty (Introduce TBuffer::ReadVersionForMemberWise
for this purpose).
Revision
36061 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Oct 4 16:05:51 2010 UTC (4 years, 3 months ago) by
pcanal
File length: 26199 byte(s)
Diff to
previous 35314
Introduce an optimized infrastructure for reading objects using a StreamerInfo.
Rather than driving the streaming using a switch statement inside TStreamerInfo::ReadBuffer,
the streaming is now driven using a simple loop over a sequence of configured StreamerInfo actions.
This improves run-time performance by allowing a dramatic reduction in function calls and code
branches at the expense of some code duplication.
There are 3 versions of this loop implemented in TBufferFile and overloaded in TBufferXML and TBufferSQL:
1. virtual Int_t ReadSequence(const TStreamerInfoActions::TActionSequence &sequence, void *object);
2. virtual Int_t ReadSequenceVecPtr(const TStreamerInfoActions::TActionSequence &sequence, void *start_collection, void *end_collection);
3. virtual Int_t ReadSequence(const TStreamerInfoActions::TActionSequence &sequence, void *start_collection, void *end_collection);
The 1st version is optimized to read a single object. The 2nd version is optimized to read the content of TClonesArrays and vectors of pointers to objects.
The 3rd version is used to streamed any collections.
TBufferXML and TBufferSQL overload the loops to introduce extra code to help the buffer keep track of which streamer
element is being streamed (this functionality is not used by TBufferFile.)
A TStreamerInfoActions::TActionSequence is an ordered sequence of configured actions.
A configured action has both an action which is a free standing function and a configuration object deriving
from TStreamerInfoActions::TConfiguration. The configuration contains information that is specific to the action
but varies from use to use, including the offset from the beginning of the object that needs to be updated.
Other examples of configuration include the number of bits requested for storing a Double32_t or its factor and minimum.
When the sequence is intended for a collection, the sequence also has a configuration object deriving
from TStreamerInfoActions::TLoopConfiguration which contains for example the size of the element of
a vector or the pointers to the iterators functions (see below).
Each TStreamerInfo has 2 reading sequences, one for object-wise reading (GetReadObjectWiseActions)
and one for member-wise reading (GetReadMemberWiseActions) which is used when streaming a TClonesArray
of a vector of pointer to the type of objects described by the TClass.
Each collection proxy has at least one reading sequences, one for the reading each version of the
contained class layout.
Each case of the TStreamerInfo::ReadBuffer switch statement is replaced by 4 new action functions,
one for the object wise reading, one for the member wise reading for TClonesArray and vector of pointers,
one for the member wise reading for a vector of object and one for all other collections.
Each collection (proxy) needs to provide 5 new free standing functions:
// Set of functions to iterate easily throught the collection
static const Int_t fgIteratorArenaSize = 16; // greater than sizeof(void*) + sizeof(UInt_t)
typedef void (*CreateIterators_t)(void *collection, void **begin_arena, void **end_arena);
virtual CreateIterators_t GetFunctionCreateIterators(Bool_t read = kTRUE) = 0;
// begin_arena and end_arena should contain the location of a memory arena of size fgIteratorSize.
// If the collection iterator are of that size or less, the iterators will be constructed in place in those location (new with placement)
// Otherwise the iterators will be allocated via a regular new and their address returned by modifying the value of begin_arena and end_arena.
typedef void* (*CopyIterator_t)(void *dest, const void *source);
virtual CopyIterator_t GetFunctionCopyIterator(Bool_t read = kTRUE) = 0;
// Copy the iterator source, into dest. dest should contain the location of a memory arena of size fgIteratorSize.
// If the collection iterator is of that size or less, the iterator will be constructed in place in this location (new with placement)
// Otherwise the iterator will be allocated via a regular new and its address returned by modifying the value of dest.
typedef void* (*Next_t)(void *iter, const void *end);
virtual Next_t GetFunctionNext(Bool_t read = kTRUE) = 0;
// iter and end should be pointers to respectively an iterator to be incremented and the result of collection.end()
// If the iterator has not reached the end of the collection, 'Next' increment the iterator 'iter' and return 0 if
// the iterator reached the end.
// If the end was not reached, 'Next' returns the address of the content pointed to by the iterator before the
// incrementation ; if the collection contains pointers, 'Next' will return the value of the pointer.
typedef void (*DeleteIterator_t)(void *iter);
typedef void (*DeleteTwoIterators_t)(void *begin, void *end);
virtual DeleteIterator_t GetFunctionDeleteIterator(Bool_t read = kTRUE) = 0;
virtual DeleteTwoIterators_t GetFunctionDeleteTwoIterators(Bool_t read = kTRUE) = 0;
// If the size of the iterator is greater than fgIteratorArenaSize, call delete on the addresses,
// Otherwise just call the iterator's destructor.
This functions are currently only 'emulated' using the old infrastructure for the collections other than vector ; they
will later one be provided by the dictionaries.
Revision
35314 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Sep 16 03:22:09 2010 UTC (4 years, 4 months ago) by
pcanal
File length: 25714 byte(s)
Diff to
previous 27747
Migrate the functionality of TStreamerInfo::TagFile to a new interface TBuffer::TagStreamerInfo
so that TMessage can customize the behavior. TMessage now relies on this new interface
instead of TBuffer::IncrementLevel which had the disadvantage of being called not only
during writing but also during reading (where there is no need to keep track of the StreamerInfo used).
[This change will also allow us to keep the calls to IncrementLevel/DecrementLevel only in the
case the buffer is a TBufferXML]
Fix the implementation of TSocket::RecvStreamerInfos to properly handle the case where there are
abstract classes (when GetStreamerInfo() can not be called on an abstract class until it has
been called for one of the concrete derived classes) and the case of STL containers.
Revision
27683 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Mar 3 20:15:49 2009 UTC (5 years, 10 months ago) by
pcanal
File length: 25756 byte(s)
Diff to
previous 25863
Allow user to provide a custom reallocator when the TBuffer is being passed
memory. If the TBuffer does not own the memory __and__ no custom memory
reallocator has been set, a Fatal error will be issued:
Fatal in <TBufferFile::Expand>: Failed to expand the data buffer because TBuffer does not own it and no custom memory reallocator was provided.
This fixes the savannah issues 47611 and 39120
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: 25683 byte(s)
Diff to
previous 24219
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
24219 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Jun 11 15:39:45 2008 UTC (6 years, 7 months ago) by
brun
File length: 25066 byte(s)
Diff to
previous 23954
-implement the new function TBufferFile::ForceWriteInfo. It simply calls
the existing TStreamerInfo::ForceWriteInfo function
-the new function ForceWriteInfoClones is similar to the old ForceWriteInfo
except that it calls TBufferFile::ForceWriteInfo instead of TStreamerInfo::ForceWriteInfo
Revision
23954 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed May 21 16:49:24 2008 UTC (6 years, 8 months ago) by
brun
File length: 24981 byte(s)
Diff to
previous 23934
Remove tthe function GetInfoStack.
Rename the protected function WriteObject with 2 arguments to WriteObjectClass to avoid
a compiler complaint about a hidden function when implementing a new function TMessage::WriteObject.
-This line, and those below, will be ignored--
M io/io/src/TBufferFile.cxx
M io/io/inc/TBufferFile.h
Revision
23934 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue May 20 15:11:45 2008 UTC (6 years, 8 months ago) by
brun
File length: 25035 byte(s)
Diff to
previous 23122
Add a new getter
TStreamerInfo *TBufferFile::GetInfoStack(Int_t number) const
//return the TStreamerInfo at position number in the InfoStack
//return 0 if the number requested is outside the stack
This new function will be used in a coming version of TSocket supporting
schema evolution by sending TStreamerInfo objects together with the message object.
Revision
17706 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Feb 5 18:08:45 2007 UTC (7 years, 11 months ago) by
brun
Original Path:
trunk/io/inc/TBufferFile.h
File length: 24476 byte(s)
Diff to
previous 17537
-Implement the new following functions in TBuffer
// Utilities for TClass
virtual Int_t ReadClassEmulated(TClass *cl, void *object) = 0;
virtual Int_t ReadClassBuffer(TClass *cl, void *pointer) = 0;
virtual Int_t ReadClassBuffer(TClass *cl, void *pointer, Int_t version, UInt_t start, UInt_t count) = 0;
virtual Int_t WriteClassBuffer(TClass *cl, void *pointer) = 0;
Revision
17537 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sun Jan 28 18:27:18 2007 UTC (7 years, 11 months ago) by
brun
Original Path:
trunk/io/inc/TBufferFile.h
File length: 24144 byte(s)
Diff to
previous 17445
-Implement the changes required by the new version of TBuffer.
-Add the following new functions that are required to complete the separation
of base and cont from the I/O sub-system. Some of these functions were
implemented (temporarily) in the now obsolete class TVirtualIO/TFileIO.
// Special basic ROOT objects and collections
virtual TProcessID *GetLastProcessID(TRefTable *reftable) const = 0;
virtual UInt_t GetTRefExecId() = 0;
virtual TProcessID *ReadProcessID(UShort_t pidf) = 0;
virtual UShort_t WriteProcessID(TProcessID *pid) = 0;
// Utilities for TClonesArray
virtual void ForceWriteInfo(TClonesArray *a) = 0;
virtual Int_t ReadClones (TClonesArray *a, Int_t nobjects) = 0;
virtual Int_t WriteClones(TClonesArray *a, Int_t nobjects) = 0;
Revision
17445 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Jan 23 06:10:39 2007 UTC (8 years ago) by
brun
Original Path:
trunk/io/inc/TBufferFile.h
File length: 23727 byte(s)
Diff to
previous 17412
Implement new function
virtual Int_t TBuffer::GetVersionOwner() const
It returns the version number of the buffer owner. In case of TBufferFile,
it returns the file version number.
This new function is introduced to further reduce the dependencies on the I/O system.
Revision
17412 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Sat Jan 20 19:29:35 2007 UTC (8 years ago) by
brun
Original Path:
trunk/io/inc/TBufferFile.h
File length: 23680 byte(s)
Diff to
previous 17402
-Remove Varargs.h from TString.h and TObject.h and add this include
in the few files that need it.
-Move the following enums from TBuffer.h to TBufferFile.h
enum { kMapSize = 503 };
enum { kStreamedMemberWise = BIT(14) }; //added to version number to know if a collection has been stored member-wise
enum { kNotDecompressed = BIT(15) }; //indicates a weird buffer, used by TBasket
enum { kCannotHandleMemberWiseStreaming = BIT(17), //if set TClonesArray should not use memeber wise streaming
kTextBasedStreaming = BIT(18) }; // indicates if buffer used for XML/SQL object streaming
Revision
17402 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Added
Fri Jan 19 16:48:00 2007 UTC (8 years ago) by
brun
Original Path:
trunk/io/inc/TBufferFile.h
File length: 23220 byte(s)
CVs been changed into a pure abstract interface.
The concrete implementation is in the new class TBufferFile.
All classes previously deriving from TBuffer derive now from TBufferFile, ie
TBuffer <- TBufferFile <- TMessage
<- TBufferXML
<- TBufferSQL
<- TBufferSQL2
Because there are several problems with C++ operators overloading,
The I/O operators are defined in TBuffer. These are inline functions
calling C++ virtual functions defined in TBuffer and overloaded
by TBufferFile and all other derived classes when necessary.
The previous implementation of TBuffer.h included <vector> and Bytes.h.
The two include statements have been moved to TBufferFile.h. As a result the
compilation of the ROOT system is now slightly faster and a big bonus
is that changes in TBufferFile or Bytes.h will affect only TBufferFile
and will not force the recompilation of the entire system.
This change has some side-effects. If you assumed that include <vector>
was done by TBuffer.h, you may have to specify this include directly
in your class. This was the case for a few ROOT classes.
: ----------------------------------------------------------------------
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.