ATLAS Offline Software
Loading...
Searching...
No Matches
DbDomain.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5//====================================================================
6// DbDomain and related class definitions
7//--------------------------------------------------------------------
8//
9// Package : StorageSvc (The POOL project)
10// @author M.Frank
11//====================================================================
12#ifndef POOL_DBDOMAIN_H
13#define POOL_DBDOMAIN_H
14
15// Framework include files
16#include "StorageSvc/pool.h"
18
19// STL include files
20#include <vector>
21
22class Token;
23class StatusCode;
24
25/*
26 * POOL namespace declaration
27 */
28namespace pool {
29
30 // Forward declarations
31 class IDbDomain;
32 class IOODatabase;
33 class DbDomainObj;
34 class DbDatabaseObj;
35 class DbSession;
36 class DbOption;
37
47 class DbDomain : public DbHandleBase<DbDomainObj> {
48 public:
50 friend class DbDomainObj;
51 private:
54 public:
58 explicit DbDomain(const DbType& type) { m_type = type.majorType(); }
60 DbDomain(const DbDomain& copy)
61 : DbHandleBase<DbDomainObj>() { *this = copy; }
62
63 virtual ~DbDomain() { switchPtr( 0 ); }
65 DbDomain& operator=(const DbDomain& copy) {
66 if ( &copy != this ) {
67 m_type = copy.m_type;
68 switchPtr(copy.m_ptr);
69 }
70 return *this;
71 }
72
73 DbDomain& operator=(const int /* null_obj */ ) {
74 switchPtr(0);
75 return *this;
76 }
77
78 const std::string& name() const;
80 int refCount() const;
81
83
90 StatusCode open(IOODatabase* imp, const DbType& technology, DbAccessMode mod = pool::READ);
92 StatusCode close();
96 bool existsDbase(const std::string& db_name);
98 const DbDatabaseObj* find(const std::string& db_name) const;
99 DbDatabaseObj* find(const std::string& db_name);
101 StatusCode add(const std::string& nam, DbDatabaseObj* db);
103 StatusCode remove(DbDatabaseObj* db);
105 StatusCode ageOpenDbs();
107 StatusCode closeAgedDbs();
109 void setAgeLimit(int value);
111 int ageLimit() const;
114 const IDbDomain* info() const;
115
117
121 StatusCode setOption(const DbOption& refOpt);
122
124
128 StatusCode getOption(DbOption& refOpt) const;
129
132 const IOODatabase* db() const;
133 };
134} // End namespace pool
135#endif // POOL_DBDOMAIN_H
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition Token.h:21
Db objects: DbDomainObj.
Definition DbDomainObj.h:40
int refCount() const
Access reference counter.
const IOODatabase * db() const
StatusCode getOption(DbOption &refOpt) const
Access domain specific options.
virtual ~DbDomain()
Standard destructor.
Definition DbDomain.h:63
void switchPtr(DbDomainObj *obj)
Assign transient object properly (including reference counting)
friend class DbDomainObj
Friend declarations.
Definition DbDomain.h:50
const DbDatabaseObj * find(const std::string &db_name) const
Find Database in domain.
StatusCode remove(DbDatabaseObj *db)
Remove a database from the domain.
IOODatabase * db()
Allow access to the Database implementation.
StatusCode ageOpenDbs()
Increase the age of all open databases.
IDbDomain * info()
Let the implementation access the internals.
DbDomain(const DbDomain &copy)
Copy constructor.
Definition DbDomain.h:60
StatusCode setOption(const DbOption &refOpt)
Set domain specific options.
DbDomain & operator=(const DbDomain &copy)
Assignment operator.
Definition DbDomain.h:65
StatusCode close()
Close domain.
void setAgeLimit(int value)
Set the maximal allowed age limit for files in this domain.
DbDomain & operator=(const int)
Assignment operator to reset handel easily using 0.
Definition DbDomain.h:73
StatusCode add(const std::string &nam, DbDatabaseObj *db)
Add database to the domain.
StatusCode closeAgedDbs()
Check if databases are present, which aged a lot and need to be closed.
const IDbDomain * info() const
bool existsDbase(const std::string &db_name)
Check if Database exists within the domain.
const std::string & name() const
Acces to the domain name.
DbDatabaseObj * find(const std::string &db_name)
DbDomain(DbDomainObj *dom)
Friend's constructor.
DbAccessMode openMode() const
Access to access mode.
StatusCode open(IOODatabase *imp, const DbType &technology, DbAccessMode mod=pool::READ)
Open the domain.
int ageLimit() const
Access the maximal age limit.
DbDomain(const DbType &type)
Constructor using Db type.
Definition DbDomain.h:58
const DbType & type() const
Description: Definition an option to be supplied to database objects.
Definition DbOption.h:37
IDbDomain interface.
Definition IDbDomain.h:42
pool namespace
Definition libname.h:15