ATLAS Offline Software
DbContainerObj.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 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/DbObject.h"
18 #include "StorageSvc/DbDatabase.h"
19 #include "StorageSvc/DbAccessObj.h"
20 #include "StorageSvc/DbContainer.h"
21 
22 /*
23  * POOL namespace declaration
24  */
25 namespace pool {
26 
27  typedef const class Shape *ShapeH;
28 
45  struct DbObjectHolder {
48  int release();
49  };
50  class DbContainerObj : public DbAccessObj<DbObject*, DbObjectHolder > {
51  private:
53 
57  const Token* m_tokH;
61  bool m_isOpen;
62 
64  bool hasAccess();
65  public:
67 
75  const std::string& nam,
76  const DbType& dbtyp,
79  virtual ~DbContainerObj();
81  const IDbContainer* info() const { return m_info; }
82  IDbContainer* info() { return m_info; }
84  const DbTypeInfo* objectShape(const Guid& nam);
88  DbDatabase& database() { return m_dbH; }
90  const Token* token() const { return m_tokH; }
92  bool updatesPending() const;
94  bool isOpen() const { return m_isOpen; }
96  bool isReadOnly() const
97  { return !(mode()&pool::UPDATE) && !(mode()&pool::CREATE); }
99  void cancelTransaction() { }
103  DbStatus open(const DbTypeInfo* typ);
114 
121  const DbTypeInfo* typ);
122 
123 
125 
127  void* allocate(unsigned long siz, DbContainer& cntH, ShapeH shape);
128 
130  DbStatus allocate(DbContainer& cntH, const void* object, ShapeH shape, Token::OID_t& oid);
131 
133  DbStatus free(void* ptr, DbContainer& cntH);
134 
136 
141  DbStatus save(DbContainer& cntH, const void* object, ShapeH shape, Token::OID_t& linkH);
142 
144 
149  DbStatus update(DbContainer& cntH, const void* object, ShapeH shape, const Token::OID_t& linkH);
150 
152 
157  DbStatus update(DbContainer& cntH, const void* object, ShapeH shape, const DbObjectHandle<DbObject>& objH);
158 
160  DbStatus load( void** ptr, ShapeH shape,
161  const Token::OID_t& linkH,
162  Token::OID_t& oid,
163  bool any_next);
165 
174  };
175 } // End namespace pool
176 #endif // POOL_DBCONTAINEROBJ_H
pool::DbAccessMode
int DbAccessMode
Definition: Database/APR/StorageSvc/StorageSvc/pool.h:47
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:35
pool::DbStatus
Definition: DbStatus.h:67
pool::DbObjectHolder::DbObjectHolder
DbObjectHolder(DbObject *p)
Definition: DbContainerObj.h:47
pool::DbContainerObj::m_tokH
const Token * m_tokH
Container token.
Definition: DbContainerObj.h:57
pool::DbContainerObj::retire
DbStatus retire()
Retire the container.
pool::DbContainerObj::update
DbStatus update(DbContainer &cntH, const void *object, ShapeH shape, const DbObjectHandle< DbObject > &objH)
Update existing object in the container.
pool::DbContainerObj::update
DbStatus update(DbContainer &cntH, const void *object, ShapeH shape, const Token::OID_t &linkH)
Update an object to the container identified by its handle.
DbAccessObj.h
make_coralServer_rep.opt
opt
Definition: make_coralServer_rep.py:19
pool::DbContainerObj::save
DbStatus save(DbContainer &cntH, const void *object, ShapeH shape, Token::OID_t &linkH)
Save new object in the container and return its handle.
pool::CREATE
@ CREATE
Definition: Database/APR/StorageSvc/StorageSvc/pool.h:70
pool::DbContainerObj::getOption
DbStatus getOption(DbOption &refOpt)
Access options.
pool::DbContainerObj::update
DbStatus update(DbSelect &sel)
Perform UPDATE select.
pool::DbContainerObj::m_info
IDbContainer * m_info
Pointer to interface of the technology dependent part.
Definition: DbContainerObj.h:55
pool::DbContainerObj::allocate
DbStatus allocate(DbContainer &cntH, const void *object, ShapeH shape, Token::OID_t &oid)
In place allocation of object location.
pool::DbContainerObj::addShape
DbStatus addShape(const DbTypeInfo *typ)
Add persistent type. Returns error if the type is not supported.
pool
pool namespace
Definition: libname.h:15
pool::IDbContainer
Definition: IDbContainer.h:47
pool::DbObjectHandle
Definition: DbContainer.h:37
pool::DbContainerObj::fetch
DbStatus fetch(DbSelect &sel)
Fetch next object address of the selection to set token.
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
pool::DbContainerObj::ObjHandle
DbObjectHandle< DbObject > ObjHandle
Definition: DbContainerObj.h:52
pool::DbContainerObj::cancelTransaction
void cancelTransaction()
Cancel transaction flag.
Definition: DbContainerObj.h:99
pool::Shape
Definition: Shape.h:35
pool::DbContainerObj::free
DbStatus free(void *ptr, DbContainer &cntH)
In place free of raw memory.
pool::UPDATE
@ UPDATE
Definition: Database/APR/StorageSvc/StorageSvc/pool.h:69
pool::DbContainerObj::remove
DbStatus remove(ObjHandle &objH)
Remove the transient representation of the object from memory.
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:96
pool::DbContainerObj::save
DbStatus save(DbObjectHandle< DbObject > &objH, const DbTypeInfo *typ)
Add an object to the container identified by its handle.
pool::ShapeH
const class Shape * ShapeH
Definition: DbContainerObj.h:27
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
DbContainer.h
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
pool::DbType
Definition: DbType.h:31
pool::DbAccessObj< DbObject *, DbObjectHolder >::mode
DbAccessMode mode() const
Access mode.
Definition: DbAccessObj.h:80
pool::DbOption
Definition: DbOption.h:36
sel
sel
Definition: SUSYToolsTester.cxx:97
pool::DbSelect
Definition: DbSelect.h:44
pool::DbContainerObj::allocate
void * allocate(unsigned long siz, DbContainer &cntH, ShapeH shape)
In place allocation of raw memory.
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::updatesPending
bool updatesPending() const
Query the pending transaction stack.
pool::DbContainerObj::destroy
DbStatus destroy(const Token::OID_t &linkH)
Destroy an existing persistent object identified by its handle.
pool::DbContainerObj::info
const IDbContainer * info() const
Access to internals.
Definition: DbContainerObj.h:81
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.
DbObject.h
pool::DbContainerObj::destroy
DbStatus destroy(DbSelect &sel)
Perform DELETE statement.
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:51
pool::DbContainerObj::m_isOpen
bool m_isOpen
Flag indication DbStatus of technology dependent container.
Definition: DbContainerObj.h:61
Guid
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition: Guid.h:20
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:90
pool::DbContainerObj::database
DbDatabase & database()
Handle to Database (CONST)
Definition: DbContainerObj.h:88
pool::DbContainerObj::info
IDbContainer * info()
Definition: DbContainerObj.h:82
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:59
pool::DbTypeInfo
Definition: DbTypeInfo.h:47
pool::DbContainerObj::isOpen
bool isOpen() const
Flag if container was opened.
Definition: DbContainerObj.h:94