Log of /trunk/io/io/inc/TStreamerInfoActions.h
Parent Directory
Revision
43271 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Mar 7 05:53:52 2012 UTC (2 years, 10 months ago) by
pcanal
File length: 6823 byte(s)
Diff to
previous 40872
Add missing assign operator
Coverity number 35264,35265,35266,35267,35270,35273,35274,35275,
35281,35382,35383,35284,35285,35286,35286,35287,35288,35289,35290,35291,35292,35293,35294
35304,35305,35306,35307,35308,
35356,35371,35372,35378,35379,
35382
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: 6247 byte(s)
Diff to
previous 36169
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
36061 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Added
Mon Oct 4 16:05:51 2010 UTC (4 years, 3 months ago) by
pcanal
File length: 6127 byte(s)
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.
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.