ATLAS Offline Software
Loading...
Searching...
No Matches
DbDomain.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 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 bool exist(DbSession& sesH, int technology) const;
91
93
102 StatusCode open(DbSession& sesH,
103 const DbType& technology,
106 StatusCode close();
112 bool existsDbase(const std::string& db_name);
114 const DbDatabaseObj* find(const std::string& db_name) const;
115 DbDatabaseObj* find(const std::string& db_name);
117 StatusCode add(const std::string& nam, DbDatabaseObj* db);
119 StatusCode remove(DbDatabaseObj* db);
121 StatusCode ageOpenDbs();
123 StatusCode closeAgedDbs();
125 void setAgeLimit(int value);
127 int ageLimit() const;
130 const IDbDomain* info() const;
131
133
137 StatusCode setOption(const DbOption& refOpt);
138
140
144 StatusCode getOption(DbOption& refOpt) const;
145
148 const IOODatabase* db() const;
149 };
150} // End namespace pool
151#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
DbSession containedIn() const
Access to session handle.
bool exist(DbSession &sesH, int technology) const
Check for the existence of a domain within a session.
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)
Find domain in session.
IOODatabase * db()
Allow access to the Database implementation.
StatusCode open(DbSession &sesH, const DbType &technology, DbAccessMode mod=pool::READ)
Open domain within a session environment.
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 domain to session.
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.
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
Db objects: class DbSession.
Definition DbSession.h:44
IDbDomain interface.
Definition IDbDomain.h:42
pool namespace
Definition libname.h:15