diff --git a/Rich/RichFutureDAQ/RichFutureDAQ/RichPDMDBDecodeMapping.h b/Rich/RichFutureDAQ/RichFutureDAQ/RichPDMDBDecodeMapping.h index 3843d12377e241c4ba6f8125f99207292315915b..37068bddb32813c3c33a29ddda55c5de1158767e 100644 --- a/Rich/RichFutureDAQ/RichFutureDAQ/RichPDMDBDecodeMapping.h +++ b/Rich/RichFutureDAQ/RichFutureDAQ/RichPDMDBDecodeMapping.h @@ -189,6 +189,10 @@ namespace Rich::Future::DAQ { /// Default conditions name static constexpr const char* DefaultConditionKey = "PDMDBDecodeMapping-Handler"; + private: + /// Define the messenger entity + inline auto messenger() const noexcept { return m_parent; } + private: // data diff --git a/Rich/RichFutureDAQ/RichFutureDAQ/RichPDMDBEncodeMapping.h b/Rich/RichFutureDAQ/RichFutureDAQ/RichPDMDBEncodeMapping.h index 957d787c3726cba3048a0fc33942535c8ed119a1..ad10779b3402eccdddc0a02cee7c84ec2c3a91d0 100644 --- a/Rich/RichFutureDAQ/RichFutureDAQ/RichPDMDBEncodeMapping.h +++ b/Rich/RichFutureDAQ/RichFutureDAQ/RichPDMDBEncodeMapping.h @@ -188,6 +188,10 @@ namespace Rich::Future::DAQ { /// Default conditions name static constexpr const char* DefaultConditionKey = "PDMDBEncodeMapping-Handler"; + private: + /// Define the messenger entity + inline auto messenger() const noexcept { return m_parent; } + private: // data diff --git a/Rich/RichFutureDAQ/RichFutureDAQ/RichTel40CableMapping.h b/Rich/RichFutureDAQ/RichFutureDAQ/RichTel40CableMapping.h index aba45f53aed3a758abbed7a1c96478f5db947770..2a9f93b05668c3539f3aecaa89a3d98d28faa49f 100644 --- a/Rich/RichFutureDAQ/RichFutureDAQ/RichTel40CableMapping.h +++ b/Rich/RichFutureDAQ/RichFutureDAQ/RichTel40CableMapping.h @@ -234,6 +234,10 @@ namespace Rich::Future::DAQ { /// Default conditions name static constexpr const char* DefaultConditionKey = "Tel40CableMapping-Handler"; + private: + /// Define the messenger entity + inline auto messenger() const noexcept { return m_parent; } + private: // data diff --git a/Rich/RichFutureDAQ/src/lib/RichPDMDBDecodeMapping.cpp b/Rich/RichFutureDAQ/src/lib/RichPDMDBDecodeMapping.cpp index 6fd1d42ba682c4c455f78a1c0c6fecc90474914f..6221d76ccc8f7fda673fe8472bc21617096356a5 100644 --- a/Rich/RichFutureDAQ/src/lib/RichPDMDBDecodeMapping.cpp +++ b/Rich/RichFutureDAQ/src/lib/RichPDMDBDecodeMapping.cpp @@ -21,12 +21,11 @@ #include "Gaudi/Algorithm.h" // Messaging -#define _RICH_MESSAGING_HOST_ m_parent #include "RichFutureUtils/RichMessaging.h" #define debug( ... ) \ - if ( m_parent ) { ri_debug( __VA_ARGS__ ); } + if ( messenger() ) { ri_debug( __VA_ARGS__ ); } #define verbo( ... ) \ - if ( m_parent ) { ri_verbo( __VA_ARGS__ ); } + if ( messenger() ) { ri_verbo( __VA_ARGS__ ); } using namespace Rich::Future::DAQ; using namespace Rich::DAQ; diff --git a/Rich/RichFutureDAQ/src/lib/RichPDMDBEncodeMapping.cpp b/Rich/RichFutureDAQ/src/lib/RichPDMDBEncodeMapping.cpp index 4925d5ce822bed23a3d75b175c2dd7ae9ccae280..293d1e2bf3a656b2a737a48a36055bd02c05131c 100644 --- a/Rich/RichFutureDAQ/src/lib/RichPDMDBEncodeMapping.cpp +++ b/Rich/RichFutureDAQ/src/lib/RichPDMDBEncodeMapping.cpp @@ -21,12 +21,11 @@ #include "Gaudi/Algorithm.h" // Messaging -#define _RICH_MESSAGING_HOST_ m_parent #include "RichFutureUtils/RichMessaging.h" #define debug( ... ) \ - if ( m_parent ) { ri_debug( __VA_ARGS__ ); } + if ( messenger() ) { ri_debug( __VA_ARGS__ ); } #define verbo( ... ) \ - if ( m_parent ) { ri_verbo( __VA_ARGS__ ); } + if ( messenger() ) { ri_verbo( __VA_ARGS__ ); } using namespace Rich::Future::DAQ; diff --git a/Rich/RichFutureDAQ/src/lib/RichTel40CableMapping.cpp b/Rich/RichFutureDAQ/src/lib/RichTel40CableMapping.cpp index 0a901b9ffe38960a99dbfe118e93dad973fc1f3a..bc1409ba8eff35d81490868b2e35807a0faefd10 100644 --- a/Rich/RichFutureDAQ/src/lib/RichTel40CableMapping.cpp +++ b/Rich/RichFutureDAQ/src/lib/RichTel40CableMapping.cpp @@ -25,12 +25,11 @@ #include <limits> // Messaging -#define _RICH_MESSAGING_HOST_ m_parent #include "RichFutureUtils/RichMessaging.h" #define debug( ... ) \ - if ( m_parent ) { ri_debug( __VA_ARGS__ ); } + if ( messenger() ) { ri_debug( __VA_ARGS__ ); } #define verbo( ... ) \ - if ( m_parent ) { ri_verbo( __VA_ARGS__ ); } + if ( messenger() ) { ri_verbo( __VA_ARGS__ ); } using namespace Rich::Future::DAQ; diff --git a/Rich/RichFutureKernel/RichFutureKernel/RichCommonBase.h b/Rich/RichFutureKernel/RichFutureKernel/RichCommonBase.h index 4bbebc5c65439e7b1b9a3432c0c4123372b8210f..553b300feefa0fefd9c99d78a098f6fe129f3650 100644 --- a/Rich/RichFutureKernel/RichFutureKernel/RichCommonBase.h +++ b/Rich/RichFutureKernel/RichFutureKernel/RichCommonBase.h @@ -116,6 +116,10 @@ namespace Rich { return ( sc ? dynamic_cast<TOOL*>( tmp ) : nullptr ); } + protected: + /// Define the messenger entity + inline auto messenger() const noexcept { return this; } + protected: // definitions diff --git a/Rich/RichFutureUtils/RichFutureUtils/RichMessaging.h b/Rich/RichFutureUtils/RichFutureUtils/RichMessaging.h index 95e0451a49731d2803d92a0a080e934874221a8c..a6da738b7195a80244c432c36909370c45b5487c 100644 --- a/Rich/RichFutureUtils/RichFutureUtils/RichMessaging.h +++ b/Rich/RichFutureUtils/RichFutureUtils/RichMessaging.h @@ -27,22 +27,19 @@ namespace { } // namespace // Some defines for debug/verbose messages... -#ifndef _RICH_MESSAGING_HOST_ -# define _RICH_MESSAGING_HOST_ this -#endif +// Note macros below assume code using them defines the 'messenger()' method that returns a +// pointer to the entity that implements the Gaudi based messaging API. #ifndef _ri_debug # define _ri_debug \ - if ( _RICH_MESSAGING_HOST_->msgLevel( MSG::DEBUG ) ) _RICH_MESSAGING_HOST_->debug() + if ( messenger()->msgLevel( MSG::DEBUG ) ) messenger()->debug() #endif #ifndef _ri_verbo # define _ri_verbo \ - if ( _RICH_MESSAGING_HOST_->msgLevel( MSG::VERBOSE ) ) _RICH_MESSAGING_HOST_->verbose() + if ( messenger()->msgLevel( MSG::VERBOSE ) ) messenger()->verbose() #endif #ifndef ri_message # define ri_message( level, ... ) \ - if ( _RICH_MESSAGING_HOST_->msgLevel( level ) ) { \ - rich_message( _RICH_MESSAGING_HOST_->msgStream( level ), __VA_ARGS__ ); \ - } + if ( messenger()->msgLevel( level ) ) { rich_message( messenger()->msgStream( level ), __VA_ARGS__ ); } # define ri_debug( ... ) ri_message( MSG::DEBUG, __VA_ARGS__ ) # define ri_verbo( ... ) ri_message( MSG::VERBOSE, __VA_ARGS__ ) # ifndef NDEBUG