xAODRootAccess: make TStore const-aware
In order to avoid the many const_cast
in xAODRootAccess
we make the TStore
and THolder
aware of the const-ness of the recorded object. We still only hold non-const void*
but we check on retrieval for const-violations. This is the same logic as implemented in StoreGate.
This MR consists of two commits. The first one contains the actual functional changes. The second commit is just following through with making the code const-correct.
In a nutshell the changes are:
- Add
THolder( const void*, ...)
constructors in addition to the non-const versions. If theconst
version is used we cast it away but remember that it was const in a new booleanm_const
flag. - Similarly we add
TStore::record
methods that takeconst
pointers.
One of the consequences of enforcing const-correctness is that the retrieval of a non-const ConstDataVector
is no longer allowed (the unit test has been adjusted accordingly). That's the same behavior as in StoreGate.
Relates to ATEAM-863 and @akraszna will certainly want to review this.