ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
pool::DbDomainObj Class Reference

Db objects: DbDomainObj. More...

#include <DbDomainObj.h>

Inheritance diagram for pool::DbDomainObj:
Collaboration diagram for pool::DbDomainObj:

Public Types

typedef DbAccessObj< std::string, DbDatabaseObjBase
 Type definitions. More...
 
typedef std::map< std::string, DbDatabaseObj * > Keys
 
typedef Keys::iterator iterator
 
typedef Keys::const_iterator const_iterator
 

Public Member Functions

 DbDomainObj (DbSession &session, const DbType &typ, DbAccessMode mode=pool::READ)
 Constructor. More...
 
virtual ~DbDomainObj ()
 Standard destructor. More...
 
IDbDomaininfo ()
 Access to technology dependent implementation. More...
 
const IDbDomaininfo () const
 
DbSessionsession ()
 Access session handle. More...
 
const DbSessionsession () const
 
void setAgeLimit (int value)
 Set the maximal allowed age limit for files in this domain. More...
 
int ageLimit () const
 Access the maximal age limit. More...
 
bool existsDbase (const std::string &nam)
 Check for Database existence within domain. More...
 
DbStatus open (DbAccessMode mode)
 Open domain with possible change of access mode. More...
 
DbStatus open ()
 Open domain in default access mode. More...
 
DbStatus close ()
 Close domain. More...
 
DbStatus ageOpenDbs ()
 Increase the age of all open databases. More...
 
DbStatus closeAgedDbs ()
 Check if databases are present, which aged a lot and need to be closed. More...
 
DbStatus setOption (const DbOption &refOpt)
 Set domain specific options. More...
 
DbStatus getOption (DbOption &refOpt) const
 Access domain specific options. More...
 
const std::string & name () const
 Access the instance name. More...
 
void setName (const std::string &n)
 Access the instance name. More...
 
DbAccessMode mode () const
 Access mode. More...
 
void setMode (DbAccessMode m)
 Set Access mode. More...
 
const DbTypetype () const
 
const IOODatabasedb () const
 Allow access to the Database implementation. More...
 
IOODatabasedb ()
 
int refCount () const
 Access reference counter. More...
 
int addRef () const
 Add reference count. More...
 
int release () const
 Remove reference count. More...
 
size_t size () const
 Object size. More...
 
DbStatus clearEntries ()
 Object cleanup: remove all entries. More...
 
const DbDatabaseObjfind (const std::string &key) const
 Find object by key (CONST) More...
 
DbDatabaseObjfind (const std::string &key)
 Find object by key. More...
 
DbStatus add (const std::string &key, DbDatabaseObj *val)
 Add entry to container. More...
 
DbStatus remove (const DbDatabaseObj *val)
 Remove entry from container. More...
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
bool msgLvl (const MSG::Level lvl) const
 Test the output level. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

DbSession m_session
 Handle to session. More...
 
int m_maxAge
 Maximal age of files allowed. More...
 
IDbDomainm_info
 Technology dependent stuff. More...
 
std::atomic< int > m_refCount
 Reference counter. More...
 
DbAccessMode m_mode
 Access mode. More...
 
std::string m_name
 Name of the instance. More...
 
DbType m_type
 Database type. More...
 
Keys m_keys
 Key entry buffer. More...
 
IOODatabasem_pool
 Pointer to specific pool implementation. More...
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

Db objects: DbDomainObj.

Description: Implementation independent part of a Database domain object objects.

Author
M.Frank
Version
1.0

Definition at line 40 of file DbDomainObj.h.

Member Typedef Documentation

◆ Base

typedef DbAccessObj< std::string , DbDatabaseObj > pool::DbAccessObj< std::string , DbDatabaseObj >::Base
inherited

Type definitions.

Definition at line 50 of file DbAccessObj.h.

◆ const_iterator

typedef Keys::const_iterator pool::DbAccessObj< std::string , DbDatabaseObj >::const_iterator
inherited

Definition at line 53 of file DbAccessObj.h.

◆ iterator

typedef Keys::iterator pool::DbAccessObj< std::string , DbDatabaseObj >::iterator
inherited

Definition at line 52 of file DbAccessObj.h.

◆ Keys

typedef std::map< std::string , DbDatabaseObj * > pool::DbAccessObj< std::string , DbDatabaseObj >::Keys
inherited

Definition at line 51 of file DbAccessObj.h.

Constructor & Destructor Documentation

◆ DbDomainObj()

pool::DbDomainObj::DbDomainObj ( DbSession session,
const DbType typ,
DbAccessMode  mode = pool::READ 
)

