ATLAS Offline Software
Loading...
Searching...
No Matches
DbContainer.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// 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
20#include <cstdint>
21
22class StatusCode;
23
24/*
25 * POOL namespace declaration
26 */
27namespace pool {
28
29 // Forward declarations
30 class IDbContainer;
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 }
70
71 DbContainer& operator=(const int /* nuller */ ) {
72 switchPtr(0);
73 return *this;
74 }
75
76 int refCount() const;
78 const std::string& name() const;
82 uint64_t size();
86 const IDbContainer* info() const;
89 const DbTypeInfo* objectShape(const Guid& nam);
91 const Token* token() const;
93 StatusCode close();
94
96
105 StatusCode open(DbDatabase& dbH,
106 const std::string& nam,
107 const DbTypeInfo* typ,
108 const DbType& dbtyp,
109 DbAccessMode mod);
110
112
118 StatusCode checkAccess(DbDatabase& dbH,
119 const std::string& nam,
120 const DbType& dbtyp);
121
123 bool isOpen() const;
125 StatusCode transAct(Transaction::Action action);
127 StatusCode setOption(const DbOption& refOpt);
129 StatusCode getOption(DbOption& refOpt);
130
137
138 StatusCode next(Token::OID_t& linkH);
140
144
145 StatusCode allocate(const void* object, ShapeH shape, Token::OID_t& oid);
147 StatusCode load(void** ptr, ShapeH shape, const Token::OID_t& lH);
149
154
155 StatusCode store(const void* object, const DbTypeInfo* typ);
157 };
158} // End namespace pool
159
160#endif // POOL_DBCONTAINER_H
This file contains the class definition for the Token class (migrated from POOL).
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition Token.h:21
StatusCode transAct(Transaction::Action action)
Execute Database Transaction Action.
StatusCode allocate(const void *object, ShapeH shape, Token::OID_t &oid)
Access objects using pointer and shape.
StatusCode getOption(DbOption &refOpt)
Access options.
StatusCode store(const void *object, const DbTypeInfo *typ)
Access objects by handle directly.
StatusCode close()
Close the container the handle points to.
const DbTypeInfo * objectShape(const Guid &nam)
Retrieve persistent type information by name.
StatusCode 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.
StatusCode load(void **ptr, ShapeH shape, const Token::OID_t &lH)
Select object in the container identified by its handle.
DbContainer & operator=(const int)
Assignment operator to reset the handle easily using 0.
Definition DbContainer.h:71
DbContainer(const DbType &typ=POOL_StorageType)
Constructor with initializing arguments.
Definition DbContainer.h:55
const Token * token() const
Access the token of the container object.
DbAccessMode openMode() const
Mode of the handle (READ,WRITE,...)
int refCount() const
Access reference counter.
DbContainer(DbContainerObj *ptr)
Constructor taking transient object.
Definition DbContainer.h:59
uint64_t size()
Access to the size of the container.
StatusCode setOption(const DbOption &refOpt)
Pass options to the implementation.
IDbContainer * info()
const std::string & name() const
Name of the container the handle is supposed to point to.
StatusCode next(Token::OID_t &linkH)
Access objects through select staements.
void switchPtr(DbContainerObj *obj)
Assign transient object properly (including reference counting)
DbDatabase & containedIn()
Access to the Database the container resides in.
bool isOpen() const
Check if the container was opened.
virtual ~DbContainer()
Standard Destructor.
Definition DbContainer.h:61
const IDbContainer * info() const
Let the implementation access the internals.
DbContainer & operator=(const DbContainer &copy)
Assignment operator.
Definition DbContainer.h:63
DbContainer(const DbContainer &c)
Copy constructor.
Definition DbContainer.h:57
StatusCode 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.
Description: Handle managing a DbDatabaseObj, a generic Database object.
Definition DbDatabase.h:54
const DbContainerObj * ptr() const
DbHandleBase< _DataType > Base
Description: Definition an option to be supplied to database objects.
Definition DbOption.h:36
Definition of class DbTypeInfo.
Definition DbTypeInfo.h:49
Description:
Definition Shape.h:35
Framework include files.
Definition libname.h:15
const class Shape * ShapeH
static const DbType POOL_StorageType
Definition DbType.h:84