Skip to content

xAODRootAccess: make TStore const-aware

Frank Winklmeier requested to merge fwinkl/athena:xaodroot_const into master

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:

  1. Add THolder( const void*, ...) constructors in addition to the non-const versions. If the const version is used we cast it away but remember that it was const in a new boolean m_const flag.
  2. Similarly we add TStore::record methods that take const 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.

Edited by Frank Winklmeier

Merge request reports