Constructor.

◆ ~DbDomainObj()

virtual pool::DbDomainObj::~DbDomainObj ( )
virtual

Standard destructor.

Member Function Documentation

◆ add()

DbStatus pool::DbAccessObj< std::string , DbDatabaseObj >::add ( const std::string &  key,
DbDatabaseObj val 
)
inlineinherited

Add entry to container.

Definition at line 142 of file DbAccessObj.h.

142  {
143  iterator i = m_keys.find(key);
144  if ( m_keys.end() == i ) {
145  m_keys.insert(std::make_pair(key, val));
146  val->addRef();
147  return Success;
148  }
149  return Error;
150  }

◆ addRef()

int pool::DbAccessObj< std::string , DbDatabaseObj >::addRef
inlineinherited

Add reference count.

Definition at line 91 of file DbAccessObj.h.

91  {
92 #ifdef DEBUG_REFCOUNTS
93  std::cout << typeid(*this).name()
94  << " "
95  << m_name
96  << " Refcount:"
97  << m_refCount+1
98  << std::endl;
99 #endif
100  return ++m_refCount;
101  }

◆ ageLimit()

int pool::DbDomainObj::ageLimit ( ) const
inline

Access the maximal age limit.

Definition at line 64 of file DbDomainObj.h.

64 { return m_maxAge; }

◆ ageOpenDbs()

DbStatus pool::DbDomainObj::ageOpenDbs ( )

Increase the age of all open databases.

◆ begin() [1/2]

iterator pool::DbAccessObj< std::string , DbDatabaseObj >::begin
inlineinherited

Definition at line 163 of file DbAccessObj.h.

163 { return m_keys.begin(); }

◆ begin() [2/2]

const_iterator pool::DbAccessObj< std::string , DbDatabaseObj >::begin
inlineinherited

Definition at line 164 of file DbAccessObj.h.

164 { return m_keys.begin(); }

◆ clearEntries()

DbStatus pool::DbAccessObj< std::string , DbDatabaseObj >::clearEntries
inlineinherited

Object cleanup: remove all entries.

Definition at line 123 of file DbAccessObj.h.

123  {
124  Keys k = m_keys;
125  for(iterator j = k.begin(); j != k.end(); ++j ) {
126  (*j).second->release();
127  }
128  m_keys.clear();
129  return Success;
130  }

◆ close()

DbStatus pool::DbDomainObj::close ( )

Close domain.

◆ closeAgedDbs()

DbStatus pool::DbDomainObj::closeAgedDbs ( )

Check if databases are present, which aged a lot and need to be closed.

◆ db() [1/2]

IOODatabase* pool::DbAccessObj< std::string , DbDatabaseObj >::db
inlineinherited

Definition at line 87 of file DbAccessObj.h.

87 { return m_pool; }

◆ db() [2/2]

const IOODatabase* pool::DbAccessObj< std::string , DbDatabaseObj >::db
inlineinherited

Allow access to the Database implementation.

Definition at line 86 of file DbAccessObj.h.

86 { return m_pool; }

◆ end() [1/2]

iterator pool::DbAccessObj< std::string , DbDatabaseObj >::end
inlineinherited

Definition at line 165 of file DbAccessObj.h.

165 { return m_keys.end(); }

◆ end() [2/2]

const_iterator pool::DbAccessObj< std::string , DbDatabaseObj >::end
inlineinherited

Definition at line 166 of file DbAccessObj.h.

166 { return m_keys.end(); }

◆ existsDbase()

bool pool::DbDomainObj::existsDbase ( const std::string &  nam)

Check for Database existence within domain.

◆ find() [1/2]

DbDatabaseObj * pool::DbAccessObj< std::string , DbDatabaseObj >::find ( const std::string &  key)
inlineinherited

Find object by key.

Definition at line 137 of file DbAccessObj.h.

137  {
138  iterator i = m_keys.find(key);
139  return (m_keys.end() == i) ? 0 : (*i).second;
140  }

◆ find() [2/2]

const DbDatabaseObj * pool::DbAccessObj< std::string , DbDatabaseObj >::find ( const std::string &  key) const
inlineinherited

Find object by key (CONST)

Definition at line 132 of file DbAccessObj.h.

132  {
133  const_iterator i = m_keys.find(key);
134  return (m_keys.end() == i) ? 0 : (*i).second;
135  }

◆ getOption()

DbStatus pool::DbDomainObj::getOption ( DbOption refOpt) const

Access domain specific options.

Parameters
refOpt[IN] Reference to option object
Returns
DbStatus code indicating success or failure.

