ATLAS Offline Software
Loading...
Searching...
No Matches
DbSession.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//====================================================================
6// DbSession class definition
7//--------------------------------------------------------------------
8//
9// Package : StorageSvc (The POOL project)
10//
11// Description: Definition of a Database session and related classes
12//
13// @author M.Frank
14//====================================================================
15#ifndef POOL_DBSESSION_H
16#define POOL_DBSESSION_H
17
18// Framework include files
19#include <GaudiKernel/StatusCode.h>
21
22class StatusCode;
23
24/*
25 * POOL namespace declaration
26 */
27namespace pool {
28
29 // Forward declarations
30 class DbType;
31 class DbDomainObj;
32 class DbSessionObj;
33 class IOODatabase;
34
44 class DbSession : public DbHandleBase<DbSessionObj> {
46 friend class DbSessionObj;
47 private:
50 public:
54 DbSession(const DbSession& copy);
58 virtual ~DbSession();
61 if ( &copy != this ) {
62 switchPtr(copy.m_ptr);
63 }
64 return *this;
65 }
66
67 DbSession& operator=(const int /* null_obj */ ) {
68 switchPtr(0);
69 return *this;
70 }
71
72 // Move
74 {
75 setPtr (cp.m_ptr);
76 setType (cp.m_type);
77 cp.setPtr (nullptr);
78 cp.setType(DbType(0));
79 }
81 {
82 if (&cp != this) {
83 switchPtr (nullptr);
84 setPtr (cp.m_ptr);
85 setType (cp.m_type);
86 cp.setPtr (nullptr);
87 cp.setType(DbType(0));
88 }
89 return *this;
90 }
91
93 int refCount() const;
97 StatusCode add(DbDomainObj* dom);
99 StatusCode remove(const DbDomainObj* dom);
101 StatusCode open();
103 StatusCode close();
105 IOODatabase* db(const DbType& typ);
106 };
107} // End namespace pool
108#endif // POOL_DBSESSION_H
Db objects: DbDomainObj.
Definition DbDomainObj.h:40
void setPtr(DbSessionObj *ptr)
void setType(const DbType &typ)
const DbType & type() const
Db objects: DbSessionObj.
int refCount() const
Access reference counter.
StatusCode close()
Close the session.
StatusCode add(DbDomainObj *dom)
Add domain to session.
StatusCode open()
Open the session in a given mode.
DbSession()
Constructor.
DbDomainObj * find(const DbType &type)
Find domain object in session (by technology type)
void switchPtr(DbSessionObj *obj)
Assign transient object properly (including reference counting)
DbSession(DbSession &&cp)
Definition DbSession.h:73
DbSession & operator=(const DbSession &copy)
Assignment operator.
Definition DbSession.h:60
IOODatabase * db(const DbType &typ)
Allow access to the Database implementation.
DbSession & operator=(const int)
Assignment operator.
Definition DbSession.h:67
virtual ~DbSession()
Standard destructor.
friend class DbSessionObj
Friend declarations.
Definition DbSession.h:46
DbSession(const DbSession &copy)
Copy constructor.
StatusCode remove(const DbDomainObj *dom)
Find domain in session.
DbSession(DbSessionObj *session)
Object constructor.
pool namespace
Definition libname.h:15