ATLAS Offline Software
Loading...
Searching...
No Matches
DbConnection.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 STORAGESVC_DBCONNECTION_H
6#define STORAGESVC_DBCONNECTION_H
7
8#include <string>
9
10/*
11 * POOL namespace
12 */
13namespace pool {
14
15 class DbDatabaseObj;
16
26 private:
30 int m_type;
32 std::string m_name;
35 public:
37 DbConnection(int typ, const std::string& nam, DbDatabaseObj* hdl)
38 : m_refCount(0), m_type(typ), m_name(nam), m_handle(hdl) { }
39
42
43 ~DbConnection() = default;
44
46
48 int release() {
49 int cnt = --m_refCount;
50 if ( 0 >= cnt ) {
51 delete this;
52 }
53 return cnt;
54 }
55
56 int addRef() { return ++m_refCount; }
59 const DbDatabaseObj* handle() const { return m_handle; }
61 const std::string& name() const { return m_name; }
63 int type() const { return m_type; }
64 };
65} // namespace pool
66
67#endif
~DbConnection()=default
Standard destructor.
int m_type
Connection type.
int type() const
Access technoliogy type.
DbDatabaseObj * m_handle
True handle.
int m_refCount
Reference count.
DbConnection(const DbConnection &c)
Copy Constructor.
DbDatabaseObj * handle()
Access object identifier.
DbConnection(int typ, const std::string &nam, DbDatabaseObj *hdl)
Constructor with initializing arguments.
DbConnection & operator=(const DbConnection &)=delete
int addRef()
Increase reference count.
int release()
Release token: Decrease reference count and eventually delete.
const std::string & name() const
Access Database identifier.
std::string m_name
Name of this connection.
const DbDatabaseObj * handle() const
Framework include files.
Definition libname.h:15