![]() |
ATLAS Offline Software
|
Base class for converters for Root schema evolution. More...
#include <TVirtualConverter.h>
Public Member Functions | |
| TVirtualConverter (UInt_t checksum, TClass *trans_cls, TClass *pers_cls) | |
| Constructor, with checksum and class pointers. More... | |
| TVirtualConverter (TClass *trans_cls, TClass *pers_cls) | |
| Constructor, with class pointers. More... | |
| TVirtualConverter (UInt_t checksum, const std::string &trans_cls, const std::string &pers_cls) | |
| Constructor, with checksum and class names. More... | |
| TVirtualConverter (const std::string &trans_cls, const std::string &pers_cls) | |
| Constructor, with class names. More... | |
| virtual | ~TVirtualConverter () |
| Destructor. 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 | ConvertVoid (void *transobj, const void *persobj)=0 |
| Do the conversion. 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 | |
| TVirtualConverter () | |
| Default constructor. More... | |
| 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... | |
Base class for converters for Root schema evolution.
Derive from this and define the Convert method to do the conversion. You must specify both the transient and persistent classes in the constructor. The checksum must also be specified if the actual shape in the file is different than the provided persistent class.
Definition at line 109 of file TVirtualConverter.h.
| TVirtualConverter::TVirtualConverter | ( | UInt_t | checksum, |
| TClass * | trans_cls, | ||
| TClass * | pers_cls | ||
| ) |
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. |
Definition at line 110 of file TVirtualConverter.cxx.
| TVirtualConverter::TVirtualConverter | ( | TClass * | trans_cls, |
| TClass * | pers_cls | ||
| ) |
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.
Definition at line 130 of file TVirtualConverter.cxx.
| TVirtualConverter::TVirtualConverter | ( | UInt_t | checksum, |
| const std::string & | trans_cls, | ||
| const std::string & | pers_cls | ||
| ) |
Constructor, with checksum and class names.
| checksum | The Root checksum of the persistent class we'll convert. |
| trans_cls | The name of the transient class to which we will be converting. |
| pers_cls | The name of the persistent class from which we will be converting. |
Definition at line 151 of file TVirtualConverter.cxx.
| TVirtualConverter::TVirtualConverter | ( | const std::string & | trans_cls, |
| const std::string & | pers_cls | ||
| ) |
Constructor, with class names.
| trans_cls | The name of the transient class to which we will be converting. |
| pers_cls | The name of the persistent class from which we will be converting. |
The checksum will be calculated automatically from the provided classes.
Definition at line 173 of file TVirtualConverter.cxx.
|
virtual |
|
protected |
Default constructor.
Intended for use with T_AthenaRootConverter only! You must call SetCtorInfo after this!
Definition at line 412 of file TVirtualConverter.cxx.
|
private |
Helper to check that the classes have been defined properly.
Check that the class pointers got defined.
Definition at line 188 of file TVirtualConverter.cxx.
|
private |
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 368 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 TVirtualConverter_T< TTrans, TPers >, TVirtualConverter_T< TrigSpacePointCounts_p1, TrigSpacePointCounts_p1_old >, TVirtualConverter_T< TauJetContainer_p1, TauJetContainer_p1_old >, TVirtualConverter_T< Identifier, DetDescrCondIdentifier_old >, and TVirtualConverter_T< TrigInDetTrackTruthMap, TrigInDetTrackTruthMap_old >.
|
virtual |
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 263 of file TVirtualConverter.cxx.
| int TVirtualConverter::GetCheckSum | ( | ) | const |
Return the checksum of the class from which we're converting.
Definition at line 238 of file TVirtualConverter.cxx.
| TClass * TVirtualConverter::GetPersClass | ( | ) |
Return the persistent class, from which we're converting.
Definition at line 229 of file TVirtualConverter.cxx.
| TClass * TVirtualConverter::GetTransClass | ( | ) |
Return the transient class, to which we're converting.
Definition at line 220 of file TVirtualConverter.cxx.
|
virtual |
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 250 of file TVirtualConverter.cxx.
|
virtual |
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 282 of file TVirtualConverter.cxx.
|
protected |
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 430 of file TVirtualConverter.cxx.
|
static |
Helper to convert a class name to a Root class pointer.
| name | The name of the class to convert. |
Returns nullptr on failure.
Definition at line 310 of file TVirtualConverter.cxx.
|
static |
Helper to convert a type_info to a Root class pointer.
| name | The type_info of the class to convert. |
Returns nullptr on failure.
Definition at line 322 of file TVirtualConverter.cxx.
|
private |
The declared checksum.
Definition at line 261 of file TVirtualConverter.h.
|
private |
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.
|
private |
The declared persistent class.
Definition at line 258 of file TVirtualConverter.h.
|
protected |
The temporary persistent object instance, used for conversions (in non-split mode).
Definition at line 271 of file TVirtualConverter.h.
|
private |
The declared transient class.
Definition at line 255 of file TVirtualConverter.h.
1.8.18