Skip to content

Provide (and use) C++11 smart pointer 'look and feel' for SmartIF

Gerhard Raven requested to merge graven/Gaudi:dev-smartif-use into master

The aim of this branch is to confine, for everything that inherits from IInterface, the calls to addRef(), release() and queryInterface() to the SmartIF implementation. Exceptions are a few places where interfaces (currently) return bare pointers (instead of SmartIF...) and where one thus has to addRef() explicitly to avoid returning a dangling pointer. This can be avoided by changing the relevant interface to return a SmartIF instead of a bare pointer.

In addition, make SmartIF 'look and feel' like a smart pointer.

  • use explict bool conversion instead of .isValid()
  • add SmartIF::as(), to return a SmartIF to an alternate interface -- which (together with move) encourages the use of auto
  • add ISvcLocator::as(), to return a SmartIF to the current ISvcLocator.
  • add ServiceManager::service() which return SmartIF which encourages the use of auto

And add a few other C++11 modernizations (eg. prefer STL over raw loop)

Fixes GAUDI-1094

Merge request reports