ATLAS Offline Software
DbContainer.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 // DbContainer handle definitions
7 //--------------------------------------------------------------------
8 //
9 // Package : StorageSvc (The POOL project)
10 // @author M.Frank
11 //====================================================================
12 #ifndef POOL_DBCONTAINER_H
13 #define POOL_DBCONTAINER_H
14 
15 // Framework include files
18 #include "StorageSvc/pool.h"
19 #include "StorageSvc/Transaction.h"
20 
21 #include <cstdint>
22 
23 /*
24  * POOL namespace declaration
25  */
26 namespace pool {
27 
28  // Forward declarations
29  class IDbContainer;
30  class DbSelect;
31  class DbDatabase;
32  class DbTypeInfo;
33  class DbContainerObj;
34  class DbOption;
35 
36  typedef const class Shape *ShapeH;
37 
48  class DbContainer : public DbHandleBase<DbContainerObj> {
49  private:
52 
53  public:
55  explicit DbContainer(const DbType& typ=POOL_StorageType) { m_type=typ; }
57  DbContainer(const DbContainer& c) : Base() { switchPtr(c.m_ptr); }
61  virtual ~DbContainer() { switchPtr(0); }
64  if ( &copy != this ) {
65  m_type = copy.m_type;
66  switchPtr( copy.m_ptr );
67  }
68  return *this;
69  }
71  DbContainer& operator=(const int /* nuller */ ) {
72  switchPtr(0);
73  return *this;
74  }
76  int refCount() const;
78  const std::string& name() const;
86  const IDbContainer* info() const;
89  const DbTypeInfo* objectShape(const Guid& nam);
91  const Token* token() const;
94 
96 
106  const std::string& nam,
107  const DbTypeInfo* typ,
108  const DbType& dbtyp,
109  DbAccessMode mod);
110 
112 
119  const std::string& nam,
120  const DbType& dbtyp);
121 
123  bool isOpen() const;
127  DbStatus setOption(const DbOption& refOpt);
130 
142 
146  DbStatus allocate(const void* object, ShapeH shape, Token::OID_t& oid);
149  DbStatus load(void** ptr, ShapeH shape, const Token::OID_t& lH);
151 
156  DbStatus store(const void* object, const DbTypeInfo* typ);
159  };
160 } // End namespace pool
161 
162 #endif // POOL_DBCONTAINER_H
pool::DbContainer::close
DbStatus close()
Close the container the handle points to.
pool::DbAccessMode
int DbAccessMode
Definition: Database/APR/StorageSvc/StorageSvc/pool.h:34
pool::DbContainer::switchPtr
void switchPtr(DbContainerObj *obj)
Assign transient object properly (including reference counting)
pool::DbStatus
Definition: DbStatus.h:64
Transaction.h
pool::DbContainer::info
const IDbContainer * info() const
Let the implementation access the internals.
pool::DbContainer::setOption
DbStatus setOption(const DbOption &refOpt)
Pass options to the implementation.
pool::DbContainer::select
DbStatus select(DbSelect &sel)
Access objects through select staements.
pool::DbContainer::DbContainer
DbContainer(const DbType &typ=POOL_StorageType)
Constructor with initializing arguments.
Definition: DbContainer.h:55
pool::DbContainer::operator=
DbContainer & operator=(const DbContainer &copy)
Assignment operator.
Definition: DbContainer.h:63
pool
pool namespace
Definition: libname.h:15
pool::DbContainer::token
const Token * token() const
Access the token of the container object.
pool::IDbContainer
Definition: IDbContainer.h:46
pool::DbContainer::getOption
DbStatus getOption(DbOption &refOpt)
Access options.
pool::DbContainer::objectShape
const DbTypeInfo * objectShape(const Guid &nam)
Retrieve persistent type information by name.
pool::DbContainer::operator=
DbContainer & operator=(const int)
Assignment operator to reset the handle easily using 0.
Definition: DbContainer.h:71
ReadBchFromCrest.mod
mod
Definition: ReadBchFromCrest.py:72
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
Token::OID_t
Definition: Token.h:24
pool::ShapeH
const class Shape * ShapeH
Definition: DbContainerObj.h:27
pool::DbContainer::DbContainer
DbContainer(DbContainerObj *ptr)
Constructor taking transient object.
Definition: DbContainer.h:59
pool::DbContainer::size
uint64_t size()
Access to the size of the container.
pool::DbContainer::isOpen
bool isOpen() const
Check if the container was opened.
pool::DbHandleBase< DbContainerObj >::ptr
const DbContainerObj * ptr() const
Access to underlying object.
Definition: DbHandleBase.h:65
pool::DbType
Definition: DbType.h:30
pool::DbContainer::allocate
DbStatus allocate(const void *object, ShapeH shape, Token::OID_t &oid)
Access objects using pointer and shape.
pool::DbOption
Definition: DbOption.h:36
sel
sel
Definition: SUSYToolsTester.cxx:92
pool::DbContainer::containedIn
DbDatabase & containedIn()
Access to the Database the container resides in.
pool::DbContainer::fetch
DbStatus fetch(DbSelect &sel)
Fetch next object address of the selection to set token.
pool::DbSelect
Definition: DbSelect.h:43
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
pool::DbContainer::info
IDbContainer * info()
pool::DbContainer::refCount
int refCount() const
Access reference counter.
pool.h
pool::DbContainer::checkAccess
DbStatus checkAccess(DbDatabase &dbH, const std::string &nam, const DbType &dbtyp)
Check if we can access the residing in <file> container for reading with the given type.
pool::Transaction::Action
Action
Definition: Transaction.h:34
pool::DbContainer::~DbContainer
virtual ~DbContainer()
Standard Destructor.
Definition: DbContainer.h:61
pool::DbContainer::open
DbStatus open(DbDatabase &dbH, const std::string &nam, const DbTypeInfo *typ, const DbType &dbtyp, DbAccessMode mod)
Open the container residing in <file> with given name and access mode.
pool::DbContainer::store
DbStatus store(const void *object, const DbTypeInfo *typ)
Access objects by handle directly.
pool::DbContainer
Definition: DbContainer.h:48
Guid
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition: Guid.h:25
DbHandleBase.h
pool::DbHandleBase
Definition: DbHandleBase.h:31
pool::DbContainer::DbContainer
DbContainer(const DbContainer &c)
Copy constructor.
Definition: DbContainer.h:57
pool::DbContainer::name
const std::string & name() const
Name of the container the handle is supposed to point to.
calibdata.copy
bool copy
Definition: calibdata.py:26
pool::DbHandleBase< DbContainerObj >::m_type
DbType m_type
Data member: Technology type. Sub-classes need access on re-assignment.
Definition: DbHandleBase.h:40
python.PyAthena.obj
obj
Definition: PyAthena.py:132
pool::DbDatabase
Definition: DbDatabase.h:53
pool::DbContainer::load
DbStatus load(void **ptr, ShapeH shape, const Token::OID_t &lH)
Select object in the container identified by its handle.
Token.h
This file contains the class definition for the Token class (migrated from POOL).
pool::DbContainer::openMode
DbAccessMode openMode() const
Mode of the handle (READ,WRITE,...)
python.compressB64.c
def c
Definition: compressB64.py:93
pool::DbTypeInfo
Definition: DbTypeInfo.h:47
pool::DbContainer::transAct
DbStatus transAct(Transaction::Action action)
Execute Database Transaction Action.
python.CaloComputeNoiseConfig.action
action
Definition: CaloComputeNoiseConfig.py:140