diff --git a/Database/APR/CollectionBase/CollectionBase/CollectionColumn.h b/Database/APR/CollectionBase/CollectionBase/CollectionColumn.h index c08e7502e9ecf2b251eb3422745a1811459ab7fd..9ceb344ab094b39186b9866a428fd52c41f96267 100755 --- a/Database/APR/CollectionBase/CollectionBase/CollectionColumn.h +++ b/Database/APR/CollectionBase/CollectionBase/CollectionColumn.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef COLLECTIONBASE_COLLECTIONCOLUMN_H @@ -44,7 +44,7 @@ namespace pool { */ CollectionColumn( const std::string& name, const std::string& type, - std::string fragmentName = "", + const std::string& fragmentName = "", int maxSize = 0, bool sizeIsFixed = true ) : m_name( name ), diff --git a/Database/APR/CollectionBase/CollectionBase/CollectionDescription.h b/Database/APR/CollectionBase/CollectionBase/CollectionDescription.h index 47ad8118aa8266e4fd45d09eca0c74568aefbae8..115a0a20b3cd3e75dd995c18e521c10d5ab706b6 100755 --- a/Database/APR/CollectionBase/CollectionBase/CollectionDescription.h +++ b/Database/APR/CollectionBase/CollectionBase/CollectionDescription.h @@ -47,8 +47,8 @@ namespace pool { */ CollectionDescription( const std::string& name, const std::string& type, - std::string connection = "", - std::string eventReferenceColumnName = "" ); + const std::string& connection = "", + const std::string& eventReferenceColumnName = "" ); /** * Copy constructor. diff --git a/Database/APR/CollectionBase/CollectionBase/CollectionFactory.h b/Database/APR/CollectionBase/CollectionBase/CollectionFactory.h index 3adbcc2f53d72a7c24fdc3a321413a04cb49da82..325812ff9a73b34dd5c5a8a9bb3be4e19934148e 100755 --- a/Database/APR/CollectionBase/CollectionBase/CollectionFactory.h +++ b/Database/APR/CollectionBase/CollectionBase/CollectionFactory.h @@ -211,7 +211,7 @@ namespace pool { * @param name Name of collection. * @param physicalName physical name of collection in catalog. */ - void extract( const std::string physicalName, + void extract( const std::string& physicalName, std::string& type, std::string& connection, std::string& name ) const; diff --git a/Database/APR/CollectionBase/CollectionBase/CollectionFragment.h b/Database/APR/CollectionBase/CollectionBase/CollectionFragment.h index c8e8de269d04f07fcc2d914ed6013f76fbd0cead..97d82867602a7c0e9d79e5d84a2c871f8993ec7e 100755 --- a/Database/APR/CollectionBase/CollectionBase/CollectionFragment.h +++ b/Database/APR/CollectionBase/CollectionBase/CollectionFragment.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef COLLECTIONBASE_COLLECTIONFRAGMENT_H @@ -38,7 +38,7 @@ namespace pool { * @param usesForeignKey Flag indicating whether fragment uses foreign key to reference parent fragment. */ CollectionFragment( const std::string& name, - std::string parentFragmentName = "", + const std::string& parentFragmentName = "", bool usesForeignKey = true ) : m_name( name ), m_parentFragmentName( parentFragmentName ), diff --git a/Database/APR/CollectionBase/src/CollectionDescription.cpp b/Database/APR/CollectionBase/src/CollectionDescription.cpp index b9e9902a8cf0c74626c949ced96b54ebbd5f7559..846898560a230fbf55f0265aab1843a89f230c14 100755 --- a/Database/APR/CollectionBase/src/CollectionDescription.cpp +++ b/Database/APR/CollectionBase/src/CollectionDescription.cpp @@ -20,8 +20,8 @@ using namespace std; pool::CollectionDescription::CollectionDescription( const std::string& name, const std::string& type, - std::string connection, - std::string eventReferenceColumnName ) + const std::string& connection, + const std::string& eventReferenceColumnName ) : m_name( name ), m_type( type ), m_connection( connection ), @@ -343,7 +343,7 @@ pool::CollectionDescription::setName( const std::string& name ) // rename frament in column map for( std::map< std::string, std::string >::iterator colI = m_fragmentNameForColumnName.begin(); colI != m_fragmentNameForColumnName.end(); - colI++ ) { + ++colI ) { if( colI->second == m_name ) { colI->second = name; // change the reference inside the column @@ -409,7 +409,7 @@ pool::CollectionDescription::setColumnId( pool::CollectionColumn *column, int id while( column_iter != m_columnIdForColumnName.end() ) { if( id < column_iter->second ) id = column_iter->second; - column_iter++; + ++column_iter; } id++; } @@ -869,8 +869,8 @@ pool::CollectionDescription::createIndex( std::string indexName, const std::vect // Generate unique name for index. if( !indexName.size() ) { indexName = fragmentName; - for( std::vector< std::string >::const_iterator iName = columnNames.begin(); iName != columnNames.end(); iName++ ) { - indexName += "_" + *iName; + for (const std::string& name : columnNames) { + indexName += "_" + name; } indexName += "_IDX"; } @@ -1023,9 +1023,9 @@ setUniqueConstraint( std::string constraintName, const std::vector< std::string if( !constraintName.size() ) { // Generate unique name for unique constraint. constraintName = fragmentName; - for ( std::vector< std::string >::const_iterator iName = columnNames.begin(); iName != columnNames.end(); iName++ ) + for (const std::string& name : columnNames) { - constraintName += "_" + *iName; + constraintName += "_" + name; } constraintName += "_UC"; } @@ -1109,7 +1109,7 @@ pool::CollectionDescription::unsetUniqueConstraint( const std::vector< std::stri delete *iConstraint; iConstraint = m_uniqueConstraints.erase( iConstraint ); for ( std::map< std::string, pool::CollectionColumn* >::iterator iColumn = columnForColumnName.begin(); - iColumn != columnForColumnName.end(); iColumn++ ) + iColumn != columnForColumnName.end(); ++iColumn ) { iColumn->second->setIsUnique( false ); } diff --git a/Database/APR/CollectionBase/src/CollectionFactory.cpp b/Database/APR/CollectionBase/src/CollectionFactory.cpp index 29de465160de9195c60d968731b9388e1aed5894..aaac3fb67a9ac93f6bdf00888f05d09f85c17854 100755 --- a/Database/APR/CollectionBase/src/CollectionFactory.cpp +++ b/Database/APR/CollectionBase/src/CollectionFactory.cpp @@ -466,7 +466,7 @@ pool::CollectionFactory::isUnique( const pool::FileCatalog::FileID& guid, void -pool::CollectionFactory::extract( const std::string physicalName, +pool::CollectionFactory::extract( const std::string& physicalName, std::string& type, std::string& connection, std::string& name ) const diff --git a/Database/APR/CollectionBase/src/TokenList.cpp b/Database/APR/CollectionBase/src/TokenList.cpp index 17b8cf9a4727140cda03d54931ba3247d4c6065a..d999fb19b186a5368e24e7a505fe677f1e2a4cb8 100755 --- a/Database/APR/CollectionBase/src/TokenList.cpp +++ b/Database/APR/CollectionBase/src/TokenList.cpp @@ -158,7 +158,7 @@ pool::TokenList::operator[]( unsigned int index ) const std::ostream& pool::TokenList::toOutputStream( std::ostream& os ) const { - for( size_t i = 0; i <= m_tokenVector.size(); ++i ) { + for( size_t i = 0; i < m_tokenVector.size(); ++i ) { os << "[" << m_tokenNames[i] << " (Token) : " << m_tokenVector[i]->toString()<< "]"; } diff --git a/Database/APR/FileCatalog/FileCatalog/IFileCatalog.h b/Database/APR/FileCatalog/FileCatalog/IFileCatalog.h index 80bf9bd3676e915ca10943076f14a9ed3304d806..7f2a97d2b7209b03de82703a7b0cc3beb59d08d5 100644 --- a/Database/APR/FileCatalog/FileCatalog/IFileCatalog.h +++ b/Database/APR/FileCatalog/FileCatalog/IFileCatalog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef APR_IFILECATALOG_H @@ -39,29 +39,29 @@ namespace pool { void connect() { /* not doing anything in Gaudi FC */ } void disconnect() { /* not doing anything in Gaudi FC */ } /// Get the connect string - const std::string& connectInfo() const { return _fc->connectInfo(); } + const std::string& connectInfo() const { return m_fc->connectInfo(); } /// redirect to init() for Gaudi FC void start() { init(); } /// Parse the DOM tree of the XML catalog - void init() { _fc->init(); } + void init() { m_fc->init(); } /// Save catalog to file - void commit() { _fc->commit(); } + void commit() { m_fc->commit(); } /// Save catalog to file - void rollback() { _fc->rollback(); } + void rollback() { m_fc->rollback(); } /// Check if the catalog is read-only - bool readOnly() const { return _fc->readOnly(); } + bool readOnly() const { return m_fc->readOnly(); } /// Check if the catalog should be updated - bool dirty() const { return _fc->dirty(); } + bool dirty() const { return m_fc->dirty(); } /// Get all FIDs - void getFIDs( Strings& fids ) const { _fc->getFID(fids); } + void getFIDs( Strings& fids ) const { m_fc->getFID(fids); } /// Get all logical names for a given FID. Return pairs <LFN,FID> - void getLFNs( const std::string& fid, Files& files ) const { _fc->getLFN(fid, files); } + void getLFNs( const std::string& fid, Files& files ) const { m_fc->getLFN(fid, files); } /// Dump all PFNames of the catalog and their attributes associate to the FileID - void getPFNs( const std::string& fid, Files& files ) const { _fc->getPFN(fid, files); } + void getPFNs( const std::string& fid, Files& files ) const { m_fc->getPFN(fid, files); } /// Get the first PFN + filetype for the given FID void getFirstPFN( const std::string& fid, std::string& pfn, std::string& tech ) const; @@ -70,32 +70,32 @@ namespace pool { void lookupFileByPFN( const std::string& pfn, std::string& fid, std::string& tech ) const; /// Return the status of a PFName - bool existsPFN( const std::string& pfn ) const { return _fc->existsPFN(pfn); } + bool existsPFN( const std::string& pfn ) const { return m_fc->existsPFN(pfn); } /// Lookup file identifier by physical file name - std::string lookupPFN( const std::string& pfn ) const { return _fc->lookupPFN(pfn); } + std::string lookupPFN( const std::string& pfn ) const { return m_fc->lookupPFN(pfn); } /// Return the status of a LFName // bool existsLFN( const std::string& lfn ) const = 0; /// Lookup file identified by logical file name void lookupFileByLFN( const std::string& lfn, std::string& fid ) const { fid = lookupLFN(lfn); } - std::string lookupLFN( const std::string& lfn ) const { return _fc->lookupLFN(lfn); } + std::string lookupLFN( const std::string& lfn ) const { return m_fc->lookupLFN(lfn); } /// Return the status of a FileID // bool existsFID( const std::string& fid ) const = 0; /// Delete FileID Node from the catalog - void deleteFID( const std::string& FileID ) { _fc->deleteFID(FileID); } + void deleteFID( const std::string& FileID ) { m_fc->deleteFID(FileID); } /// Delete PFN from the catalog (delete entire FID entry if it was the last PFN) - void deletePFN( const std::string& pfn ) { _fc->deletePFN(pfn); } + void deletePFN( const std::string& pfn ) { m_fc->deletePFN(pfn); } /// Register PFN, assign new FID if not given void registerPFN( const std::string& pfn, const std::string& ftype, std::string& fid ); /// Rename PFN - void renamePFN( const std::string& pfn, const std::string& newpfn ) { _fc->renamePFN(pfn, newpfn); } + void renamePFN( const std::string& pfn, const std::string& newpfn ) { m_fc->renamePFN(pfn, newpfn); } /// adding replica to an existing PFN void addReplicaPFN( const std::string& pfn, const std::string& replica_pfn ); @@ -107,7 +107,7 @@ namespace pool { /// Create a Node for a FileID and DOM Node of the LFN with all the attributes // NOTE! this method requires FID! (and not PFN) - void registerLFN( const std::string& fid, const std::string& lfn ) const { _fc->registerLFN(fid, lfn ); } + void registerLFN( const std::string& fid, const std::string& lfn ) const { m_fc->registerLFN(fid, lfn ); } // ------------------------- Catalog Manager interface @@ -117,28 +117,28 @@ namespace pool { void addCatalog( const std::string& connect ); /// Add new catalog identified by reference to the existing ones - //void addCatalog( Gaudi::IFileCatalog* cat ) { _mgr->addCatalog(cat); } + //void addCatalog( Gaudi::IFileCatalog* cat ) { m_mgr->addCatalog(cat); } /// Remove catalog identified by name from the existing ones. * or '' removes all - void removeCatalog( const std::string& connect ) { _mgr->removeCatalog(connect); } + void removeCatalog( const std::string& connect ) { m_mgr->removeCatalog(connect); } /// Remove catalog identified by reference from the existing ones - //void removeCatalog( const Gaudi::IFileCatalog* cat ) { _mgr->removeCatalog(cat); } + //void removeCatalog( const Gaudi::IFileCatalog* cat ) { m_mgr->removeCatalog(cat); } /// Access catalog container - Catalogs& catalogs() { return _mgr->catalogs(); } + Catalogs& catalogs() { return m_mgr->catalogs(); } /// Access catalog container (CONST) - const Catalogs& catalogs() const { return _mgr->catalogs(); } + const Catalogs& catalogs() const { return m_mgr->catalogs(); } /// Access to the (first) writable file catalog - //Gaudi::IFileCatalog* writeCatalog( const std::string& fid = "" ) const { return _mgr->writeCatalog(fid); } + //Gaudi::IFileCatalog* writeCatalog( const std::string& fid = "" ) const { return m_mgr->writeCatalog(fid); } /// Define the writable catalog identified by reference - //void setWriteCatalog( Gaudi::IFileCatalog* cat ) { _mgr->setWriteCatalog(cat); } + //void setWriteCatalog( Gaudi::IFileCatalog* cat ) { m_mgr->setWriteCatalog(cat); } /// Define the writable catalog identified by name void setWriteCatalog( const std::string& connect ); protected: - SmartIF<Gaudi::IFileCatalogMgr> _mgr; - SmartIF<Gaudi::IFileCatalog> _fc; + SmartIF<Gaudi::IFileCatalogMgr> m_mgr; + SmartIF<Gaudi::IFileCatalog> m_fc; }; } diff --git a/Database/APR/FileCatalog/src/CommandLine.cpp b/Database/APR/FileCatalog/src/CommandLine.cpp index 30db9d13cba729cfc0ae4ef959a966d52b43b5fc..770b71d14574e3434c0369047a3aca73e670952d 100755 --- a/Database/APR/FileCatalog/src/CommandLine.cpp +++ b/Database/APR/FileCatalog/src/CommandLine.cpp @@ -4,7 +4,7 @@ * CommandLine.cpp * Created by John F. Hubbard, on Sat Jul 29 2000, 19:01:05 PST * -* Copyright (c) 2000, ATD Azad Technology Development Corporation +* Copyright (c) 2000, 2020, ATD Azad Technology Development Corporation * * The Reliable Software Outsource Resource * You hire us, we do it for you, and we do it right. @@ -232,7 +232,7 @@ pool::CommandLine::DumpDiagnostics() const cout << endl << "Parameter name" << "\t\t\tValue" << endl; cout << "-------------------------------------" << endl; for(ARGMAPTYPE::const_iterator it = mArgMap.begin(); - it != mArgMap.end(); it++) + it != mArgMap.end(); ++it) { cout << it->first << ":\t\t\t\t" << it->second << endl; } diff --git a/Database/APR/FileCatalog/src/IFileCatalog.cpp b/Database/APR/FileCatalog/src/IFileCatalog.cpp index 3334819562f655f3a199abda9ba7687b271c5f3f..73678f259d9529d40e5e8604dc00b2619fe0de1a 100644 --- a/Database/APR/FileCatalog/src/IFileCatalog.cpp +++ b/Database/APR/FileCatalog/src/IFileCatalog.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "GaudiUtils/IFileCatalog.h" @@ -22,10 +22,10 @@ using namespace pool; pool::IFileCatalog::IFileCatalog() - : AthMessaging( Gaudi::svcLocator()->service<IMessageSvc>("MessageSvc").get(), "APRFileCatalog" ) + : AthMessaging( Gaudi::svcLocator()->service<IMessageSvc>("MessageSvc").get(), "APRFileCatalog" ), + m_mgr (Gaudi::svcLocator()->service<Gaudi::IFileCatalogMgr>( "Gaudi::MultiFileCatalog" )), + m_fc (m_mgr) { - _mgr = Gaudi::svcLocator()->service<Gaudi::IFileCatalogMgr>( "Gaudi::MultiFileCatalog" ); - _fc = _mgr; // set the output level of this service setLevel( SystemTools::GetOutputLvl() ); // set the output level of the XMLCatalog component - works only if the Gaudi AppMgr was initialized @@ -84,7 +84,7 @@ registerPFN( const std::string& pfn, const std::string& ftype, std::string& fid } if( fid.empty() ) fid = createFID(); ATH_MSG_DEBUG("Registering PFN=" << pfn << " of type=" << ftype << " GUID=" << fid); - _fc->registerPFN(fid, pfn, ftype); + m_fc->registerPFN(fid, pfn, ftype); } @@ -92,7 +92,7 @@ registerPFN( const std::string& pfn, const std::string& ftype, std::string& fid void pool::IFileCatalog:: addReplicaPFN( const std::string& pfn, const std::string& replica_pfn ) { - std::string fid = _fc->lookupPFN(pfn); + std::string fid = m_fc->lookupPFN(pfn); if( fid.empty() ) throw pool::Exception(std::string("PFN '") + pfn + "' not found", "addReplicaPFN", "FileCatalog"); // find the filetype for the PFN being replicated @@ -100,7 +100,7 @@ addReplicaPFN( const std::string& pfn, const std::string& replica_pfn ) getPFNs( fid, pfns ); for( const auto& pfns_entry: pfns ) { if( pfns_entry.first == pfn ) { - _fc->registerPFN(fid, replica_pfn, pfns_entry.second); + m_fc->registerPFN(fid, replica_pfn, pfns_entry.second); return; } } @@ -112,7 +112,7 @@ addReplicaFID( const std::string& fid, const std::string& replica_pfn, const std { if( fid.empty() ) throw pool::Exception(std::string("FID not specified"), "addReplicaFID", "FileCatalog"); - _fc->registerPFN(fid, replica_pfn, replica_tech); + m_fc->registerPFN(fid, replica_pfn, replica_tech); } @@ -124,7 +124,7 @@ void pool::IFileCatalog::addCatalog( const std::string& connect ) { URIParser p(connect); p.parse(); - Catalogs& cats = _mgr->catalogs(); + Catalogs& cats = m_mgr->catalogs(); auto i = std::find_if( cats.begin(), cats.end(), [&]( const Gaudi::IFileCatalog* f ) { return p.url() == f->connectInfo(); } ); @@ -136,7 +136,7 @@ void pool::IFileCatalog::addCatalog( const std::string& connect ) fullconnectstr = "xmlcatalog_" + connect; } ATH_MSG_DEBUG("addCatalog(\"" << fullconnectstr << "\")" ); - _mgr->addCatalog( fullconnectstr ); + m_mgr->addCatalog( fullconnectstr ); } } @@ -146,7 +146,7 @@ void pool::IFileCatalog::setWriteCatalog( const std::string& connect ) URIParser p(connect); p.parse(); addCatalog( connect ); - _mgr->setWriteCatalog( _mgr->findCatalog( p.url(), true ) ); + m_mgr->setWriteCatalog( m_mgr->findCatalog( p.url(), true ) ); }