◆ info() [1/2]

IDbDomain* pool::DbDomainObj::info ( )
inline

Access to technology dependent implementation.

Definition at line 56 of file DbDomainObj.h.

56 { return m_info; }

◆ info() [2/2]

const IDbDomain* pool::DbDomainObj::info ( ) const
inline

Definition at line 57 of file DbDomainObj.h.

57 { return m_info; }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  // If user did not set an explicit level, set a default
43  if (m_lvl == MSG::NIL) {
44  m_lvl = m_imsg ?
45  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46  MSG::INFO;
47  }
48 }

◆ mode()

DbAccessMode pool::DbAccessObj< std::string , DbDatabaseObj >::mode
inlineinherited

Access mode.

Definition at line 80 of file DbAccessObj.h.

80 { return m_mode; }

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 163 of file AthMessaging.h.

164 {
165  MsgStream* ms = m_msg_tls.get();
166  if (!ms) {
167  if (!m_initialized.test_and_set()) initMessaging();
168  ms = new MsgStream(m_imsg,m_nm);
169  m_msg_tls.reset( ms );
170  }
171 
172  ms->setLevel (m_lvl);
173  return *ms;
174 }

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level  lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 178 of file AthMessaging.h.

179 { return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152 {
153  if (m_lvl <= lvl) {
154  msg() << lvl;
155  return true;
156  } else {
157  return false;
158  }
159 }

◆ name()

const std::string& pool::DbAccessObj< std::string , DbDatabaseObj >::name
inlineinherited

Access the instance name.

Definition at line 76 of file DbAccessObj.h.

76 { return m_name; }

◆ open() [1/2]

DbStatus pool::DbDomainObj::open ( )

Open domain in default access mode.

◆ open() [2/2]

DbStatus pool::DbDomainObj::open ( DbAccessMode  mode)

Open domain with possible change of access mode.

◆ refCount()

int pool::DbAccessObj< std::string , DbDatabaseObj >::refCount
inlineinherited

Access reference counter.

Definition at line 89 of file DbAccessObj.h.

89 { return m_refCount; }

◆ release()

int pool::DbAccessObj< std::string , DbDatabaseObj >::release
inlineinherited

Remove reference count.

Definition at line 103 of file DbAccessObj.h.

103  {
104  int count = --m_refCount;
105 #ifdef DEBUG_REFCOUNTS
106  std::cout << typeid(*this).name()
107  << " "
108  << m_name
109  << " Refcount:"
110  << count
111  << std::endl;
112 #endif
113  if ( count == 0 ) {
114  delete this;
115  }
116  return count;
117  }

◆ remove()

DbStatus pool::DbAccessObj< std::string , DbDatabaseObj >::remove ( const DbDatabaseObj val)
inlineinherited

Remove entry from container.

Definition at line 152 of file DbAccessObj.h.

152  {
153  for (iterator j = m_keys.begin(); j != m_keys.end(); ++j ) {
154  if ( (*j).second == val ) {
155  TYPE* p = (*j).second;
156  m_keys.erase(j);
157  p->release();
158  return Success;
159  }
160  }
161  return Error;
162  }

◆ session() [1/2]

DbSession& pool::DbDomainObj::session ( )
inline

Access session handle.

Definition at line 59 of file DbDomainObj.h.

59 { return m_session; }

◆ session() [2/2]

const DbSession& pool::DbDomainObj::session ( ) const
inline

Definition at line 60 of file DbDomainObj.h.

60 { return m_session; }

◆ setAgeLimit()

void pool::DbDomainObj::setAgeLimit ( int  value)
inline

Set the maximal allowed age limit for files in this domain.

Definition at line 62 of file DbDomainObj.h.

62 { m_maxAge = value; }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

◆ setMode()

void pool::DbAccessObj< std::string , DbDatabaseObj >::setMode ( DbAccessMode  m)
inlineinherited

Set Access mode.

Definition at line 82 of file DbAccessObj.h.

82 { m_mode = m; }

◆ setName()

void pool::DbAccessObj< std::string , DbDatabaseObj >::setName ( const std::string &  n)
inlineinherited

Access the instance name.

Definition at line 78 of file DbAccessObj.h.

78 { m_name = n; }

◆ setOption()

DbStatus pool::DbDomainObj::setOption ( const DbOption refOpt)

Set domain specific options.

Parameters
refOpt[IN] Reference to option object
Returns
DbStatus code indicating success or failure.

◆ size()

size_t pool::DbAccessObj< std::string , DbDatabaseObj >::size
inlineinherited

Object size.

Definition at line 119 of file DbAccessObj.h.

119  {
120  return m_keys.size();
121  }

◆ type()

const DbType& pool::DbAccessObj< std::string , DbDatabaseObj >::type
inlineinherited

Definition at line 84 of file DbAccessObj.h.

84 { return m_type; }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_info

IDbDomain* pool::DbDomainObj::m_info
private

Technology dependent stuff.

Definition at line 47 of file DbDomainObj.h.

◆ m_keys

Keys pool::DbAccessObj< std::string , DbDatabaseObj >::m_keys
privateinherited

Key entry buffer.

Definition at line 64 of file DbAccessObj.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_maxAge

int pool::DbDomainObj::m_maxAge
private

Maximal age of files allowed.

Definition at line 45 of file DbDomainObj.h.

◆ m_mode

DbAccessMode pool::DbAccessObj< std::string , DbDatabaseObj >::m_mode
privateinherited

Access mode.

Definition at line 58 of file DbAccessObj.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_name

std::string pool::DbAccessObj< std::string , DbDatabaseObj >::m_name
privateinherited

Name of the instance.

Definition at line 60 of file DbAccessObj.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_pool

IOODatabase* pool::DbAccessObj< std::string , DbDatabaseObj >::m_pool
privateinherited

Pointer to specific pool implementation.

Definition at line 66 of file DbAccessObj.h.

◆ m_refCount

std::atomic<int> pool::DbAccessObj< std::string , DbDatabaseObj >::m_refCount
mutableprivateinherited

Reference counter.

Definition at line 56 of file DbAccessObj.h.

◆ m_session

DbSession pool::DbDomainObj::m_session
private

Handle to session.

Definition at line 43 of file DbDomainObj.h.

◆ m_type

DbType pool::DbAccessObj< std::string , DbDatabaseObj >::m_type
privateinherited

Database type.

Definition at line 62 of file DbAccessObj.h.


The documentation for this class was generated from the following file:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
pool::DbAccessObj< std::string, DbDatabaseObj >::m_mode
DbAccessMode m_mode
Access mode.
Definition: DbAccessObj.h:58
pool::DbAccessObj< std::string, DbDatabaseObj >::m_type
DbType m_type
Database type.
Definition: DbAccessObj.h:62
athena.value
value
Definition: athena.py:124
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
XMLtoHeader.count
count
Definition: XMLtoHeader.py:84
pool::DbAccessObj< std::string, DbDatabaseObj >::m_refCount
std::atomic< int > m_refCount
Reference counter.
Definition: DbAccessObj.h:56
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:727
pool::DbAccessObj< std::string, DbDatabaseObj >::const_iterator
Keys::const_iterator const_iterator
Definition: DbAccessObj.h:53
pool::DbAccessObj< std::string, DbDatabaseObj >::m_keys
Keys m_keys
Key entry buffer.
Definition: DbAccessObj.h:64
pool::DbAccessObj< std::string, DbDatabaseObj >::m_name
std::string m_name
Name of the instance.
Definition: DbAccessObj.h:60
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:163
pool::DbAccessObj< std::string, DbDatabaseObj >::iterator
Keys::iterator iterator
Definition: DbAccessObj.h:52
TYPE
#define TYPE(CODE, TYP, IOTYP)
pool::DbDomainObj::m_maxAge
int m_maxAge
Maximal age of files allowed.
Definition: DbDomainObj.h:45
pool::DbAccessObj< std::string, DbDatabaseObj >::Keys
std::map< std::string, DbDatabaseObj * > Keys
Definition: DbAccessObj.h:51
pool::DbDomainObj::m_info
IDbDomain * m_info
Technology dependent stuff.
Definition: DbDomainObj.h:47
python.Constants.INFO
int INFO
Definition: Control/AthenaCommon/python/Constants.py:15
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
pool::DbDomainObj::m_session
DbSession m_session
Handle to session.
Definition: DbDomainObj.h:43
L1Topo::Error
Error
The different types of error that can be flagged in the L1TopoRDO.
Definition: Error.h:16
TrigConf::MSGTC::NIL
@ NIL
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:22
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132
pool::DbAccessObj< std::string, DbDatabaseObj >::m_pool
IOODatabase * m_pool
Pointer to specific pool implementation.
Definition: DbAccessObj.h:66
fitman.k
k
Definition: fitman.py:528
python.SystemOfUnits.m
float m
Definition: SystemOfUnits.py:106
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
python.SystemOfUnits.ms
float ms
Definition: SystemOfUnits.py:148