diff --git a/GaudiAlg/GaudiAlg/GaudiCommon.h b/GaudiAlg/GaudiAlg/GaudiCommon.h index a6d136b4e9dd1df9217ce3c0408e4825f700dbbc..818db5f1c43d27d94c290bd03e1a086cf4e51dfa 100644 --- a/GaudiAlg/GaudiAlg/GaudiCommon.h +++ b/GaudiAlg/GaudiAlg/GaudiCommon.h @@ -302,8 +302,7 @@ public: * @return A pointer to the tool */ template <class TOOL> - TOOL* tool( std::string_view type, std::string_view name, const IInterface* parent = 0, - bool create = true ) const; + TOOL* tool( std::string_view type, std::string_view name, const IInterface* parent = 0, bool create = true ) const; /** A useful method for the easy location of tools. * * @code @@ -477,7 +476,7 @@ public: * @param sc StatusCode */ void Exception( std::string_view msg = "no message", - const StatusCode sc = StatusCode( StatusCode::FAILURE, true ) ) const; + const StatusCode sc = StatusCode( StatusCode::FAILURE, true ) ) const; private: /// accessor to all owned counters @@ -717,9 +716,9 @@ private: /// List of active services mutable Services m_services; // ========================================================================== - static auto increment(Counter& c, std::string_view which) { - auto i = c.find(which); - return i!=c.end() ? ++(i->second) : c.emplace(which,1).first->second; + static auto increment( Counter& c, std::string_view which ) { + auto i = c.find( which ); + return i != c.end() ? ++( i->second ) : c.emplace( which, 1 ).first->second; } /// Counter of errors mutable Counter m_errors; diff --git a/GaudiAlg/GaudiAlg/GaudiCommonImp.h b/GaudiAlg/GaudiAlg/GaudiCommonImp.h index 5a8cc66ee80babe9472bfcab8628eda683ed2635..91962690ef66818c15f5e7ce563768c14d6f38c9 100644 --- a/GaudiAlg/GaudiAlg/GaudiCommonImp.h +++ b/GaudiAlg/GaudiAlg/GaudiCommonImp.h @@ -45,9 +45,8 @@ GaudiCommon<PBASE>::get( IDataProviderSvc* service, std::string_view location, c // ============================================================================ template <class PBASE> template <class TYPE> -typename Gaudi::Utils::GetData<TYPE>::return_type GaudiCommon<PBASE>::getIfExists( IDataProviderSvc* service, - std::string_view location, - const bool useRootInTES ) const { +typename Gaudi::Utils::GetData<TYPE>::return_type +GaudiCommon<PBASE>::getIfExists( IDataProviderSvc* service, std::string_view location, const bool useRootInTES ) const { // check the environment Assert( service, "get():: IDataProvider* points to NULL!" ); // get the helper object: @@ -59,8 +58,7 @@ typename Gaudi::Utils::GetData<TYPE>::return_type GaudiCommon<PBASE>::getIfExist // ============================================================================ template <class PBASE> template <class TYPE> -bool GaudiCommon<PBASE>::exist( IDataProviderSvc* service, std::string_view location, - const bool useRootInTES ) const { +bool GaudiCommon<PBASE>::exist( IDataProviderSvc* service, std::string_view location, const bool useRootInTES ) const { // check the environment Assert( service, "exist():: IDataProvider* points to NULL!" ); // check the data object @@ -74,9 +72,8 @@ bool GaudiCommon<PBASE>::exist( IDataProviderSvc* service, std::string_view loca // ============================================================================ template <class PBASE> template <class TYPE, class TYPE2> -typename Gaudi::Utils::GetData<TYPE>::return_type GaudiCommon<PBASE>::getOrCreate( IDataProviderSvc* service, - std::string_view location, - const bool useRootInTES ) const { +typename Gaudi::Utils::GetData<TYPE>::return_type +GaudiCommon<PBASE>::getOrCreate( IDataProviderSvc* service, std::string_view location, const bool useRootInTES ) const { // check the environment Assert( service, "getOrCreate():: svc points to NULL!" ); // get the helper object @@ -96,8 +93,15 @@ TOOL* GaudiCommon<PBASE>::tool( std::string_view type, std::string_view name, co // get the tool from Tool Service TOOL* Tool = nullptr; const StatusCode sc = this->toolSvc()->retrieveTool( type, name, Tool, parent, create ); - if ( sc.isFailure() ) { Exception( std::string{"tool():: Could not retrieve Tool '"}.append( type ).append( "'/'").append( name ).append( "'" ), sc ); } - if ( !Tool ) { Exception( std::string{"tool():: Could not retrieve Tool '"}.append( type ).append( "'/'" ).append( name ).append( "'" ) ); } + if ( sc.isFailure() ) { + Exception( + std::string{"tool():: Could not retrieve Tool '"}.append( type ).append( "'/'" ).append( name ).append( "'" ), + sc ); + } + if ( !Tool ) { + Exception( + std::string{"tool():: Could not retrieve Tool '"}.append( type ).append( "'/'" ).append( name ).append( "'" ) ); + } // insert tool into list of tools PBASE::registerTool( Tool ); m_managedTools.push_back( Tool ); @@ -115,7 +119,9 @@ TOOL* GaudiCommon<PBASE>::tool( std::string_view type, const IInterface* parent, // retrieve the tool from Tool Service TOOL* Tool = nullptr; const StatusCode sc = this->toolSvc()->retrieveTool( type, Tool, parent, create ); - if ( sc.isFailure() ) { Exception( std::string{"tool():: Could not retrieve Tool '"}.append( type ).append( "'"), sc ); } + if ( sc.isFailure() ) { + Exception( std::string{"tool():: Could not retrieve Tool '"}.append( type ).append( "'" ), sc ); + } if ( !Tool ) { Exception( std::string{"tool():: Could not retrieve Tool '"}.append( type ).append( "'" ) ); } // add the tool into the list of known tools to be properly released PBASE::registerTool( Tool ); @@ -137,13 +143,17 @@ SmartIF<SERVICE> GaudiCommon<PBASE>::svc( std::string_view name, const bool crea // Try to get the requested interface s = *it; // check the results - if ( !s ) { Exception( std::string{"svc():: Could not retrieve Svc '"}.append( name ).append( "'" ), StatusCode::FAILURE ); } + if ( !s ) { + Exception( std::string{"svc():: Could not retrieve Svc '"}.append( name ).append( "'" ), StatusCode::FAILURE ); + } } else { auto baseSvc = this->svcLoc()->service( name, create ); // Try to get the requested interface s = baseSvc; // check the results - if ( !baseSvc || !s ) { Exception( std::string{"svc():: Could not retrieve Svc '"}.append(name).append( "'" ), StatusCode::FAILURE ); } + if ( !baseSvc || !s ) { + Exception( std::string{"svc():: Could not retrieve Svc '"}.append( name ).append( "'" ), StatusCode::FAILURE ); + } // add the tool into list of known tools, to be properly released addToServiceList( baseSvc ); } diff --git a/GaudiAlg/GaudiAlg/GetData.h b/GaudiAlg/GaudiAlg/GetData.h index 7feadf0bd4d8a0f9a212c97bc86f9c3091f98603..b3e6b32b9e99bd53ed2eea99c030f5cabdadfbc6 100644 --- a/GaudiAlg/GaudiAlg/GetData.h +++ b/GaudiAlg/GaudiAlg/GetData.h @@ -138,11 +138,11 @@ namespace Gaudi { */ template <class COMMON> return_type operator()( const COMMON& common, IDataProviderSvc* service, std::string_view location, - const bool checkData = true ) const { + const bool checkData = true ) const { // use Data Provider Service return_type obj = getFromTS<Type>( service, location ); if ( checkData ) { // check the data - common.Assert( obj, std::string{"get():: No valid data at '"}.append( location ).append( "'") ); + common.Assert( obj, std::string{"get():: No valid data at '"}.append( location ).append( "'" ) ); } // debug printout if ( common.msgLevel( MSG::DEBUG ) ) { @@ -176,7 +176,7 @@ namespace Gaudi { */ template <class COMMON> return_type operator()( const COMMON& common, IDataProviderSvc* service, std::string_view location, - const bool checkData = true ) const { + const bool checkData = true ) const { /// try to be efficient: /// 1. load object only once: DataObject* object = this->getData( service, std::string{location} ); @@ -202,10 +202,11 @@ namespace Gaudi { return make_range( cnt ); } // no valid data - if ( checkData ) common.Assert( false, std::string{"get():: No valid data at '"}.append( location ).append( "'") ); + if ( checkData ) + common.Assert( false, std::string{"get():: No valid data at '"}.append( location ).append( "'" ) ); } // no valid data - if ( checkData ) common.Assert( false, std::string{"get():: No data at '"}.append( location).append( "'" ) ); + if ( checkData ) common.Assert( false, std::string{"get():: No data at '"}.append( location ).append( "'" ) ); // the fictive return return return_type(); } @@ -228,7 +229,8 @@ namespace Gaudi { */ DataObject* getData( IDataProviderSvc* service, std::string location ) const { /// Try to be efficient - SmartDataObjectPtr getter( SmartDataObjectPtr::ObjectLoader::access(), service, nullptr, std::move(location) ); + SmartDataObjectPtr getter( SmartDataObjectPtr::ObjectLoader::access(), service, nullptr, + std::move( location ) ); return getter.accessData(); } // ====================================================================== @@ -263,7 +265,7 @@ namespace Gaudi { */ template <class COMMON> return_type operator()( const COMMON& common, IDataProviderSvc* service, std::string_view location, - const bool checkData = true ) const { + const bool checkData = true ) const { return return_type( m_range( common, service, location, checkData ), std::string{location} ); } // ====================================================================== @@ -290,7 +292,7 @@ namespace Gaudi { * @return the object for TES */ DataObject* getData( IDataProviderSvc* service, std::string location ) const { - return m_range.getData( service,std::move( location )); + return m_range.getData( service, std::move( location ) ); } // ====================================================================== private: @@ -349,8 +351,9 @@ namespace Gaudi { * @return true for valid data */ bool operator()( IDataProviderSvc* service, std::string location ) const { - DataObject* object = this->getData( service, std::move(location) ); - return object && ( dynamic_cast<typename TYPE::Selection*>( object ) || dynamic_cast<typename TYPE::Container*>( object ) ); + DataObject* object = this->getData( service, std::move( location ) ); + return object && ( dynamic_cast<typename TYPE::Selection*>( object ) || + dynamic_cast<typename TYPE::Container*>( object ) ); } // ====================================================================== protected: @@ -362,7 +365,8 @@ namespace Gaudi { */ DataObject* getData( IDataProviderSvc* service, std::string location ) const { /// Try to be efficient - SmartDataObjectPtr getter( SmartDataObjectPtr::ObjectLoader::access(), service, nullptr, std::move(location) ); + SmartDataObjectPtr getter( SmartDataObjectPtr::ObjectLoader::access(), service, nullptr, + std::move( location ) ); return getter.accessData(); } // ====================================================================== @@ -416,7 +420,7 @@ namespace Gaudi { */ template <class COMMON> return_type operator()( const COMMON& common, IDataProviderSvc* service, std::string_view location, - std::string_view location2 ) const { + std::string_view location2 ) const { SmartDataPtr<TYPE> obj( service, std::string{location} ); if ( !obj ) { auto o = std::make_unique<TYPE2>(); @@ -430,7 +434,7 @@ namespace Gaudi { } auto ret = obj.ptr(); /// check the data - common.Assert( !( !ret ), std::string{"get():: No valid data at '"}.append(location).append("\'") ); + common.Assert( !( !ret ), std::string{"get():: No valid data at '"}.append( location ).append( "\'" ) ); if ( common.msgLevel( MSG::DEBUG ) ) { common.debug() << "The object of type '" << System::typeinfoName( typeid( *ret ) ) << "' has been retrieved from TS at address '" << location << "'" << endmsg; @@ -467,7 +471,7 @@ namespace Gaudi { */ template <class COMMON> return_type operator()( const COMMON& common, IDataProviderSvc* service, std::string_view location, - std::string_view location2 ) const { + std::string_view location2 ) const { DataObject* obj = m_getter.getData( service, std::string{location} ); if ( !obj ) { common.put( service, std::make_unique<TYPE2>(), location2 ); diff --git a/GaudiAlg/src/components/TimingAuditor.cpp b/GaudiAlg/src/components/TimingAuditor.cpp index 2e8579f75aed452eac642b3ab71c3461a20d9abd..75563acc99103d705a4bb609fe28790e0fabfb6f 100644 --- a/GaudiAlg/src/components/TimingAuditor.cpp +++ b/GaudiAlg/src/components/TimingAuditor.cpp @@ -253,7 +253,7 @@ void TimingAuditor::before( CustomEventTypeRef evt, const std::string& name ) { // look for the user timer in the map int timer = 0; - std::string nick = std::string{name}.append( ":").append( evt ); + std::string nick = std::string{name}.append( ":" ).append( evt ); auto found = m_mapUser.find( nick ); if ( m_mapUser.end() == found ) { diff --git a/GaudiAlg/src/lib/GaudiCommon.icpp b/GaudiAlg/src/lib/GaudiCommon.icpp index 748f00cf418b6932de6ac63a73ab1211c71d8d3a..0e4fae1466b511c5ce8c3b7d204dda67428264be 100644 --- a/GaudiAlg/src/lib/GaudiCommon.icpp +++ b/GaudiAlg/src/lib/GaudiCommon.icpp @@ -295,13 +295,13 @@ void GaudiCommon<PBASE>::addToServiceList( SmartIF<IService> svc ) const { template <class PBASE> StatusCode GaudiCommon<PBASE>::Error( std::string_view msg, const StatusCode st, const size_t mx ) const { // increase local counter of errors - const size_t num = increment(m_errors,msg); + const size_t num = increment( m_errors, msg ); // If suppressed, just return if ( num > mx ) { return st; } else if ( UNLIKELY( num == mx ) ) // issue one-time suppression message { - return Print( std::string{"The ERROR message is suppressed : '"}.append(msg).append("'"), st, MSG::ERROR ); + return Print( std::string{"The ERROR message is suppressed : '"}.append( msg ).append( "'" ), st, MSG::ERROR ); } // return message return Print( msg, st, MSG::ERROR ); @@ -314,13 +314,13 @@ StatusCode GaudiCommon<PBASE>::Error( std::string_view msg, const StatusCode st, template <class PBASE> StatusCode GaudiCommon<PBASE>::Warning( std::string_view msg, const StatusCode st, const size_t mx ) const { // increase local counter of warnings - const size_t num = increment(m_warnings,msg); + const size_t num = increment( m_warnings, msg ); // If suppressed, just return if ( num > mx ) { return st; } else if ( UNLIKELY( num == mx ) ) // issue one-time suppression message { - return Print( std::string{"The WARNING message is suppressed : '"}.append( msg ).append( "'"), st, MSG::WARNING ); + return Print( std::string{"The WARNING message is suppressed : '"}.append( msg ).append( "'" ), st, MSG::WARNING ); } // return message return Print( msg, st, MSG::WARNING ); @@ -333,7 +333,7 @@ StatusCode GaudiCommon<PBASE>::Warning( std::string_view msg, const StatusCode s template <class PBASE> StatusCode GaudiCommon<PBASE>::Info( std::string_view msg, const StatusCode st, const size_t mx ) const { // increase local counter of warnings - const size_t num = increment(m_infos,msg); + const size_t num = increment( m_infos, msg ); // If suppressed, just return if ( num > mx ) { return st; @@ -383,9 +383,9 @@ StatusCode GaudiCommon<PBASE>::Print( std::string_view msg, const StatusCode st, template <class PBASE> void GaudiCommon<PBASE>::Exception( std::string_view msg, const GaudiException& exc, const StatusCode sc ) const { // increase local counter of exceptions - increment(m_exceptions,msg); + increment( m_exceptions, msg ); Print( std::string{"Exception (re)throw: "}.append( msg ), sc, MSG::FATAL ).ignore(); - throw GaudiException( (this->name() + ":: ").append( msg ), this->name(), sc, exc ); + throw GaudiException( ( this->name() + ":: " ).append( msg ), this->name(), sc, exc ); } // ============================================================================ @@ -395,9 +395,9 @@ void GaudiCommon<PBASE>::Exception( std::string_view msg, const GaudiException& template <class PBASE> void GaudiCommon<PBASE>::Exception( std::string_view msg, const std::exception& exc, const StatusCode sc ) const { // increase local counter of exceptions - increment(m_exceptions,msg); + increment( m_exceptions, msg ); Print( std::string{"Exception (re)throw: "}.append( msg ), sc, MSG::FATAL ).ignore(); - throw GaudiException( (this->name() + ":: ").append( msg ) + "(" + exc.what() + ")", "", sc ); + throw GaudiException( ( this->name() + ":: " ).append( msg ) + "(" + exc.what() + ")", "", sc ); } // ============================================================================ @@ -407,9 +407,9 @@ void GaudiCommon<PBASE>::Exception( std::string_view msg, const std::exception& template <class PBASE> void GaudiCommon<PBASE>::Exception( std::string_view msg, const StatusCode sc ) const { // increase local counter of exceptions - increment(m_exceptions,msg); + increment( m_exceptions, msg ); Print( std::string{"Exception throw: "}.append( msg ), sc, MSG::FATAL ).ignore(); - throw GaudiException( (this->name() + ":: ").append( msg), "", sc ); + throw GaudiException( ( this->name() + ":: " ).append( msg ), "", sc ); } // ============================================================================ diff --git a/GaudiAud/src/MemStatAuditor.cpp b/GaudiAud/src/MemStatAuditor.cpp index 03fdf2597ad506eb92668443d7686d46ae95df8c..a8f35d6adfe478c26bd9fd47cda51e9678666803 100644 --- a/GaudiAud/src/MemStatAuditor.cpp +++ b/GaudiAud/src/MemStatAuditor.cpp @@ -31,26 +31,22 @@ public: StatusCode initialize() override; - - void i_before( CustomEventTypeRef /*evt*/, std::string_view /*caller*/ ) override { // It's not interesting to monitor the memory usage before the methods. } -void i_after( CustomEventTypeRef evt, std::string_view caller, const StatusCode& ) override { - i_printinfo( "Memory usage has changed after", evt, caller ); -} - + void i_after( CustomEventTypeRef evt, std::string_view caller, const StatusCode& ) override { + i_printinfo( "Memory usage has changed after", evt, caller ); + } private: - void i_printinfo( std::string_view msg, CustomEventTypeRef evt, std::string_view caller ) ; - SmartIF<IChronoStatSvc> m_stat; + void i_printinfo( std::string_view msg, CustomEventTypeRef evt, std::string_view caller ); + SmartIF<IChronoStatSvc> m_stat; /// vsize of the previous call to printinfo double m_vSize = -1; }; - DECLARE_COMPONENT( MemStatAuditor ) StatusCode MemStatAuditor::initialize() { @@ -64,12 +60,11 @@ StatusCode MemStatAuditor::initialize() { } ); } - void MemStatAuditor::i_printinfo( std::string_view msg, CustomEventTypeRef evt, std::string_view caller ) { // cannot be exactly 0 double deltaVSize = 0.00001; - if (procInfo pInfo; ProcStats::instance()->fetch( pInfo )) { + if ( procInfo pInfo; ProcStats::instance()->fetch( pInfo ) ) { if ( pInfo.vsize > 0 ) { if ( m_vSize > 0 ) { deltaVSize = pInfo.vsize - m_vSize; } diff --git a/GaudiAud/src/MemoryAuditor.cpp b/GaudiAud/src/MemoryAuditor.cpp index 3881d76a056098655da61358d4921beca3c86c44..04c048da1bc77fce916efc6fe1f54bd80b1e91a6 100644 --- a/GaudiAud/src/MemoryAuditor.cpp +++ b/GaudiAud/src/MemoryAuditor.cpp @@ -11,10 +11,9 @@ // MemoryAuditor: // An auditor that monitors memory usage - #include "CommonAuditor.h" -#include "ProcStats.h" #include "GaudiKernel/MsgStream.h" +#include "ProcStats.h" /// Monitors the memory use of each algorithm /// @@ -33,10 +32,8 @@ protected: /// Report the memory usage. virtual void i_printinfo( std::string_view msg, CustomEventTypeRef evt, std::string_view caller ); - }; - DECLARE_COMPONENT( MemoryAuditor ) void MemoryAuditor::i_before( CustomEventTypeRef evt, std::string_view caller ) { @@ -50,7 +47,7 @@ void MemoryAuditor::i_after( CustomEventTypeRef evt, std::string_view caller, co void MemoryAuditor::i_printinfo( std::string_view msg, CustomEventTypeRef evt, std::string_view caller ) { /// Get the process informations. /// fetch true if it was possible to retrieve the informations. - if (procInfo pInfo; ProcStats::instance()->fetch( pInfo )) { + if ( procInfo pInfo; ProcStats::instance()->fetch( pInfo ) ) { info() << msg << " " << caller << " " << evt << " virtual size = " << pInfo.vsize << " MB" << " resident set size = " << pInfo.rss << " MB" << endmsg; } diff --git a/GaudiCommonSvc/src/AuditorSvc.cpp b/GaudiCommonSvc/src/AuditorSvc.cpp index d39852775bf28c47f24595474d2c4739a03d69c3..a4b25629aae758aa84a30deb9ab992ce2a886be2 100644 --- a/GaudiCommonSvc/src/AuditorSvc.cpp +++ b/GaudiCommonSvc/src/AuditorSvc.cpp @@ -50,8 +50,10 @@ SmartIF<IAuditor> AuditorSvc::newAuditor_( MsgStream& log, std::string_view name SmartIF<IAuditor> AuditorSvc::findAuditor_( std::string_view name ) { // find an auditor by name, return 0 on error - auto it = std::find_if( std::begin( m_pAudList ), std::end( m_pAudList ), - [item_name = Gaudi::Utils::TypeNameString( name ).name()]( const IAuditor* i ) { return i->name() == item_name; } ); + auto it = std::find_if( std::begin( m_pAudList ), std::end( m_pAudList ), + [item_name = Gaudi::Utils::TypeNameString( name ).name()]( const IAuditor* i ) { + return i->name() == item_name; + } ); return SmartIF<IAuditor>{it != std::end( m_pAudList ) ? *it : nullptr}; } diff --git a/GaudiCoreSvc/src/MessageSvc/MessageSvc.cpp b/GaudiCoreSvc/src/MessageSvc/MessageSvc.cpp index ae9c6f2fe025bf35668fe1f7df9cbf61f5378166..d9a50967732d52457b3891ce172e826c343454c5 100644 --- a/GaudiCoreSvc/src/MessageSvc/MessageSvc.cpp +++ b/GaudiCoreSvc/src/MessageSvc/MessageSvc.cpp @@ -474,7 +474,7 @@ void MessageSvc::i_reportMessage( const StatusCode& code, const std::string& sou // void MessageSvc::insertStream( int key, std::string name, std::ostream* stream ) { - m_streamMap.emplace( key, NamedStream( std::move(name), stream ) ); + m_streamMap.emplace( key, NamedStream( std::move( name ), stream ) ); } //############################################################################# @@ -596,11 +596,11 @@ void MessageSvc::setOutputLevel( int new_level ) { void MessageSvc::setOutputLevel( std::string_view source, int level ) { // --------------------------------------------------------------------------- std::unique_lock<std::recursive_mutex> lock( m_thresholdMapMutex ); - auto i = m_thresholdMap.find(source); - if (i!=m_thresholdMap.end()) { - i->second = level; + auto i = m_thresholdMap.find( source ); + if ( i != m_thresholdMap.end() ) { + i->second = level; } else { - m_thresholdMap.emplace( source, level); + m_thresholdMap.emplace( source, level ); } } diff --git a/GaudiCoreSvc/src/MessageSvc/MessageSvc.h b/GaudiCoreSvc/src/MessageSvc/MessageSvc.h index 72ebdc846fa4cf1dfb6bb9b870caa4f518c1f2e5..e3124fd2a77c08038b2e563d835424495631fa1c 100644 --- a/GaudiCoreSvc/src/MessageSvc/MessageSvc.h +++ b/GaudiCoreSvc/src/MessageSvc/MessageSvc.h @@ -39,10 +39,10 @@ class ISvcLocator; // class MessageSvc : public extends<Service, IMessageSvc, IInactiveMessageCounter> { public: - typedef std::pair<std::string, std::ostream*> NamedStream; - typedef std::multimap<int, NamedStream> StreamMap; - typedef std::multimap<StatusCode, Message> MessageMap; - typedef std::map<std::string, int,std::less<>> ThresholdMap; + typedef std::pair<std::string, std::ostream*> NamedStream; + typedef std::multimap<int, NamedStream> StreamMap; + typedef std::multimap<StatusCode, Message> MessageMap; + typedef std::map<std::string, int, std::less<>> ThresholdMap; // Default constructor. MessageSvc( const std::string& name, ISvcLocator* svcloc ); diff --git a/GaudiKernel/Gaudi/Algorithm.h b/GaudiKernel/Gaudi/Algorithm.h index b82377a19a95b318e3cb8c17ce28c17da9317ce8..d2948abd48c35a1956aba40e7989c62c45346a80 100644 --- a/GaudiKernel/Gaudi/Algorithm.h +++ b/GaudiKernel/Gaudi/Algorithm.h @@ -164,7 +164,7 @@ namespace Gaudi { /** The type of the algorithm object. */ const std::string& type() const override { return m_type; } - void setType( std::string type ) override { m_type = std::move(type); } // BH, TODO: move to proper place + void setType( std::string type ) override { m_type = std::move( type ); } // BH, TODO: move to proper place const std::string& version() const override; diff --git a/GaudiKernel/GaudiKernel/AlgTool.h b/GaudiKernel/GaudiKernel/AlgTool.h index 3463f5e23df8f5aa9efb3cfc26ab47e661cc0949..8bb331831bf6da46a16f63274ab95654fcff2df9 100644 --- a/GaudiKernel/GaudiKernel/AlgTool.h +++ b/GaudiKernel/GaudiKernel/AlgTool.h @@ -323,8 +323,7 @@ private: /** implementation of service method */ StatusCode service_i( std::string_view algName, bool createIf, const InterfaceID& iid, void** ppSvc ) const; - StatusCode service_i( std::string_view svcType, std::string_view svcName, const InterfaceID& iid, - void** ppS ) const; + StatusCode service_i( std::string_view svcType, std::string_view svcName, const InterfaceID& iid, void** ppS ) const; Gaudi::StateMachine::State m_state = Gaudi::StateMachine::CONFIGURED; ///< state of the Tool Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::CONFIGURED; ///< state of the Tool diff --git a/GaudiKernel/GaudiKernel/Algorithm.h b/GaudiKernel/GaudiKernel/Algorithm.h index 191668ad2a7303061ca47a06b113a25a5c665785..dc09d9c82ad422f75ec8416d820811fbfa90a555 100644 --- a/GaudiKernel/GaudiKernel/Algorithm.h +++ b/GaudiKernel/GaudiKernel/Algorithm.h @@ -18,9 +18,8 @@ namespace Gaudi { #pragma GCC diagnostic ignored "-Woverloaded-virtual" class LegacyAlgorithmAdapter : public Gaudi::Algorithm { public: - LegacyAlgorithmAdapter( std::string name, ISvcLocator* svcloc, - std::string version = PACKAGE_VERSION ) - : Gaudi::Algorithm( std::move(name), svcloc, std::move(version) ) { + LegacyAlgorithmAdapter( std::string name, ISvcLocator* svcloc, std::string version = PACKAGE_VERSION ) + : Gaudi::Algorithm( std::move( name ), svcloc, std::move( version ) ) { // default cardinality for non-reentrant algorithms setProperty( "Cardinality", 1 ); } diff --git a/GaudiKernel/GaudiKernel/DataHandle.h b/GaudiKernel/GaudiKernel/DataHandle.h index 9a7adde0e3c00fd4008d2d1291a0277119fe6d30..5190485f63d0c83e5df9335e21aaad249faac740 100644 --- a/GaudiKernel/GaudiKernel/DataHandle.h +++ b/GaudiKernel/GaudiKernel/DataHandle.h @@ -51,8 +51,8 @@ namespace Gaudi { virtual Mode mode() const { return m_mode; } - virtual void setKey( DataObjID key ) const { m_key = std::move(key); } - virtual void updateKey( std::string key ) const { m_key.updateKey( std::move(key) ); } + virtual void setKey( DataObjID key ) const { m_key = std::move( key ); } + virtual void updateKey( std::string key ) const { m_key.updateKey( std::move( key ) ); } virtual const std::string& objKey() const { return m_key.key(); } virtual const DataObjID& fullKey() const { return m_key; } diff --git a/GaudiKernel/GaudiKernel/DataObjID.h b/GaudiKernel/GaudiKernel/DataObjID.h index 8659a18a0cac5c830355f9008e54761f06b1b2b5..2e000166e17dd216c376c61cba870c8098961e88 100644 --- a/GaudiKernel/GaudiKernel/DataObjID.h +++ b/GaudiKernel/GaudiKernel/DataObjID.h @@ -87,21 +87,21 @@ private: static std::once_flag m_ip; }; -inline DataObjID::DataObjID( std::string key ) : m_key( std::move(key) ) { hashGen(); } +inline DataObjID::DataObjID( std::string key ) : m_key( std::move( key ) ) { hashGen(); } -inline DataObjID::DataObjID( const CLID& clid, std::string key ) : m_clid( clid ), m_key( std::move(key) ) { +inline DataObjID::DataObjID( const CLID& clid, std::string key ) : m_clid( clid ), m_key( std::move( key ) ) { setClassName(); hashGen(); } inline DataObjID::DataObjID( std::string className, std::string key ) - : m_key( std::move(key) ), m_className( std::move(className )) { + : m_key( std::move( key ) ), m_className( std::move( className ) ) { setClid(); hashGen(); } inline void DataObjID::updateKey( std::string key ) { - m_key = std::move(key); + m_key = std::move( key ); hashGen(); } diff --git a/GaudiKernel/GaudiKernel/GaudiHandle.h b/GaudiKernel/GaudiKernel/GaudiHandle.h index 3d692fd200e075146ed2ec07a66109c413f672bf..0572085335ff022a8dde29c3c28edee109df3f3a 100644 --- a/GaudiKernel/GaudiKernel/GaudiHandle.h +++ b/GaudiKernel/GaudiKernel/GaudiHandle.h @@ -75,10 +75,10 @@ public: protected: /** The component type */ - void setComponentType( std::string componentType ) { m_componentType = std::move(componentType); } + void setComponentType( std::string componentType ) { m_componentType = std::move( componentType ); } /** The name of the parent */ - void setParentName( std::string parent ) { m_parentName = std::move(parent); } + void setParentName( std::string parent ) { m_parentName = std::move( parent ); } private: // diff --git a/GaudiKernel/GaudiKernel/IAlgorithm.h b/GaudiKernel/GaudiKernel/IAlgorithm.h index 855aaf589494a4cb891f57b075558e4684b446f6..7961f503fd0ed1e886f5bcb1a62dddf2b4679ee3 100644 --- a/GaudiKernel/GaudiKernel/IAlgorithm.h +++ b/GaudiKernel/GaudiKernel/IAlgorithm.h @@ -48,7 +48,7 @@ public: /** The type of the algorithm */ - virtual const std::string& type() const = 0; + virtual const std::string& type() const = 0; virtual void setType( std::string ) = 0; /** StringKey rep of name diff --git a/GaudiKernel/GaudiKernel/NamedRange.h b/GaudiKernel/GaudiKernel/NamedRange.h index e0116c0b458f12a8aebc47fa572f557637d8f362..8c9bd74487ac1c976491a4c5cf601f8c42b222fe 100644 --- a/GaudiKernel/GaudiKernel/NamedRange.h +++ b/GaudiKernel/GaudiKernel/NamedRange.h @@ -96,16 +96,14 @@ namespace Gaudi { public: // ======================================================================== /// get a "slice" of a range, in Python style - NamedRange_ slice( long index1, long index2 ) const { - return NamedRange_( Base::slice( index1, index2 ), m_name ); - } + NamedRange_ slice( long index1, long index2 ) const { return NamedRange_( Base::slice( index1, index2 ), m_name ); } // ======================================================================== public: // ======================================================================== /// get the name of the range const std::string& name() const { return m_name; } /// set the name of the range - void setName( std::string value ) { m_name = std::move(value); } + void setName( std::string value ) { m_name = std::move( value ); } // ======================================================================== private: // ======================================================================== diff --git a/GaudiKernel/GaudiKernel/ServiceLocatorHelper.h b/GaudiKernel/GaudiKernel/ServiceLocatorHelper.h index 5974ba70295eee8d6b0a9b509bc7f27f533afe33..0e4825b102e8b830d9f6bf51c8eace99c24c07a8 100644 --- a/GaudiKernel/GaudiKernel/ServiceLocatorHelper.h +++ b/GaudiKernel/GaudiKernel/ServiceLocatorHelper.h @@ -33,19 +33,19 @@ public: m_requesterName( requester.name() ) {} ServiceLocatorHelper( ISvcLocator& svcLoc, std::string loggedName, std::string requesterName ) : m_svcLoc( svcLoc ) - , m_msgLog( SmartIF<IMessageSvc>( &svcLoc ), std::move(loggedName) ) + , m_msgLog( SmartIF<IMessageSvc>( &svcLoc ), std::move( loggedName ) ) , // use requester msg level - m_requesterName( std::move(requesterName) ) {} + m_requesterName( std::move( requesterName ) ) {} ServiceLocatorHelper( ISvcLocator& svcLoc, std::string requesterName ) : m_svcLoc( svcLoc ) , m_msgLog( SmartIF<IMessageSvc>( &svcLoc ), requesterName ) , // use requester msg level - m_requesterName( std::move(requesterName) ) {} + m_requesterName( std::move( requesterName ) ) {} #if !defined( GAUDI_V22_API ) || defined( G22_NEW_SVCLOCATOR ) - ServiceLocatorHelper( ISvcLocator& svcLoc, - const MsgStream& log, // use requester msg level - std::string requesterName ) - : m_svcLoc( svcLoc ), m_msgLog( log ), m_requesterName( std::move(requesterName) ) {} + ServiceLocatorHelper( ISvcLocator& svcLoc, + const MsgStream& log, // use requester msg level + std::string requesterName ) + : m_svcLoc( svcLoc ), m_msgLog( log ), m_requesterName( std::move( requesterName ) ) {} #endif StatusCode getService( std::string_view name, bool createIf, const InterfaceID& iid, void** ppSvc ) const { diff --git a/GaudiKernel/GaudiKernel/SmartDataPtr.h b/GaudiKernel/GaudiKernel/SmartDataPtr.h index 40a5e185ae61b99030e6083af2526c6b217068cc..6b322d8539eb323c09fe0ea0e0f18a530d4ff156 100644 --- a/GaudiKernel/GaudiKernel/SmartDataPtr.h +++ b/GaudiKernel/GaudiKernel/SmartDataPtr.h @@ -72,7 +72,7 @@ public: @param fullPath Full path leading to the data object. */ SmartDataPtr( IDataProviderSvc* pService, std::string fullPath ) - : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, nullptr, std::move(fullPath) ) {} + : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, nullptr, std::move( fullPath ) ) {} /** Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject instance @@ -97,7 +97,7 @@ public: @param path Path to the data object relative to the parent object. */ SmartDataPtr( IDataProviderSvc* pService, DataObject* pObject, std::string path ) - : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, nullptr, std::move(path) ) { + : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, nullptr, std::move( path ) ) { if ( pObject ) this->m_pRegistry = pObject->registry(); } @@ -123,7 +123,8 @@ public: @param path Path to the data object relative to the parent object. */ SmartDataPtr( SmartDataObjectPtr& refObject, std::string path ) - : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( refObject.service(), refObject.directory(), std::move(path) ) {} + : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( refObject.service(), refObject.directory(), + std::move( path ) ) {} /** Copy constructor: Construct an copy of a SmartDataPtr instance. @param copy Copy Smart Pointer to object. diff --git a/GaudiKernel/GaudiKernel/SmartDataStorePtr.h b/GaudiKernel/GaudiKernel/SmartDataStorePtr.h index 8a029507b3e678e6f29907da7784e2a727404074..35291ff7414f7f371007aa2663642b872dd0451d 100644 --- a/GaudiKernel/GaudiKernel/SmartDataStorePtr.h +++ b/GaudiKernel/GaudiKernel/SmartDataStorePtr.h @@ -63,7 +63,7 @@ public: @param pDirectory Pointer to the data directory entry. */ SmartDataStorePtr( IDataProviderSvc* pService, IRegistry* pRegistry, std::string path ) - : SmartDataObjectPtr( LOADER::access(), pService, pRegistry, std::move(path) ), m_pObject( nullptr ) {} + : SmartDataObjectPtr( LOADER::access(), pService, pRegistry, std::move( path ) ), m_pObject( nullptr ) {} /** Copy constructor: Construct an copy of a SmartDataStorePtr instance. @param copy Copy of Smart Pointer to object. */ diff --git a/GaudiKernel/src/Lib/Auditor.cpp b/GaudiKernel/src/Lib/Auditor.cpp index 7133fdab6c522f2478aac1e45d082b386b24fc3e..9a291615adf1c3ff0a27b7f45d7ef48303d73c74 100644 --- a/GaudiKernel/src/Lib/Auditor.cpp +++ b/GaudiKernel/src/Lib/Auditor.cpp @@ -19,7 +19,8 @@ #include "GaudiKernel/MsgStream.h" // Constructor -Auditor::Auditor( std::string name, ISvcLocator* pSvcLocator ) : m_name( std::move(name) ), m_pSvcLocator( pSvcLocator ) {} +Auditor::Auditor( std::string name, ISvcLocator* pSvcLocator ) + : m_name( std::move( name ) ), m_pSvcLocator( pSvcLocator ) {} // IAuditor implementation StatusCode Auditor::sysInitialize() { diff --git a/GaudiKernel/src/Lib/ChronoEntity.cpp b/GaudiKernel/src/Lib/ChronoEntity.cpp index 5fd135e4a5dc7c61cea271ba7dd384890a2d0027..6e14fb14516b91b3b17536e760723762e534ed59 100644 --- a/GaudiKernel/src/Lib/ChronoEntity.cpp +++ b/GaudiKernel/src/Lib/ChronoEntity.cpp @@ -115,15 +115,14 @@ std::string ChronoEntity::format( const double total, const double minimal, cons /// @todo: cache the format boost::format fmt( "Tot=%2$5.3g%1$s %4$43s #=%3$3lu" ); - static const auto tbl = {std::tuple{ 500, microsecond, " [us]" }, std::tuple{ 500, millisecond, " [ms]" }, - std::tuple{ 500, second, " [s]" }, std::tuple{ 500, minute, "[min]" }, - std::tuple{ 500, hour, " [h]" }, std::tuple{ 10, day, "[day]" }, - std::tuple{ 5, week, " [w]" }, std::tuple{ 20, month, "[mon]" }, - std::tuple{ -1, year, " [y]" }}; - - auto i = std::find_if( - begin( tbl ), std::prev( end( tbl ) ), - [&]( const std::tuple<int, double, const char*>& i ) { return total < std::get<0>( i ) * std::get<1>( i ); } ); + static const auto tbl = { + std::tuple{500, microsecond, " [us]"}, std::tuple{500, millisecond, " [ms]"}, std::tuple{500, second, " [s]"}, + std::tuple{500, minute, "[min]"}, std::tuple{500, hour, " [h]"}, std::tuple{10, day, "[day]"}, + std::tuple{5, week, " [w]"}, std::tuple{20, month, "[mon]"}, std::tuple{-1, year, " [y]"}}; + + auto i = std::find_if( begin( tbl ), std::prev( end( tbl ) ), [&]( const std::tuple<int, double, const char*>& i ) { + return total < std::get<0>( i ) * std::get<1>( i ); + } ); long double unit = std::get<1>( *i ); fmt % std::get<2>( *i ) % (double)( total / unit ) % number; @@ -172,8 +171,7 @@ ChronoEntity& ChronoEntity::operator+=( const ChronoEntity& e ) { * @see boost::format */ // ============================================================================ -std::string ChronoEntity::outputTime( IChronoSvc::ChronoType typ, std::string_view fmt, - System::TimeType unit ) const { +std::string ChronoEntity::outputTime( IChronoSvc::ChronoType typ, std::string_view fmt, System::TimeType unit ) const { boost::format _fmt( std::string{fmt} ); // allow various number of arguments using namespace boost::io; diff --git a/GaudiKernel/src/Lib/DataObjID.cpp b/GaudiKernel/src/Lib/DataObjID.cpp index c3c1ca86714a63a5ef4b153280ce5defba23e92f..c762e166ef35bf10f1a8ded6a3e5b815d395f799 100644 --- a/GaudiKernel/src/Lib/DataObjID.cpp +++ b/GaudiKernel/src/Lib/DataObjID.cpp @@ -19,7 +19,8 @@ namespace { std::string quote( std::string_view in ) { - if ( !in.empty() && in.front() == in.back() && ( in.front() == '\'' || in.front() == '\"' ) ) return std::string{in}; + if ( !in.empty() && in.front() == in.back() && ( in.front() == '\'' || in.front() == '\"' ) ) + return std::string{in}; std::stringstream s; s << std::quoted( in ); return s.str(); diff --git a/GaudiKernel/src/Lib/GaudiHandle.cpp b/GaudiKernel/src/Lib/GaudiHandle.cpp index 726c46c0147b874f82ca6805f3bbc0ca2c04be65..33442aca8cff76142c3a811bb0f181cdd3ee5c6c 100644 --- a/GaudiKernel/src/Lib/GaudiHandle.cpp +++ b/GaudiKernel/src/Lib/GaudiHandle.cpp @@ -45,7 +45,7 @@ std::string GaudiHandleBase::name() const { } } -void GaudiHandleBase::setName( std::string_view myName ) { m_typeAndName = type().append( "/" ).append( myName); } +void GaudiHandleBase::setName( std::string_view myName ) { m_typeAndName = type().append( "/" ).append( myName ); } std::string GaudiHandleBase::pythonPropertyClassName() const { return componentType() + "Handle"; } diff --git a/GaudiKernel/src/Lib/ServiceLocatorHelper.cpp b/GaudiKernel/src/Lib/ServiceLocatorHelper.cpp index 303856fa98c10005df003241effeb7d69dfe52e7..777eb75c35982e07cebc5969e0d7fc703629f87d 100644 --- a/GaudiKernel/src/Lib/ServiceLocatorHelper.cpp +++ b/GaudiKernel/src/Lib/ServiceLocatorHelper.cpp @@ -45,8 +45,7 @@ StatusCode ServiceLocatorHelper::createService( std::string_view type, std::stri return createService( std::string{type}.append( "/" ).append( name ), iid, ppSvc ); } -SmartIF<IService> ServiceLocatorHelper::service( std::string_view name, const bool quiet, - const bool createIf ) const { +SmartIF<IService> ServiceLocatorHelper::service( std::string_view name, const bool quiet, const bool createIf ) const { SmartIF<IService> theSvc = serviceLocator()->service( name, createIf ); if ( theSvc ) {