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#ifndef STORAGESVC_DBCONTAINER_H
5#define STORAGESVC_DBCONTAINER_H
6
7// Framework include files
10#include "StorageSvc/pool.h"
11
12#include <cstdint>
13
14class StatusCode;
15
16// Forward declarations
17class ITechContainer;
18class DbDatabase;
19class DbTypeInfo;
20class DbContainerObj;
21class DbOption;
22
31class DbContainer : public DbHandleBase<DbContainerObj> {
32 private:
35
36 public:
38 explicit DbContainer(const DbType& typ=pool::POOL_StorageType) { m_type=typ; }
40 DbContainer(const DbContainer& c) : Base() { switchPtr(c.m_ptr); }
44 virtual ~DbContainer() { switchPtr(0); }
47 if ( &copy != this ) {
48 m_type = copy.m_type;
49 switchPtr( copy.m_ptr );
50 }
51 return *this;
52 }
53
54 DbContainer& operator=(const int /* nuller */ ) {
55 switchPtr(0);
56 return *this;
57 }
58
59 int refCount() const;
61 const std::string& name() const;
63 Io::IoFlag openMode() const;
65 uint64_t size();
69 const ITechContainer* info() const;
72 const DbTypeInfo* objectShape(const Guid& nam);
74 const Token* token() const;
76 StatusCode close();
77
79
88 StatusCode open(DbDatabase& dbH,
89 const std::string& nam,
90 const DbTypeInfo* typ,
91 const DbType& dbtyp,
92 Io::IoFlag mod);
93
95
101 StatusCode checkAccess(DbDatabase& dbH,
102 const std::string& nam,
103 const DbType& dbtyp);
104
106 bool isOpen() const;
108 StatusCode transAct(Transaction::Action action);
110 StatusCode setOption(const DbOption& refOpt);
112 StatusCode getOption(DbOption& refOpt);
113
120
121 StatusCode next(Token::OID_t& linkH);
123
127
128 StatusCode allocate(const void* object, const DbTypeInfo* tinfo, Token::OID_t& oid);
130 StatusCode load(void** ptr, const DbTypeInfo* tinfo, const Token::OID_t& lH);
132
137
138 StatusCode store(const void* object, const DbTypeInfo* typ);
140};
141
142#endif
This file contains the class definition for the Token class (migrated from POOL).
Description:
DbContainer(const DbType &typ=pool::POOL_StorageType)
Constructor with initializing arguments.
Definition DbContainer.h:38
StatusCode store(const void *object, const DbTypeInfo *typ)
Access objects by handle directly.
const ITechContainer * info() const
Let the implementation access the internals.
StatusCode close()
Close the container the handle points to.
StatusCode open(DbDatabase &dbH, const std::string &nam, const DbTypeInfo *typ, const DbType &dbtyp, Io::IoFlag mod)
Open the container residing in <file> with given name and access mode.
StatusCode next(Token::OID_t &linkH)
Access objects through select staements.
DbContainer(DbContainerObj *ptr)
Constructor taking transient object.
Definition DbContainer.h:42
int refCount() const
Access reference counter.
const Token * token() const
Access the token of the container object.
StatusCode allocate(const void *object, const DbTypeInfo *tinfo, Token::OID_t &oid)
Access objects using pointer and shape.
StatusCode setOption(const DbOption &refOpt)
Pass options to the implementation.
void switchPtr(DbContainerObj *obj)
Assign transient object properly (including reference counting).
StatusCode transAct(Transaction::Action action)
Execute Database Transaction Action.
ITechContainer * info()
uint64_t size()
Access to the size of the container.
DbContainer(const DbContainer &c)
Copy constructor.
Definition DbContainer.h:40
const std::string & name() const
Name of the container the handle is supposed to point to.
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.
Io::IoFlag openMode() const
Mode of the handle (READ,WRITE,...).
DbContainer & operator=(const int)
Assignment operator to reset the handle easily using 0.
Definition DbContainer.h:54
const DbTypeInfo * objectShape(const Guid &nam)
Retrieve persistent type information by name.
DbDatabase & containedIn()
Access to the Database the container resides in.
DbContainer & operator=(const DbContainer &copy)
Assignment operator.
Definition DbContainer.h:46
bool isOpen() const
Check if the container was opened.
StatusCode load(void **ptr, const DbTypeInfo *tinfo, const Token::OID_t &lH)
Select object in the container identified by its handle.
StatusCode getOption(DbOption &refOpt)
Access options.
virtual ~DbContainer()
Standard Destructor.
Definition DbContainer.h:44
Description: Handle managing a DbDatabaseObj, a generic Database object.
Definition DbDatabase.h:39
DbHandleBase< _DataType > Base
const DbContainerObj * ptr() const
Description: Definition an option to be supplied to database objects.
Definition DbOption.h:22
Definition of class DbTypeInfo.
Definition DbTypeInfo.h:31
Keeps information about storage technology.
Definition DbType.h:15
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition Guid.h:25
Description: Interface to the technology specific implementation of the Container object.
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition Token.h:22
::StatusCode StatusCode
StatusCode definition for legacy code.
static const DbType POOL_StorageType
Definition DbType.h:71