ATLAS Offline Software
|
A Root collection proxy for DataVector
containers.
More...
#include <TDVCollectionProxy.h>
Public Types | |
typedef TGenCollectionProxy::Sizing_t | Sizing_t |
Make the definition of Sizing_t public. More... | |
Public Member Functions | |
TDVCollectionProxy (const char *conttype) | |
Constructor. More... | |
TDVCollectionProxy (const TDVCollectionProxy &rhs) | |
Copy constructor. More... | |
virtual void | PushProxy (void *objstart) |
Start working with a new collection. More... | |
virtual TVirtualCollectionProxy * | Generate () const |
Clone this object. More... | |
void | SetResize (Sizing_t func) |
Set the resize(...) function used by the proxy. More... | |
Private Member Functions | |
virtual TGenCollectionProxy * | InitializeEx (Bool_t silent) |
Function initialising the proxy just in time. More... | |
void | FindOffsets (const char *elttype, const char *conttype) |
Initialize the cached pointer offsets. More... | |
TDVCollectionProxy & | operator= (const TDVCollectionProxy &) |
Private Attributes | |
TString | fName |
Name of the container that this class proxies. More... | |
Bool_t | fInitialized |
Flag for knowing whether the class was initialised already. More... | |
ptrdiff_t | fContoff |
The offset of the underlying DataVector in the declared type. More... | |
ptrdiff_t | fOffset |
Offset between the DV base pointer and the full DV pointer. More... | |
TClass * | fEltBase |
The element type to which the DV representation points. More... | |
TClass * | fEltType |
The declared element type of the DV. More... | |
A Root collection proxy for DataVector
containers.
In order for a container type to be treated properly by TTree::Draw
and friends, Root must recognize that it is in fact a container type, and generate an appropriate proxy for it. This doesn't happen automatically, though. This class serves as an appropriate proxy for DataVector
classes. Like the Root proxy classes, it's based on making a hard cast to a dummy DataVector
type. But because DataVector's
can inherit, we need to be careful about pointer conversions, something the Root proxy classes could ignore. We extend the Root environment buffer to cache information about the pointer offsets.
Definition at line 45 of file TDVCollectionProxy.h.
typedef TGenCollectionProxy::Sizing_t xAOD::TDVCollectionProxy::Sizing_t |
Make the definition of Sizing_t public.
Definition at line 50 of file TDVCollectionProxy.h.
Constructor.
conttype | The name of the container type we're proxying. Note that this may be different from a DataVector of elttype for classes which derive from DataVector . |
Definition at line 328 of file TDVCollectionProxy.cxx.
xAOD::TDVCollectionProxy::TDVCollectionProxy | ( | const TDVCollectionProxy & | rhs | ) |
Copy constructor.
rhs | The proxy to copy. |
Definition at line 370 of file TDVCollectionProxy.cxx.
Initialize the cached pointer offsets.
Suppose we have D
deriving from B
, and thus DataVector<D>
deriving from DataVector<B>
. In general, inheritance may be multiple or virtual, so we need to adjust the pointer offsets.
Suppose we're setting up the proxy for DataVector<D>
. Then fContoff
will be set to the offset of the DataVector<B>
base within DataVector<D>
— this is the amount we need to shift the container pointer by before applying the proxy. Originally, we cached an offset for the element conversions as well. But that doesn't work for the case of virtual derivation. Instead, we save the Reflex types for the base and derived types, and use Reflex to convert. (We can get away with caching the offset for the container because we know what the fully-derived type will be. We don't know that for the elements.)
elttype | The name of the contained type (including a trailing '*'). |
conttype | The name of the container type we're proxying. Note that this may be different from a DataVector of elttype for classes which derive from DataVector . |
Definition at line 522 of file TDVCollectionProxy.cxx.
|
virtual |
Clone this object.
Definition at line 428 of file TDVCollectionProxy.cxx.
|
privatevirtual |
Function initialising the proxy just in time.
Definition at line 445 of file TDVCollectionProxy.cxx.
|
private |
|
virtual |
Start working with a new collection.
objstart | The address of the collection. |
void xAOD::TDVCollectionProxy::SetResize | ( | Sizing_t | func | ) |
Set the resize(...) function used by the proxy.
The resize(...) functions need to be specific for the different classes.
This function is used to supply a specific resize(...) function for this proxy's class.
func | The function to use |
Definition at line 439 of file TDVCollectionProxy.cxx.
|
private |
The offset of the underlying DataVector
in the declared type.
Definition at line 85 of file TDVCollectionProxy.h.
|
private |
The element type to which the DV representation points.
Definition at line 90 of file TDVCollectionProxy.h.
|
private |
The declared element type of the DV.
Definition at line 92 of file TDVCollectionProxy.h.
|
private |
Flag for knowing whether the class was initialised already.
Definition at line 82 of file TDVCollectionProxy.h.
|
private |
Name of the container that this class proxies.
Definition at line 80 of file TDVCollectionProxy.h.
|
private |
Offset between the DV base pointer and the full DV pointer.
Definition at line 87 of file TDVCollectionProxy.h.