ATLAS Offline Software
Loading...
Searching...
No Matches
DbConnection.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef STORAGESVC_DBCONNECTION_H
6#define STORAGESVC_DBCONNECTION_H
7
9#include <string>
10
11/*
12 * POOL namespace
13 */
14namespace pool {
15
16 // Forward declarations
17 class DbDatabase;
18
31 private:
35 int m_type;
37 std::string m_name;
39 void* m_handle;
40 public:
42 DbConnection(int typ, const std::string& nam, void* hdl)
44 m_refCount(0), m_type(typ), m_name(nam), m_handle(hdl) { }
45
49
50 virtual ~DbConnection() { }
51
53
55 int release() {
56 int cnt = --m_refCount;
57 if ( 0 >= cnt ) {
58 delete this;
59 }
60 return cnt;
61 }
62
63 int addRef() { return ++m_refCount; }
65 virtual void* handle() { return m_handle; }
66 virtual const void* handle() const { return m_handle; }
68 virtual const std::string& name() const { return m_name; }
70 virtual int type() const { return m_type; }
71 };
72} // namespace pool
73
74#endif
Definition of the DbConnection class.
virtual const std::string & name() const
Access Database identifier.
int m_type
Connection type.
int m_refCount
Reference count.
DbConnection(const DbConnection &c)
Copy Constructor.
DbConnection(int typ, const std::string &nam, void *hdl)
Constructor with initializing arguments.
void * m_handle
True handle.
virtual int type() const
Access technoliogy type.
DbConnection & operator=(const DbConnection &)=delete
virtual void * handle()
Access object identifier.
int addRef()
Increase reference count.
int release()
Release token: Decrease reference count and eventually delete.
virtual const void * handle() const
virtual ~DbConnection()
Standard destructor.
std::string m_name
Name of this connection.
Description: Handle managing a DbDatabaseObj, a generic Database object.
Definition DbDatabase.h:53
pool namespace
Definition libname.h:15