ATLAS Offline Software
Loading...
Searching...
No Matches
Database/AthenaPOOL/PoolSvc/src/Database.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_DATABASE_H
6#define POOLSVC_DATABASE_H
7
10#include "GaudiKernel/IFileMgr.h"
11
12namespace Gaudi {
13 class IFileCatalog;
14}
15namespace pool {
16 class FileDescriptor;
17}
18
19class SessionTool;
20class DatabaseHandler;
22class Container;
23class Token;
24
27class Database final : public AthMessaging
28{
29public:
39 };
40
42 Database( SessionTool& session,
43 const std::string& name,
44 const Specification::NameType nameType );
45
47 ~Database();
48
50 void connectForRead();
51
53 void* readObject( const Token& token, void* object = 0 );
54
56 void connectForWrite();
57
59 Token* writeObject( const std::string& containerName,
60 long minorTechnology,
61 const void* object,
62 const RootType& type );
63
65 void disconnect();
66
68 Io::IoFlag openMode() const;
69
71 const std::string& fid();
72
74 const std::string& pfn();
75
80 bool setTechnology( long technology );
81
83 std::vector< std::string > containers();
84
86 Container* containerHandle( const std::string& name );
87
88 // expose FileDescriptor object for the technology specific DB implementation
90
91 bool attributeOfType( const std::string& attributeName,
92 void* data,
93 const std::type_info& typeInfo,
94 const std::string& option );
95
96 bool setAttributeOfType( const std::string& attributeName,
97 const void* data,
98 const std::type_info& typeInfo,
99 const std::string& option );
100private:
104 Gaudi::IFileCatalog& m_catalog;
110 std::string m_name;
120 Io::IoFlag m_openMode;
124 std::string m_the_fid;
125 std::string m_the_pfn;
126
128 bool checkInRegistry();
129};
130
131#endif
TTypeAdapter RootType
Definition RootType.h:211
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
DatabaseHandler is a class taking care of the micro-connections and the micro transactions for a give...
Container * containerHandle(const std::string &name)
Returns a pointer to a container object. The user acquires ownership of that object.
Specification::NameType m_nameType
The database name spacification.
long m_technology
The technology identifier of the database.
Io::IoFlag m_openMode
Current open mode.
bool checkInRegistry()
Checks in the registry if the database handler already exists.
void disconnect()
Disconnects from the database.
Io::IoFlag openMode() const
Returns the opening mode. It can be used to check whether the database is connected.
void connectForRead()
Connects explicitly to the database for read operations.
bool setAttributeOfType(const std::string &attributeName, const void *data, const std::type_info &typeInfo, const std::string &option)
Database(SessionTool &session, const std::string &name, const Specification::NameType nameType)
Constructor.
const std::string & fid()
Returns the file identifier of this database.
const std::string & pfn()
Returns the physical file name of this database.
std::vector< std::string > containers()
Returns the names of the containers in this database.
std::string m_name
The database name.
bool setTechnology(long technology)
Sets the technology identifier for this database.
SessionTool & m_session
Reference to the session.
void connectForWrite()
Connects explicitly to the database for write/update operations.
DatabaseRegistry & m_registry
Reference to the database registry.
void * readObject(const Token &token, void *object=0)
Reads an object given a token.
std::string m_the_fid
Other names used.
bool attributeOfType(const std::string &attributeName, void *data, const std::type_info &typeInfo, const std::string &option)
DatabaseHandler * m_databaseHandler
The underlying database handler.
pool::FileDescriptor * fileDescriptor()
bool m_alreadyConnected
Flag indicating whether a connection has been already made once.
Token * writeObject(const std::string &containerName, long minorTechnology, const void *object, const RootType &type)
Writes an object and returns a token.
Io::IoFlag m_transactionType
Transaction type (read/update).
Gaudi::IFileCatalog & m_catalog
Reference to the file catalog.
bool m_technologySet
Checks if the technology identifier has been set.
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition Token.h:22
=============================================================================
Framework include files.
NameType
Enumeration type specifying the database name field, wherever the latter is used in methods accessing...