12#ifndef POOL_DBACCESSOBJ_H
13#define POOL_DBACCESSOBJ_H 1
19#include "GaudiKernel/StatusCode.h"
51 typedef std::map< KEY, TYPE* >
Keys;
93 std::cout <<
typeid(*this).name()
105#ifdef DEBUG_REFCOUNTS
106 std::cout <<
typeid(*this).name()
124 for(
const auto & k :
m_keys ) k.second->release();
130 return (
m_keys.end() == i) ? 0 : (*i).second;
135 return (
m_keys.end() == i) ? 0 : (*i).second;
140 if (
m_keys.end() == i ) {
141 m_keys.insert(std::make_pair(key, val));
143 return StatusCode::SUCCESS;
145 return StatusCode::FAILURE;
150 if ( (*j).second == val ) {
151 TYPE* p = (*j).second;
154 return StatusCode::SUCCESS;
157 return StatusCode::FAILURE;
#define TYPE(CODE, TYP, IOTYP)
const_iterator end() const
std::map< std::string, DbContainerObj * > Keys
const_iterator begin() const
std::atomic< int > m_refCount
Keys::const_iterator const_iterator
DbAccessObj< std::string, DbContainerObj > Base
int addRef() const
Add reference count.
DbAccessMode mode() const
Access mode.
void setMode(DbAccessMode m)
Set Access mode.
const std::string & name() const
Access the instance name.
virtual ~DbAccessObj()
Standard destructor.
StatusCode remove(const TYPE *val)
Remove entry from container.
StatusCode add(const KEY &key, TYPE *val)
Add entry to container.
const TYPE * find(const KEY &key) const
Find object by key (CONST)
int refCount() const
Access reference counter.
void clearEntries()
Object cleanup: remove all entries.
const DbType & type() const
void setName(const std::string &n)
Access the instance name.
const IOODatabase * db() const
Allow access to the Database implementation.
int release() const
Remove reference count.
TYPE * find(const KEY &key)
Find object by key.
DbAccessObj(const std::string &n, DbAccessMode m, const DbType &t, IOODatabase *s=0)
Constructor with initializing arguments.
size_t size() const
Object size.
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
void releasePtr(T *&p)
Release a pointer.