ATLAS Offline Software
|
This class takes care of holding EDM objects in memory. More...
#include <THolder.h>
Public Types | |
enum | TypeKind { OTHER, DATAVECTOR, AUXELEMENT } |
Type of the object held by this one. More... | |
Public Member Functions | |
THolder () | |
Default constructor. More... | |
THolder (void *object, ::TClass *type, ::Bool_t owner=kTRUE) | |
Constructor pointing to an object in memory. More... | |
THolder (void *object, const std::type_info &type, ::Bool_t owner=kTRUE) | |
Constructor pointing to an object in memory. More... | |
THolder (const void *object, ::TClass *type, ::Bool_t owner=kTRUE) | |
Constructor pointing to a const object in memory. More... | |
THolder (const void *object, const std::type_info &type, ::Bool_t owner=kTRUE) | |
Constructor pointing to a const object in memory. More... | |
THolder (const THolder &parent) | |
Copy constructor. More... | |
THolder (THolder &&parent) | |
Move constructor. More... | |
virtual | ~THolder () |
The destructor cleans out the memory used by the managed object. More... | |
THolder & | operator= (const THolder &rhs) |
Assignment operator. More... | |
THolder & | operator= (THolder &&rhs) |
Move operator. More... | |
const void * | get () const |
Return a typeless const pointer to the held object. More... | |
void * | get () |
Return a typeless pointer to the held object. More... | |
void ** | getPtr () |
Return a typeless pointer to the held object's pointer. More... | |
virtual void | set (void *obj) |
Replace the managed object. More... | |
::Bool_t | isOwner () const |
Check whether the holder owns its object. More... | |
void | setOwner (::Bool_t state=kTRUE) |
Set whether the holder should own its object. More... | |
::Bool_t | isConst () const |
Check if the object is const. More... | |
void | setConst () |
Mark the object as const. More... | |
virtual void * | getAs (const std::type_info &tid, ::Bool_t silent=kFALSE) const |
Return the object as a specific pointer. More... | |
virtual const void * | getAsConst (const std::type_info &tid, ::Bool_t silent=kFALSE) const |
Return the object as a specific, constant pointer. More... | |
void | renew () |
Renew the object in memory. More... | |
TypeKind | typeKind () const |
Return the type of the object held by this one. More... | |
Protected Member Functions | |
void | deleteObject () |
Internal function used to delete the managed object from memory. More... | |
void * | getImpl (const std::type_info &tid, ::Bool_t silent=kFALSE) const |
Internal function to get an object. More... | |
Protected Attributes | |
void * | m_object |
Typeless pointer to the object in memory. More... | |
::TClass * | m_type |
Concrete type of the object being held on to. More... | |
const std::type_info * | m_typeInfo |
Concrete type of the object, if it doesn't have a dictionary. More... | |
::Bool_t | m_owner |
A flag for whether the object owns what it points to. More... | |
TypeKind | m_typeKind |
Type of the object held. More... | |
::Bool_t | m_const |
Is the held object const? More... | |
This class takes care of holding EDM objects in memory.
In order to be able to access EDM objects easily as their concrete type, or as one of their base classes, a little trickery is needed.
We always access the branches of the input TTree as their concrete, transient types. It is then up to our own code to decide if the user is requesting the object as a type that it can be cast to, or not.
Type of the object held by this one.
Enumerator | |
---|---|
OTHER | Some non-specified type. |
DATAVECTOR | A DataVector container. |
AUXELEMENT | A type inheriting from |
xAOD::THolder::THolder | ( | ) |
xAOD::THolder::THolder | ( | void * | object, |
::TClass * | type, | ||
::Bool_t | owner = kTRUE |
||
) |
xAOD::THolder::THolder | ( | void * | object, |
const std::type_info & | type, | ||
::Bool_t | owner = kTRUE |
||
) |
xAOD::THolder::THolder | ( | const void * | object, |
::TClass * | type, | ||
::Bool_t | owner = kTRUE |
||
) |
Constructor pointing to a const object in memory.
Definition at line 87 of file THolder.cxx.
Constructor pointing to a const object in memory.
Definition at line 93 of file THolder.cxx.
Copy constructor.
The copy constructor takes the pointer from the parent object, and based on whether the parent owned the object or not, increments the shared count.
parent | The parent object that should be copied |
Definition at line 105 of file THolder.cxx.
xAOD::THolder::THolder | ( | THolder && | parent | ) |
Move constructor.
This is a tricky one.
Since the object is being moved, meaning that the parent will be deleted right after this operation, instead of incrementing and then decrementing the shared count, we just tell the parent that it doesn't own its object anymore. In this case if it did own it, the shared count will remain valid. Since it's this object owning it now. If it didn't own the object in the first place, then no hard no foul.
parent | The parent object that should be moved |
Definition at line 126 of file THolder.cxx.
|
virtual |
The destructor cleans out the memory used by the managed object.
Definition at line 135 of file THolder.cxx.
|
protected |
Internal function used to delete the managed object from memory.
Definition at line 437 of file THolder.cxx.
void * xAOD::THolder::get | ( | ) |
Return a typeless pointer to the held object.
Definition at line 220 of file THolder.cxx.
const void * xAOD::THolder::get | ( | ) | const |
Return a typeless const pointer to the held object.
Definition at line 215 of file THolder.cxx.
|
virtual |
Return the object as a specific pointer.
This function is used for retrieving an object as one of its bases.
It is used when the caller requires a non-const pointer to the managed object.
tid | The type as which the object is to be retrieved |
silent | When kTRUE , the call will fail silently when unsuccessful |
Reimplemented in xAOD::TCDVHolderT< T >.
Definition at line 370 of file THolder.cxx.
|
virtual |
Return the object as a specific, constant pointer.
This function is used for retrieving an object as one of its bases.
It is used when the caller need a const pointer to the managed object.
tid | The type as which the object is to be retrieved |
silent | When kTRUE , the call will fail silently when unsuccessful |
Reimplemented in xAOD::TCDVHolderT< T >.
Definition at line 394 of file THolder.cxx.
TClass * xAOD::THolder::getClass | ( | ) |
Definition at line 406 of file THolder.cxx.
const ::TClass * xAOD::THolder::getClass | ( | ) | const |
Return the concrete type of the object
Definition at line 401 of file THolder.cxx.
|
protected |
Internal function to get an object.
Internal helper or getAs and getAsConst.
tid | The type as which the object is to be retrieved |
silent | When kTRUE , the call will fail silently when unsuccessful |
Definition at line 296 of file THolder.cxx.
void ** xAOD::THolder::getPtr | ( | ) |
Return a typeless pointer to the held object's pointer.
Definition at line 225 of file THolder.cxx.
const std::type_info * xAOD::THolder::getTypeInfo | ( | ) | const |
Definition at line 411 of file THolder.cxx.
Bool_t xAOD::THolder::isConst | ( | ) | const |
Check if the object is const.
Definition at line 279 of file THolder.cxx.
Bool_t xAOD::THolder::isOwner | ( | ) | const |
Check whether the holder owns its object.
Definition at line 252 of file THolder.cxx.
Assignment operator.
The copy operator, just like the copy constructor makes the object aware that it doesn't own the object that it has the pointer to.
rhs | The object that has to be copied |
Definition at line 150 of file THolder.cxx.
Move operator.
This move operator is necessary to be able to use this type as a value type of STL containers.
See the comments given for the move constructor for an explanation of the behaviour of this operator.
rhs | The object that has to be moved |
Definition at line 187 of file THolder.cxx.
void xAOD::THolder::renew | ( | ) |
Renew the object in memory.
This function is mostly used in "Athena access mode", to delete the managed objects from memory between events, and recreate them from scratch.
Definition at line 420 of file THolder.cxx.
|
virtual |
Replace the managed object.
Reimplemented in xAOD::TCDVHolderT< T >.
Definition at line 230 of file THolder.cxx.
void xAOD::THolder::setConst | ( | ) |
Mark the object as const.
Definition at line 284 of file THolder.cxx.
void xAOD::THolder::setOwner | ( | ::Bool_t | state = kTRUE | ) |
|
inline |
Return the type of the object held by this one.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |