ATLAS Offline Software
Loading...
Searching...
No Matches
DbAccessObjBase Class Reference

Base for the DbAccessObj template (see below) provides reference counting and common members and methods but no container functionality (also used directly by DbContainerObj as it does not hold subcontainers). More...

#include <StorageSvc/DbAccessObj.h>

Inheritance diagram for DbAccessObjBase:
Collaboration diagram for DbAccessObjBase:

Public Member Functions

 DbAccessObjBase (const std::string &n, Io::IoFlag m, const DbType &t, ITechFactory *s=0)
 Constructor with initializing arguments.
virtual ~DbAccessObjBase ()
 Standard destructor.
const std::string & name () const
 Access the instance name.
void setName (const std::string &n)
 Access the instance name.
Io::IoFlag mode () const
 Access mode.
void setMode (Io::IoFlag m)
 Set Access mode.
const DbType & type () const
const ITechFactory * techFactory () const
 Allow access to the Database implementation.
ITechFactory * techFactory ()
int refCount () const
 Access reference counter.
int addRef () const
 Add reference count.
int release () const
 Remove reference count.

Private Attributes

std::atomic< int > m_refCount
 Reference counter.
Io::IoFlag m_mode
 Access mode.
std::string m_name
 Name of the instance.
DbType m_type
 Database type.
ITechFactory * m_factory
 Pointer to specific pool implementation.

Detailed Description

Base for the DbAccessObj template (see below) provides reference counting and common members and methods but no container functionality (also used directly by DbContainerObj as it does not hold subcontainers).

Definition at line 30 of file DbAccessObj.h.

Constructor & Destructor Documentation

◆ DbAccessObjBase()

DbAccessObjBase::DbAccessObjBase ( const std::string & n,
Io::IoFlag m,
const DbType & t,
ITechFactory * s = 0 )
inline

Constructor with initializing arguments.

Definition at line 45 of file DbAccessObj.h.

46 : m_refCount(0), m_mode(m), m_name(n), m_type(t), m_factory(s)
47 { if( m_factory ) m_factory->addRef(); }
std::string m_name
Name of the instance.
Definition DbAccessObj.h:37
ITechFactory * m_factory
Pointer to specific pool implementation.
Definition DbAccessObj.h:41
Io::IoFlag m_mode
Access mode.
Definition DbAccessObj.h:35
std::atomic< int > m_refCount
Reference counter.
Definition DbAccessObj.h:33
DbType m_type
Database type.
Definition DbAccessObj.h:39

◆ ~DbAccessObjBase()

virtual DbAccessObjBase::~DbAccessObjBase ( )
inlinevirtual

Standard destructor.

Definition at line 49 of file DbAccessObj.h.

void releasePtr(T *&p)
Release a pointer.

Member Function Documentation

◆ addRef()

int DbAccessObjBase::addRef ( ) const
inline

Add reference count.

Definition at line 66 of file DbAccessObj.h.

66 {
67#ifdef DEBUG_REFCOUNTS
68 std::cout << typeid(*this).name()
69 << " "
70 << m_name
71 << " Refcount:"
72 << m_refCount+1
73 << std::endl;
74#endif
75 return ++m_refCount;
76 }

◆ mode()

Io::IoFlag DbAccessObjBase::mode ( ) const
inline

Access mode.

Definition at line 55 of file DbAccessObj.h.

55{ return m_mode; }

◆ name()

const std::string & DbAccessObjBase::name ( ) const
inline

Access the instance name.

Definition at line 51 of file DbAccessObj.h.

51{ return m_name; }

◆ refCount()

int DbAccessObjBase::refCount ( ) const
inline

Access reference counter.

Definition at line 64 of file DbAccessObj.h.

64{ return m_refCount; }

◆ release()

int DbAccessObjBase::release ( ) const
inline

Remove reference count.

Definition at line 78 of file DbAccessObj.h.

78 {
79 int count = --m_refCount;
80#ifdef DEBUG_REFCOUNTS
81 std::cout << typeid(*this).name()
82 << " "
83 << m_name
84 << " Refcount:"
85 << count
86 << std::endl;
87#endif
88 if ( count == 0 ) {
89 delete this;
90 }
91 return count;
92 }
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:148

◆ setMode()

void DbAccessObjBase::setMode ( Io::IoFlag m)
inline

Set Access mode.

Definition at line 57 of file DbAccessObj.h.

◆ setName()

void DbAccessObjBase::setName ( const std::string & n)
inline

Access the instance name.

Definition at line 53 of file DbAccessObj.h.

◆ techFactory() [1/2]

ITechFactory * DbAccessObjBase::techFactory ( )
inline

Definition at line 62 of file DbAccessObj.h.

62{ return m_factory; }

◆ techFactory() [2/2]

const ITechFactory * DbAccessObjBase::techFactory ( ) const
inline

Allow access to the Database implementation.

Definition at line 61 of file DbAccessObj.h.

61{ return m_factory; }

◆ type()

const DbType & DbAccessObjBase::type ( ) const
inline

Definition at line 59 of file DbAccessObj.h.

59{ return m_type; }

Member Data Documentation

◆ m_factory

ITechFactory* DbAccessObjBase::m_factory
private

Pointer to specific pool implementation.

Definition at line 41 of file DbAccessObj.h.

◆ m_mode

Io::IoFlag DbAccessObjBase::m_mode
private

Access mode.

Definition at line 35 of file DbAccessObj.h.

◆ m_name

std::string DbAccessObjBase::m_name
private

Name of the instance.

Definition at line 37 of file DbAccessObj.h.

◆ m_refCount

std::atomic<int> DbAccessObjBase::m_refCount
mutableprivate

Reference counter.

Definition at line 33 of file DbAccessObj.h.

◆ m_type

DbType DbAccessObjBase::m_type
private

Database type.

Definition at line 39 of file DbAccessObj.h.


The documentation for this class was generated from the following file: