ATLAS Offline Software
Loading...
Searching...
No Matches
IFileCatalog.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef APR_IFILECATALOG_H
6#define APR_IFILECATALOG_H
7
8#include "GaudiUtils/IFileCatalog.h"
9#include "GaudiUtils/IFileCatalogMgr.h"
10#include "GaudiKernel/SmartIF.h"
11
13
14namespace pool {
15
16 namespace FileCatalog {
17 typedef std::string FileID;
18 }
19
20 class IFileCatalog : public AthMessaging {
21 public:
22
23 typedef Gaudi::IFileCatalog::Files Files;
24 typedef Gaudi::IFileCatalog::Strings Strings;
25 typedef Gaudi::IFileCatalogMgr::Catalogs Catalogs;
26
27
30
31 // ------------------------------ Catalog interface
33 const std::string& connectInfo() const { return m_fc->connectInfo(); }
34
36 void start() { init(); }
38 void init() { m_fc->init(); }
40 void commit() { m_fc->commit(); }
42 void rollback() { m_fc->rollback(); }
44 bool readOnly() const { return m_fc->readOnly(); }
46 bool dirty() const { return m_fc->dirty(); }
47
49 void getFIDs( Strings& fids ) const { m_fc->getFID(fids); }
50
52 void getLFNs( const std::string& fid, Files& files ) const { m_fc->getLFN(fid, files); }
53
55 void getPFNs( const std::string& fid, Files& files ) const { m_fc->getPFN(fid, files); }
56
58 void getFirstPFN( const std::string& fid, std::string& pfn, std::string& tech ) const;
59
61 void lookupFileByPFN( const std::string& pfn, std::string& fid, std::string& tech ) const;
62
64 bool existsPFN( const std::string& pfn ) const { return m_fc->existsPFN(pfn); }
65
67 std::string lookupPFN( const std::string& pfn ) const { return m_fc->lookupPFN(pfn); }
68
70 void lookupFileByLFN( const std::string& lfn, std::string& fid ) const { fid = lookupLFN(lfn); }
71 std::string lookupLFN( const std::string& lfn ) const { return m_fc->lookupLFN(lfn); }
72
74 void deleteFID( const std::string& FileID ) { m_fc->deleteFID(FileID); }
75
77 void deletePFN( const std::string& pfn ) { m_fc->deletePFN(pfn); }
78
80 void registerPFN( const std::string& pfn, const std::string& ftype, std::string& fid );
81
83 void renamePFN( const std::string& pfn, const std::string& newpfn ) { m_fc->renamePFN(pfn, newpfn); }
84
86 // NOTE! this method requires FID! (and not PFN)
87 void registerLFN( const std::string& fid, const std::string& lfn ) const { m_fc->registerLFN(fid, lfn ); }
88
89
90 // ------------------------- Catalog Manager interface
91
93 void addReadCatalog( const std::string& connect ) { addCatalog(connect, false); }
94 void addCatalog( const std::string& connect, bool forWriting = false );
96 void setWriteCatalog( const std::string& connect ) { addCatalog(connect, true); }
97
99 void removeCatalog( const std::string& connect ) { m_mgr->removeCatalog(connect); }
100
102 Catalogs& catalogs() { return m_mgr->catalogs(); }
104 const Catalogs& catalogs() const { return m_mgr->catalogs(); }
105
106 protected:
107 SmartIF<Gaudi::IFileCatalogMgr> m_mgr;
108 SmartIF<Gaudi::IFileCatalog> m_fc;
109 };
110
111}
112
113#endif
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
void start()
redirect to init() for Gaudi FC
void commit()
Save catalog to file.
void addReadCatalog(const std::string &connect)
Add new catalog, identified by name, to the existing ones.
void addCatalog(const std::string &connect, bool forWriting=false)
void getPFNs(const std::string &fid, Files &files) const
Dump all PFNames of the catalog and their attributes associate to the FileID.
void lookupFileByPFN(const std::string &pfn, std::string &fid, std::string &tech) const
Get FID and filetype for a given PFN.
void deletePFN(const std::string &pfn)
Delete PFN from the catalog (delete entire FID entry if it was the last PFN)
void getFIDs(Strings &fids) const
Get all FIDs.
SmartIF< Gaudi::IFileCatalog > m_fc
bool existsPFN(const std::string &pfn) const
Return the status of a PFName.
void getFirstPFN(const std::string &fid, std::string &pfn, std::string &tech) const
Get the first PFN + filetype for the given FID.
SmartIF< Gaudi::IFileCatalogMgr > m_mgr
Gaudi::IFileCatalog::Strings Strings
Gaudi::IFileCatalog::Files Files
void registerLFN(const std::string &fid, const std::string &lfn) const
Create a Node for a FileID and DOM Node of the LFN with all the attributes.
Gaudi::IFileCatalogMgr::Catalogs Catalogs
void removeCatalog(const std::string &connect)
Remove catalog identified by name from the existing ones. * or '' removes all.
void init()
Parse the DOM tree of the XML catalog.
Catalogs & catalogs()
Access catalog container.
void rollback()
Save catalog to file.
void renamePFN(const std::string &pfn, const std::string &newpfn)
Rename PFN.
const std::string & connectInfo() const
Get the connect string.
void registerPFN(const std::string &pfn, const std::string &ftype, std::string &fid)
Register PFN, assign new FID if not given.
void setWriteCatalog(const std::string &connect)
Establish the writable catalog, identified by name.
std::string lookupLFN(const std::string &lfn) const
void getLFNs(const std::string &fid, Files &files) const
Get all logical names for a given FID. Return pairs <LFN,FID>
bool readOnly() const
Check if the catalog is read-only.
const Catalogs & catalogs() const
Access catalog container (CONST)
bool dirty() const
Check if the catalog should be updated.
std::string lookupPFN(const std::string &pfn) const
Lookup file identifier by physical file name.
void lookupFileByLFN(const std::string &lfn, std::string &fid) const
Lookup file identified by logical file name.
void deleteFID(const std::string &FileID)
Delete FileID Node from the catalog.
std::vector< std::string > files
file names and file pointers
Definition hcg.cxx:50
std::string FileID
pool namespace
Definition libname.h:15
std::string FileID