ATLAS Offline Software
DbContainerObj.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 // DbContainerObj class definitions
7 //--------------------------------------------------------------------
8 //
9 // Package : StorageSvc (The POOL project)
10 // @author M.Frank
11 //====================================================================
12 #ifndef POOL_DBCONTAINEROBJ_H
13 #define POOL_DBCONTAINEROBJ_H 1
14 
15 // Framework include files
17 #include "StorageSvc/DbDatabase.h"
18 #include "StorageSvc/DbAccessObj.h"
19 #include "StorageSvc/DbContainer.h"
20 #include "POOLCore/DbPrint.h"
21 
22 /*
23  * POOL namespace declaration
24  */
25 namespace pool {
26 
27  typedef const class Shape *ShapeH;
28 
45  struct DbObjectHolder {
47  explicit DbObjectHolder(DbObject* p) : m_obj(p) {}
48  int release();
49  };
50  class DbContainerObj : public DbAccessObj<DbObject*, DbObjectHolder >, public APRMessaging {
51  private:
55  const Token* m_tokH;
59  bool m_isOpen;
60 
62  bool hasAccess();
63  public:
65 
73  const std::string& nam,
74  const DbType& dbtyp,
77  virtual ~DbContainerObj();
79  const IDbContainer* info() const { return m_info; }
80  IDbContainer* info() { return m_info; }
82  const DbTypeInfo* objectShape(const Guid& nam);
84  DbDatabase& database() { return m_dbH; }
86  const Token* token() const { return m_tokH; }
88  bool isOpen() const { return m_isOpen; }
90  bool isReadOnly() const
91  { return !(mode()&pool::UPDATE) && !(mode()&pool::CREATE); }
93  void cancelTransaction() { }
97  DbStatus open(const DbTypeInfo* typ);
110 
112 
114  DbStatus store(const void* object, DbContainer& cntH, ShapeH shape);
115 
117  DbStatus allocate(DbContainer& cntH, const void* object, ShapeH shape, Token::OID_t& oid);
118 
120  DbStatus load( void** ptr, ShapeH shape,
121  const Token::OID_t& linkH,
122  Token::OID_t& oid,
123  bool any_next);
125 
130  };
131 } // End namespace pool
132 #endif // POOL_DBCONTAINEROBJ_H
pool::DbAccessMode
int DbAccessMode
Definition: Database/APR/StorageSvc/StorageSvc/pool.h:34
pool::DbContainerObj::open
DbStatus open(const DbTypeInfo *typ)
Open the container.
pool::DbContainerObj::~DbContainerObj
virtual ~DbContainerObj()
Standard destructor.
pool::DbObject
void DbObject
Definition: Database/APR/StorageSvc/StorageSvc/pool.h:33
pool::DbStatus
Definition: DbStatus.h:64
pool::DbObjectHolder::DbObjectHolder
DbObjectHolder(DbObject *p)
Definition: DbContainerObj.h:47
pool::DbContainerObj::m_tokH
const Token * m_tokH
Container token.
Definition: DbContainerObj.h:55
pool::DbContainerObj::retire
DbStatus retire()
Retire the container.
DbAccessObj.h
make_coralServer_rep.opt
opt
Definition: make_coralServer_rep.py:19
pool::CREATE
@ CREATE
Definition: Database/APR/StorageSvc/StorageSvc/pool.h:45
pool::DbContainerObj::getOption
DbStatus getOption(DbOption &refOpt)
Access options.
pool::DbContainerObj::m_info
IDbContainer * m_info
Pointer to interface of the technology dependent part.
Definition: DbContainerObj.h:53
pool::DbContainerObj::allocate
DbStatus allocate(DbContainer &cntH, const void *object, ShapeH shape, Token::OID_t &oid)
In place allocation of object location.
pool
pool namespace
Definition: libname.h:15
pool::IDbContainer
Definition: IDbContainer.h:46
pool::DbContainerObj::fetch
DbStatus fetch(DbSelect &sel)
Fetch next object address of the selection to set token.
pool::APRMessaging
AthMessaging wrapper to set the output level in APR components.
Definition: DbPrint.h:35
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
pool::DbContainerObj::cancelTransaction
void cancelTransaction()
Cancel transaction flag.
Definition: DbContainerObj.h:93
pool::Shape
Definition: Shape.h:35
pool::UPDATE
@ UPDATE
Definition: Database/APR/StorageSvc/StorageSvc/pool.h:44
ReadBchFromCrest.mod
mod
Definition: ReadBchFromCrest.py:72
DbDatabase.h
Token
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition: Token.h:21
pool::DbContainerObj
Definition: DbContainerObj.h:50
pool::DbContainerObj::hasAccess
bool hasAccess()
Check database access.
Token::OID_t
Definition: Token.h:24
pool::DbAccessObj
Definition: DbAccessObj.h:47
pool::DbContainerObj::isReadOnly
bool isReadOnly() const
Check if database is in read-only mode.
Definition: DbContainerObj.h:90
DbPrint.h
pool::ShapeH
const class Shape * ShapeH
Definition: DbContainerObj.h:27
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
DbContainer.h
pool::DbType
Definition: DbType.h:30
pool::DbAccessObj< DbObject *, DbObjectHolder >::mode
DbAccessMode mode() const
Access mode.
Definition: DbAccessObj.h:80
pool::DbContainerObj::store
DbStatus store(const void *object, DbContainer &cntH, ShapeH shape)
Store object in location.
pool::DbOption
Definition: DbOption.h:36
sel
sel
Definition: SUSYToolsTester.cxx:92
pool::DbSelect
Definition: DbSelect.h:43
pool::DbContainerObj::objectShape
const DbTypeInfo * objectShape(const Guid &nam)
Retrieve persistent type information by name.
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
pool::DbContainerObj::size
uint64_t size()
Size of the Database container (=# of objects)
pool::DbContainerObj::info
const IDbContainer * info() const
Access to internals.
Definition: DbContainerObj.h:79
pool::DbContainerObj::load
DbStatus load(void **ptr, ShapeH shape, const Token::OID_t &linkH, Token::OID_t &oid, bool any_next)
Select object in the container identified by its handle.
pool::DbContainerObj::setOption
DbStatus setOption(const DbOption &opt)
Pass options to the implementation.
pool::DbObjectHolder
Definition: DbContainerObj.h:45
pool::DbContainerObj::transAct
DbStatus transAct(Transaction::Action)
Execute Database Transaction Action.
pool::Transaction::Action
Action
Definition: Transaction.h:34
pool::DbContainerObj::close
DbStatus close()
Close the container.
pool::DbObjectHolder::m_obj
DbObject * m_obj
Definition: DbContainerObj.h:46
pool::DbContainer
Definition: DbContainer.h:48
pool::DbContainerObj::m_isOpen
bool m_isOpen
Flag indication DbStatus of technology dependent container.
Definition: DbContainerObj.h:59
Guid
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition: Guid.h:25
pool::DbContainerObj::select
DbStatus select(DbSelect &sel)
Perform selection. The statement belongs to the container afterwards.
pool::DbContainerObj::DbContainerObj
DbContainerObj(DbDatabase &dbH, const std::string &nam, const DbType &dbtyp, DbAccessMode mod)
Standard constructor of a container object using the Database handle as a clustering hint.
pool::DbContainerObj::token
const Token * token() const
Access the token of the container object.
Definition: DbContainerObj.h:86
pool::DbContainerObj::database
DbDatabase & database()
Handle to Database (CONST)
Definition: DbContainerObj.h:84
pool::DbContainerObj::info
IDbContainer * info()
Definition: DbContainerObj.h:80
pool::DbObjectHolder::release
int release()
pool::DbDatabase
Definition: DbDatabase.h:53
Token.h
This file contains the class definition for the Token class (migrated from POOL).
pool::DbContainerObj::m_dbH
DbDatabase m_dbH
Handle to hosting Database.
Definition: DbContainerObj.h:57
pool::DbTypeInfo
Definition: DbTypeInfo.h:47
pool::DbContainerObj::checkAccess
DbStatus checkAccess()
Check if we can access the container.
pool::DbContainerObj::isOpen
bool isOpen() const
Flag if container was opened.
Definition: DbContainerObj.h:88