ATLAS Offline Software
CollectionFactory.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef COLLECTIONBASE_COLLECTIONFACTORY_H
6 #define COLLECTIONBASE_COLLECTIONFACTORY_H
7 
12 
13 #include <string>
14 #include <vector>
15 
16 
17 namespace pool {
18 
19  class ICollectionDescription;
20  class ISession;
21  class ICollectionCursor;
22 
30  // not thread-safe due to constness violations wrt the catalog.
31  {
32  public:
35 
47  ICollection::OpenMode openMode,
48  ISession* session = 0 ) const;
49 
63  IFileCatalog* collectionCatalog,
64  bool overwrite = false,
65  std::string logicalName = "",
66  ISession* session = 0 ) const;
67 
82  IFileCatalog* collectionCatalog,
83  std::string logicalName = "",
84  ISession* session = 0 ) const;
85 
96  virtual bool registerExisting( ICollection* collection,
97  bool overwrite,
98  IFileCatalog* collectionCatalog,
99  std::string logicalName = "",
100  ISession* session = 0 ) const;
101 
111  virtual ICollection* openWithPhysicalName( const std::string& physicalName,
112  IFileCatalog* collectionCatalog,
114  ISession* session = 0 ) const;
115 
126  virtual ICollection* openWithLogicalName( const std::string& logicalName,
127  IFileCatalog* collectionCatalog,
128  bool readOnly = true,
129  ISession* session = 0 ) const;
130 
142  IFileCatalog* collectionCatalog,
143  bool readOnly = true,
144  ISession* session = 0 ) const;
145 
146 
147 
148  // resolve PHYSICAL_NAME, LOGICAL_NAME and GUID notation (using catalog)
149  virtual void resolveDescription( CollectionDescription& description, bool readOnly = true ) const;
150 
151  virtual CollectionDescription descFromPhysicalName( const std::string& physicalName,
152  IFileCatalog* collectionCatalog,
153  bool readOnly ) const;
154 
155  virtual CollectionDescription descFromLogicalName( const std::string& logicalName,
156  IFileCatalog* collectionCatalog,
157  bool readOnly ) const;
158 
160  IFileCatalog* collectionCatalog,
161  bool readOnly ) const;
162 
166 
168  void setWriteCatalog( const std::string &cat );
169 
174 
175  private:
178 
181 
184 
186  static const std::string c_fileType;
187 
195  IFileCatalog& collectionCatalog ) const;
196 
206  void extract( const std::string& physicalName,
207  std::string& type,
208  std::string& connection,
209  std::string& name ) const;
210 
211 
212 
214  ICollection::OpenMode openMode,
215  ISession* session = 0 ) const;
216 
217  protected:
218  mutable bool m_myOwnCatalog;
220 
221  };
222 
223 }
224 
225 #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.
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::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.
pool::ISession
Definition: ISession.h:31
pool::CollectionFactory::m_catalog
IFileCatalog * m_catalog
Definition: CollectionFactory.h:219
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:218
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:27
pool::CollectionDescription
Definition: CollectionDescription.h:29
pool::CollectionFactory
Definition: CollectionFactory.h:31
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
pool::CollectionFactory::s_instance
static CollectionFactory s_instance
Collection factory singleton.
Definition: CollectionFactory.h:183
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
pool::ICollection::READ
@ READ
Definition: ICollection.h:27
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
pool::ATLAS_NOT_THREAD_SAFE
DbStatus DbObjectHandle< T >::makeLink ATLAS_NOT_THREAD_SAFE(const Token *pToken, Token::OID_t &linkH) const
Add persistent association entry.
Definition: DbObject.h:220
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:24
pool::CollectionFactory::c_fileType
static const std::string c_fileType
Definition of file catalog entry type for collections registered in catalog.
Definition: CollectionFactory.h:186
pool::ICollectionDescription
Definition: ICollectionDescription.h:26
description
std::string description
glabal timer - how long have I taken so far?
Definition: hcg.cxx:88