GMR-215,217,219
apply Gaudi Merge Requests 215, 217 and 219: gaudi/Gaudi!215 (merged) gaudi/Gaudi!217 (merged) gaudi/Gaudi!219 (merged)
this assembles 3 merge requests related to const accessors of const ToolHandles
Based on lhcb/Gaudi!65 (merged) from the LHCb future branch. The current model for using ToolHandles has something like
ToolHandle<ITrackExtrapolator> m_trExt{ "TrackRungeKuttaExtrapolator", this };
as an algorithm data member. This works fine, but I just noticed that this model allows access to non-const methods of the tool, even in const methods of the parent algorithm. This is a problem if we want to enforce usage of only const interface methods in functional algorithms. With raw pointers I explicitly declare them const
const ITrackExtrapolator m_trExt{nullptr};
But the equivalent does not work with ToolHandle, as some methods require non-const access (for instance to release the tool). This update uses a little bit of type traits and const_casting to allow the user to declare they only want const access to the tool
ToolHandle<const ITrackExtrapolator> m_trExt{ "TrackRungeKuttaExtrapolator", this };
but internally allows the handle to discard the const qualifier only where needed.