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#ifndef STORAGESVC_DBCONNECTION_H
5#define STORAGESVC_DBCONNECTION_H
6
7#include <string>
8
9class DbDatabaseObj;
10
19 private:
23 int m_type;
25 std::string m_name;
28 public:
30 DbConnection(int typ, const std::string& nam, DbDatabaseObj* hdl)
31 : m_refCount(0), m_type(typ), m_name(nam), m_handle(hdl) { }
32
35
36 ~DbConnection() = default;
37
39
41 int release() {
42 int cnt = --m_refCount;
43 if ( 0 >= cnt ) {
44 delete this;
45 }
46 return cnt;
47 }
48
49 int addRef() { return ++m_refCount; }
52 const DbDatabaseObj* handle() const { return m_handle; }
54 const std::string& name() const { return m_name; }
56 int type() const { return m_type; }
57};
58
59#endif
DbConnection(int typ, const std::string &nam, DbDatabaseObj *hdl)
Constructor with initializing arguments.
const std::string & name() const
Access Database identifier.
DbDatabaseObj * m_handle
True handle.
std::string m_name
Name of this connection.
int addRef()
Increase reference count.
int m_type
Connection type.
~DbConnection()=default
Standard destructor.
int type() const
Access technoliogy type.
int m_refCount
Reference count.
int release()
Release token: Decrease reference count and eventually delete.
const DbDatabaseObj * handle() const
DbDatabaseObj * handle()
Access object identifier.
DbConnection & operator=(const DbConnection &)=delete
DbConnection(const DbConnection &c)
Copy Constructor.
Description: Technology independent part of a Database object implementation.