Merge branch 'dev-common-messaging' into 'master'
Generalize CommonMessaging, and use it to implement the messaging functionality ...
...in GaudiAlg/GaudiCommon
CommonMessaging needs two methods to be available to implement its functionality:
const std::string& name() const
SmartIF<ServiceLocator>& serviceLocator() const
As CommonMessaging is a mix-in class which uses the 'curiously recurring template'
pattern, it can either demand that the 'Base' class it is 'mixed' into already
provided this functionality, or it can add pure virtual methods to insure any
derived class does so. As this depends on the template argument, one cannot
a-priori decide which of the two solution is appropriate.
To solve this problem in a generic way, this patch uses SFINAE to detect
at compile time whether Base::name() and Base::serviceLocator() -- where
Base is the template argument provided to CommonMessaging -- are valid
expressions. If they are, no further action is taken. If not, the missing
function(s) is (are) added as pure virtual. This is done by specialization
of two template classes from which CommonMessaging inherits, prior to
inheriting from Base. Those specializations are either 'empty' classes,
or add the missing interface requirement.
See merge request !19
Loading
Please sign in to comment