ATLAS Offline Software
CollectionFactory.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef COLLECTIONBASE_COLLECTIONFACTORY_H
6 #define COLLECTIONBASE_COLLECTIONFACTORY_H
7 
11 #include "POOLCore/DbPrint.h"
13 
14 #include <string>
15 #include <vector>
16 
17 
18 namespace pool {
19 
20  class ICollectionDescription;
21  class ISession;
22  class ICollectionCursor;
23 
31  // not thread-safe due to constness violations wrt the catalog.
32  {
33  public:
36 
48  ICollection::OpenMode openMode,
49  ISession* session = 0 ) const;
50 
64  IFileCatalog* collectionCatalog,
65  bool overwrite = false,
66  std::string logicalName = "",
67  ISession* session = 0 ) const;
68 
83  IFileCatalog* collectionCatalog,
84  std::string logicalName = "",
85  ISession* session = 0 ) const;
86 
97  virtual bool registerExisting( ICollection* collection,
98  bool overwrite,
99  IFileCatalog* collectionCatalog,
100  std::string logicalName = "",
101  ISession* session = 0 ) const;
102 
112  virtual ICollection* openWithPhysicalName( const std::string& physicalName,
113  IFileCatalog* collectionCatalog,
115  ISession* session = 0 ) const;
116 
127  virtual ICollection* openWithLogicalName( const std::string& logicalName,
128  IFileCatalog* collectionCatalog,
129  bool readOnly = true,
130  ISession* session = 0 ) const;
131 
143  IFileCatalog* collectionCatalog,
144  bool readOnly = true,
145  ISession* session = 0 ) const;
146 
147 
148 
149  // resolve PHYSICAL_NAME, LOGICAL_NAME and GUID notation (using catalog)
150  virtual void resolveDescription( CollectionDescription& description, bool readOnly = true ) const;
151 
152  virtual CollectionDescription descFromPhysicalName( const std::string& physicalName,
153  IFileCatalog* collectionCatalog,
154  bool readOnly ) const;
155 
156  virtual CollectionDescription descFromLogicalName( const std::string& logicalName,
157  IFileCatalog* collectionCatalog,
158  bool readOnly ) const;
159 
161  IFileCatalog* collectionCatalog,
162  bool readOnly ) const;
163 
167 
169  void setWriteCatalog( const std::string &cat );
170 
175 
176  private:
179 
182 
184  static const std::string c_fileType;
185 
193  IFileCatalog& collectionCatalog ) const;
194 
204  void extract( const std::string& physicalName,
205  std::string& type,
206  std::string& connection,
207  std::string& name ) const;
208 
209 
210 
212  ICollection::OpenMode openMode,
213  ISession* session = 0 ) const;
214 
215  protected:
216  mutable bool m_myOwnCatalog;
218 
219  };
220 
221 }
222 
223 #endif
pool::CollectionFactory::~CollectionFactory
virtual ~CollectionFactory()
Default destructor.
pool::CollectionFactory::isUnique
bool isUnique(const FileCatalog::FileID &guid, IFileCatalog &collectionCatalog) const
Indicates whether the GUID of a collection is unique in a collection catalog.
pool::CollectionFactory::get
static CollectionFactory * get()
Retrieves the collection factory singleton.
pool::CollectionFactory::create
virtual ICollection * create(const ICollectionDescription &description, ICollection::OpenMode openMode, ISession *session=0) const
Creates an instance of a collection or collection fragment, given its storage technology type.
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition: checker_macros.h:212
CollectionDescription.h
pool::FileCatalog::FileID
std::string FileID
Definition: IFileCatalog.h:20
pool
pool namespace
Definition: libname.h:15
IFileCatalog.h
pool::CollectionFactory::setWriteCatalog
void setWriteCatalog(const std::string &cat)
set write catalog (once it is set, it can only be changed by resetting)
pool::CollectionFactory::extract
void extract(const std::string &physicalName, std::string &type, std::string &connection, std::string &name) const
Extracts the collection storage technology type and database connection string and name from the phys...
pool::CollectionFactory::getDefaultCatalog
IFileCatalog * getDefaultCatalog() const
get the default file catalog if there was no file catalog, new one will be created according to envir...
pool::CollectionFactory::createAndRegister
virtual ICollection * createAndRegister(const ICollectionDescription &description, IFileCatalog *collectionCatalog, bool overwrite=false, std::string logicalName="", ISession *session=0) const
Creates or overwrites a collection given a description of its properties, and registers it in a colle...
pool::CollectionFactory::openWithGuid
virtual ICollection * openWithGuid(const FileCatalog::FileID &guid, IFileCatalog *collectionCatalog, bool readOnly=true, ISession *session=0) const
Opens an existing collection for read or update transactions, given the globally unique identifier us...
pool::CollectionFactory::descFromLogicalName
virtual CollectionDescription descFromLogicalName(const std::string &logicalName, IFileCatalog *collectionCatalog, bool readOnly) const
pool::CollectionFactory::registerExisting
virtual bool registerExisting(const ICollectionDescription &description, IFileCatalog *collectionCatalog, std::string logicalName="", ISession *session=0) const
Registers an existing collection in a collection catalog, given a specification of its properties.
pool::CollectionFactory::descFromPhysicalName
virtual CollectionDescription descFromPhysicalName(const std::string &physicalName, IFileCatalog *collectionCatalog, bool readOnly) const
pool::APRMessaging
AthMessaging wrapper to set the output level in APR components.
Definition: DbPrint.h:51
pool::CollectionFactory::openWithPhysicalName
virtual ICollection * openWithPhysicalName(const std::string &physicalName, IFileCatalog *collectionCatalog, ICollection::OpenMode openMode=pool::ICollection::READ, ISession *session=0) const
Opens an existing collection for read or update transactions, given its physical name.
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
pool::ISession
Definition: ISession.h:32
pool::CollectionFactory::m_catalog
IFileCatalog * m_catalog
Definition: CollectionFactory.h:217
pool::CollectionFactory::registerExisting
virtual bool registerExisting(ICollection *collection, bool overwrite, IFileCatalog *collectionCatalog, std::string logicalName="", ISession *session=0) const
Registers an existing collection in a collection catalog, but uses user-supplied exiting collection o...
pool::CollectionFactory::m_myOwnCatalog
bool m_myOwnCatalog
Definition: CollectionFactory.h:216
DbPrint.h
pool::IFileCatalog
Definition: IFileCatalog.h:23
pool::CollectionFactory::create_callPlugin
ICollection * create_callPlugin(const ICollectionDescription &description, ICollection::OpenMode openMode, ISession *session=0) const
pool::ICollection::OpenMode
OpenMode
Enumeration of the possible open modes of the collection.
Definition: ICollection.h:26
pool::CollectionDescription
Definition: CollectionDescription.h:26
pool::CollectionFactory
Definition: CollectionFactory.h:32
ICollection.h
pool::CollectionFactory::descFromGuid
virtual CollectionDescription descFromGuid(const FileCatalog::FileID &guid, IFileCatalog *collectionCatalog, bool readOnly) const
pool::CollectionFactory::openWithLogicalName
virtual ICollection * openWithLogicalName(const std::string &logicalName, IFileCatalog *collectionCatalog, bool readOnly=true, ISession *session=0) const
Opens an existing collection for read or update transactions, given a logical name assigned to it in ...
pool_uuid.guid
guid
Definition: pool_uuid.py:112
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
pool::ICollection::READ
@ READ
Definition: ICollection.h:26
pool::CollectionFactory::setDefaultCatalog
void setDefaultCatalog(pool::IFileCatalog *catalog)
set external file catalog (it will not be deleted) pass 0 to reset the existing file catalog
pool::CollectionFactory::CollectionFactory
CollectionFactory()
Default constructor.
pool::CollectionFactory::resolveDescription
virtual void resolveDescription(CollectionDescription &description, bool readOnly=true) const
checker_macros.h
Define macros for attributes used to control the static checker.
pool::ICollection
Definition: ICollection.h:23
pool::CollectionFactory::c_fileType
static const std::string c_fileType
Definition of file catalog entry type for collections registered in catalog.
Definition: CollectionFactory.h:184
pool::ICollectionDescription
Definition: ICollectionDescription.h:25
description
std::string description
glabal timer - how long have I taken so far?
Definition: hcg.cxx:88