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// $Id: DbSession.h 726071 2016-02-25 09:23:05Z krasznaa $
6//====================================================================
7// DbSession class definition
8//--------------------------------------------------------------------
9//
10// Package : StorageSvc (The POOL project)
11//
12// Description: Definition of a Database session and related classes
13//
14// @author M.Frank
15//====================================================================
16#ifndef POOL_DBSESSION_H
17#define POOL_DBSESSION_H
18
19// Framework include files
20#include "StorageSvc/DbStatus.h"
22
23/*
24 * POOL namespace declaration
25 */
26namespace pool {
27
28 // Forward declarations
29 class DbType;
30 class DbDomainObj;
31 class DbSessionObj;
32 class IOODatabase;
33
43 class DbSession : public DbHandleBase<DbSessionObj> {
45 friend class DbSessionObj;
46 private:
49 public:
53 DbSession(const DbSession& copy);
57 virtual ~DbSession();
60 if ( &copy != this ) {
61 switchPtr(copy.m_ptr);
62 }
63 return *this;
64 }
65
66 DbSession& operator=(const int /* null_obj */ ) {
67 switchPtr(0);
68 return *this;
69 }
70
71 // Move
73 {
74 setPtr (cp.m_ptr);
75 setType (cp.m_type);
76 cp.setPtr (nullptr);
77 cp.setType(DbType(0));
78 }
80 {
81 if (&cp != this) {
82 switchPtr (nullptr);
83 setPtr (cp.m_ptr);
84 setType (cp.m_type);
85 cp.setPtr (nullptr);
86 cp.setType(DbType(0));
87 }
88 return *this;
89 }
90
92 int refCount() const;
104 IOODatabase* db(const DbType& typ);
105 };
106} // End namespace pool
107#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.
DbStatus remove(const DbDomainObj *dom)
Find domain in session.
int refCount() const
Access reference counter.
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)
DbStatus close()
Close the session.
DbSession(DbSession &&cp)
Definition DbSession.h:72
DbSession & operator=(const DbSession &copy)
Assignment operator.
Definition DbSession.h:59
IOODatabase * db(const DbType &typ)
Allow access to the Database implementation.
DbSession & operator=(const int)
Assignment operator.
Definition DbSession.h:66
virtual ~DbSession()
Standard destructor.
friend class DbSessionObj
Friend declarations.
Definition DbSession.h:45
DbSession(const DbSession &copy)
Copy constructor.
DbSession(DbSessionObj *session)
Object constructor.
DbStatus add(DbDomainObj *dom)
Add domain to session.
DbStatus open()
Open the session in a given mode.
This class is highly inspired by the error code distribution system as it is used in DEC/VMS or MS/WN...
Definition DbStatus.h:64
pool namespace
Definition libname.h:15