ATLAS Offline Software
Loading...
Searching...
No Matches
UserDatabase.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 POOLSVC_USERDATABASE_H
6#define POOLSVC_USERDATABASE_H
7
8#include "PoolSvc/IDatabase.h"
9#include "PoolSvc/ISession.h"
10#include "StorageSvc/DbPrint.h"
11#include "StorageSvc/pool.h"
12
13namespace Gaudi {
14 class IFileCatalog;
15}
16
17namespace pool {
18 // forward declarations
19 class UserSession;
20 class DatabaseHandler;
21 class DatabaseRegistry;
22
28 class UserDatabase : virtual public IDatabase,
29 public APRMessaging
30 {
31 public:
33 UserDatabase( UserSession& session,
34 const std::string& name,
35 const DatabaseSpecification::NameType nameType );
36
38 virtual ~UserDatabase();
39
41 virtual void connectForRead() override;
42
44 void* readObject( const Token& token, void* object = 0 );
45
47 virtual void connectForWrite() override;
48
50 Token* writeObject( const std::string& containerName,
51 long minorTechnology,
52 const void* object,
53 const RootType& type );
54
56 virtual void disconnect() override;
57
59 virtual Io::IoFlag openMode() const override;
60
62 virtual const std::string& fid() override;
63
65 virtual const std::string& pfn() override;
66
71 virtual bool setTechnology( long technology ) override;
72
74 virtual std::vector< std::string > containers() override;
75
77 virtual IContainer* containerHandle( const std::string& name ) override;
78
79 // expose FileDescriptor object for the technology specific DB implementation
80 virtual FileDescriptor* fileDescriptor() override final;
81
82 protected:
83 virtual
84 bool attributeOfType( const std::string& attributeName,
85 void* data,
86 const std::type_info& typeInfo,
87 const std::string& option ) override;
88
89 virtual
90 bool setAttributeOfType( const std::string& attributeName,
91 const void* data,
92 const std::type_info& typeInfo,
93 const std::string& option ) override;
94 private:
98 Gaudi::IFileCatalog& m_catalog;
104 std::string m_name;
114 Io::IoFlag m_openMode;
118 std::string m_the_fid;
119 std::string m_the_pfn;
120
122 bool checkInRegistry();
123 };
124}
125
126#endif
TTypeAdapter RootType
Definition RootType.h:211
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition Token.h:22
APRMessaging(const std::string &name)
DatabaseHandler is a class taking care of the micro-connections and the micro transactions for a give...
IContainer is the base class for container objects.
Definition IContainer.h:23
IDatabase is the base class for database objects.
Definition IDatabase.h:37
Token * writeObject(const std::string &containerName, long minorTechnology, const void *object, const RootType &type)
Writes an object and returns a token.
virtual const std::string & pfn() override
Returns the physical file name of this database.
UserDatabase(UserSession &session, const std::string &name, const DatabaseSpecification::NameType nameType)
Constructor.
std::string m_the_fid
Other names used.
Io::IoFlag m_transactionType
Transaction type (read/update).
std::string m_the_pfn
virtual FileDescriptor * fileDescriptor() override final
Expose FileDescriptor object for the technology specific DB implementation.
virtual void disconnect() override
Disconnects from the database.
std::string m_name
The database name.
virtual bool attributeOfType(const std::string &attributeName, void *data, const std::type_info &typeInfo, const std::string &option) override
The method returning the attribute data given a name.
virtual void connectForWrite() override
Connects explicitly to the database for write/update operations.
virtual bool setAttributeOfType(const std::string &attributeName, const void *data, const std::type_info &typeInfo, const std::string &option) override
The method setting the attribute data given a name.
DatabaseRegistry & m_registry
Reference to the database registry.
bool m_alreadyConnected
Flag indicating whether a connection has been already made once.
bool checkInRegistry()
Checks in the registry if the database handler already exists.
virtual std::vector< std::string > containers() override
Returns the names of the containers in this database.
Gaudi::IFileCatalog & m_catalog
Reference to the file catalog.
UserSession & m_session
Reference to the session.
DatabaseSpecification::NameType m_nameType
The database name spacification.
long m_technology
The technology identifier of the database.
virtual Io::IoFlag openMode() const override
Returns the opening mode. It can be used to check whether the database is connected.
virtual IContainer * containerHandle(const std::string &name) override
Returns a pointer to a container object. The user acquires ownership of that object.
void * readObject(const Token &token, void *object=0)
Reads an object given a token.
virtual ~UserDatabase()
Destructor.
virtual bool setTechnology(long technology) override
Sets the technology identifier for this database.
Io::IoFlag m_openMode
Current open mode.
virtual const std::string & fid() override
Returns the file identifier of this database.
bool m_technologySet
Checks if the technology identifier has been set.
virtual void connectForRead() override
Connects explicitly to the database for read operations.
DatabaseHandler * m_databaseHandler
The underlying database handler.
UserSession is an implementation of the ISession interface.
Definition UserSession.h:27
=============================================================================
Framework include files.
Definition libname.h:15
NameType
Enumeration type specifying the database name field, wherever the latter is used in methods accessing...
Definition IDatabase.h:24