ATLAS Offline Software
|
Easy-to-use templated class for defining converters. More...
#include <TVirtualConverter.h>
Public Member Functions | |
TVirtualConverter_T (TClass *trans_cls=0, TClass *pers_cls=0) | |
Constructor, with class pointers. More... | |
TVirtualConverter_T (UInt_t checksum, TClass *trans_cls=0, TClass *pers_cls=0) | |
Constructor, with checksum and class pointers. More... | |
virtual void | ConvertVoid (void *transobj, const void *persobj) |
Do the conversion. More... | |
virtual void | Convert (TTrans *transobj, const TPers *persobj)=0 |
Do the conversion. More... | |
TClass * | GetTransClass () |
Return the transient class, to which we're converting. More... | |
TClass * | GetPersClass () |
Return the persistent class, from which we're converting. More... | |
int | GetCheckSum () const |
Return the checksum of the class from which we're converting. More... | |
virtual void * | NewPersObj () |
Create a new instance of the persistent class. More... | |
virtual void | DeletePersObj (void *persobj) |
Destroy an instance of the persistent class. More... | |
virtual void | ReadBuffer (TBuffer &b, void *obj, Version_t version, UInt_t R__S, UInt_t R__c) |
Read object in non-split mode. More... | |
Static Public Member Functions | |
static TClass * | ToClass (const std::string &name) |
Helper to convert a class name to a Root class pointer. More... | |
static TClass * | ToClass (const std::type_info &id) |
Helper to convert a type_info to a Root class pointer. More... | |
Protected Member Functions | |
void | SetCtorInfo (UInt_t checksum, TClass *trans_cls, TClass *pers_cls) |
Set the parameters that would normally be passed to the constructor. More... | |
Protected Attributes | |
void * | fPersObj |
The temporary persistent object instance, used for conversions (in non-split mode). More... | |
Private Member Functions | |
void | CheckStreamInfos () |
Helper to allow for automatic schema evolution for persistent classes. More... | |
void | CheckClasses () |
Helper to check that the classes have been defined properly. More... | |
Private Attributes | |
TClass * | fTransClass |
The declared transient class. More... | |
TClass * | fPersClass |
The declared persistent class. More... | |
UInt_t | fCheckSum |
The declared checksum. More... | |
int | fOldLast |
Used by CheckStreamInfos: the length of the streamerinfo list that we saw on the last CheckStreamInfos call. More... | |
Easy-to-use templated class for defining converters.
The classes for the conversion are given by the TTrans
and TPers
template arguments. In the simple case, you shouldn't need to give any arguments to the constructor.
Definition at line 283 of file TVirtualConverter.h.
TVirtualConverter_T< TTrans, TPers >::TVirtualConverter_T | ( | TClass * | trans_cls = 0 , |
TClass * | pers_cls = 0 |
||
) |
Constructor, with class pointers.
trans_cls | The transient class to which we will be converting. |
pers_cls | The persistent class from which we will be converting. |
The checksum will be calculated automatically from the provided classes.
If either of the class pointers is defaulted to 0, the class pointer will be computed from the appropriate template parameter.
TVirtualConverter_T< TTrans, TPers >::TVirtualConverter_T | ( | UInt_t | checksum, |
TClass * | trans_cls = 0 , |
||
TClass * | pers_cls = 0 |
||
) |
Constructor, with checksum and class pointers.
checksum | The Root checksum of the persistent class we'll convert. |
trans_cls | The transient class to which we will be converting. |
pers_cls | The persistent class from which we will be converting. |
If either of the class pointers is defaulted to 0, the class pointer will be computed from the appropriate template parameter.
|
privateinherited |
Helper to check that the classes have been defined properly.
Check that the class pointers got defined.
Definition at line 189 of file TVirtualConverter.cxx.
|
privateinherited |
Helper to allow for automatic schema evolution for persistent classes.
Automatic schema evolution doesn't work for persistent classes ‘out-of-the-box’ because we're reading the ‘persistent class’, but the relevant StreamerInfo stored in the file will have the name of the ‘transient class’.
This gets called each time we try to read an object (in non-split mode).
Definition at line 369 of file TVirtualConverter.cxx.
|
pure virtual |
Do the conversion.
transobj | Pointer to an instance of the transient class. |
persobj | Pointer to an instance of the persistent class. |
An implementation of this must be provided in derived classes. It should initialize the object at transobj
from the one at persobj
.
Implemented in TrigSpacePointCounts_p1_old_cnv, TrigInDetTrackTruthMap_old_cnv, TauJetContainer_p1_old_cnv, and DetDescrCondIdentifier_old_cnv.
|
virtual |
Do the conversion.
transobj | Pointer to an instance of the transient class. |
persobj | Pointer to an instance of the persistent class. |
This implementation simply calls the Convert
below with the appropriate casting.
Implements TVirtualConverter.
|
virtualinherited |
Destroy an instance of the persistent class.
persobj | Pointer to the instance to destroy. |
The provided implementation of this uses TClass::Destructor
, but you can override it if need be.
Definition at line 264 of file TVirtualConverter.cxx.
|
inherited |
Return the checksum of the class from which we're converting.
Definition at line 239 of file TVirtualConverter.cxx.
|
inherited |
Return the persistent class, from which we're converting.
Definition at line 230 of file TVirtualConverter.cxx.
|
inherited |
Return the transient class, to which we're converting.
Definition at line 221 of file TVirtualConverter.cxx.
|
virtualinherited |
Create a new instance of the persistent class.
The provided implementation of this uses TClass::New
, but you can override it if need be.
Definition at line 251 of file TVirtualConverter.cxx.
|
virtualinherited |
Read object in non-split mode.
b | The source of the data. |
obj | The object into which we're reading. (This will be the transient object.) |
version | The version number of the class. |
R__s | The starting position in the buffer. |
R__c | The number of bytes for this object in the buffer. |
You normally shouldn't have to worry about this, but it's exposed here so that it can be overridden if needed. It's only used when reading in non-split mode.
Definition at line 283 of file TVirtualConverter.cxx.
|
protectedinherited |
Set the parameters that would normally be passed to the constructor.
checksum | The Root checksum of the persistent class we'll convert. |
trans_cls | The transient class to which we will be converting. |
pers_cls | The persistent class from which we will be converting. |
Intended for use with T_AthenaRootConverter
only!
Definition at line 431 of file TVirtualConverter.cxx.
|
staticinherited |
Helper to convert a class name to a Root class pointer.
name | The name of the class to convert. |
Returns 0 on failure.
Definition at line 311 of file TVirtualConverter.cxx.
|
staticinherited |
Helper to convert a type_info
to a Root class pointer.
name | The type_info of the class to convert. |
Returns 0 on failure.
Definition at line 323 of file TVirtualConverter.cxx.
|
privateinherited |
The declared checksum.
Definition at line 261 of file TVirtualConverter.h.
|
privateinherited |
Used by CheckStreamInfos:
the length of the streamerinfo list that we saw on the last CheckStreamInfos
call.
Definition at line 265 of file TVirtualConverter.h.
|
privateinherited |
The declared persistent class.
Definition at line 258 of file TVirtualConverter.h.
|
protectedinherited |
The temporary persistent object instance, used for conversions (in non-split mode).
Definition at line 271 of file TVirtualConverter.h.
|
privateinherited |
The declared transient class.
Definition at line 255 of file TVirtualConverter.h.