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 pool {
14 // forward declarations
15 class IFileCatalog;
16
17 // forward declarations
18 class UserSession;
19 class DatabaseHandler;
20 class DatabaseRegistry;
21
27 class UserDatabase : virtual public IDatabase,
28 public APRMessaging
29 {
30 public:
32 UserDatabase( UserSession& session,
33 const std::string& name,
34 const DatabaseSpecification::NameType nameType );
35
37 virtual ~UserDatabase();
38
40 virtual void connectForRead() override;
41
43 void* readObject( const Token& token, void* object = 0 );
44
46 virtual void connectForWrite() override;
47
49 Token* writeObject( const std::string& containerName,
50 long minorTechnology,
51 const void* object,
52 const RootType& type );
53
55 virtual void disconnect() override;
56
58 virtual Io::IoFlag openMode() const override;
59
61 virtual const std::string& fid() override;
62
64 virtual const std::string& pfn() override;
65
70 virtual bool setTechnology( long technology ) override;
71
73 virtual std::vector< std::string > containers() override;
74
76 virtual IContainer* containerHandle( const std::string& name ) override;
77
78 // expose FileDescriptor object for the technology specific DB implementation
79 virtual FileDescriptor* fileDescriptor() override final;
80
81 protected:
82 virtual
83 bool attributeOfType( const std::string& attributeName,
84 void* data,
85 const std::type_info& typeInfo,
86 const std::string& option ) override;
87
88 virtual
89 bool setAttributeOfType( const std::string& attributeName,
90 const void* data,
91 const std::type_info& typeInfo,
92 const std::string& option ) override;
93 private:
103 std::string m_name;
113 Io::IoFlag m_openMode;
117 std::string m_the_fid;
118 std::string m_the_pfn;
119
121 bool checkInRegistry();
122 };
123}
124
125#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.
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