ATLAS Offline Software
Loading...
Searching...
No Matches
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"
20
21#include <cstdint>
22
23/*
24 * POOL namespace declaration
25 */
26namespace pool {
27
28 // Forward declarations
29 class IDbContainer;
30 class DbDatabase;
31 class DbTypeInfo;
32 class DbContainerObj;
33 class DbOption;
34
35 typedef const class Shape *ShapeH;
36
47 class DbContainer : public DbHandleBase<DbContainerObj> {
48 private:
51
52 public:
54 explicit DbContainer(const DbType& typ=POOL_StorageType) { m_type=typ; }
56 DbContainer(const DbContainer& c) : Base() { switchPtr(c.m_ptr); }
60 virtual ~DbContainer() { switchPtr(0); }
63 if ( &copy != this ) {
64 m_type = copy.m_type;
65 switchPtr( copy.m_ptr );
66 }
67 return *this;
68 }
69
70 DbContainer& operator=(const int /* nuller */ ) {
71 switchPtr(0);
72 return *this;
73 }
74
75 int refCount() const;
77 const std::string& name() const;
81 uint64_t size();
85 const IDbContainer* info() const;
88 const DbTypeInfo* objectShape(const Guid& nam);
90 const Token* token() const;
93
95
105 const std::string& nam,
106 const DbTypeInfo* typ,
107 const DbType& dbtyp,
108 DbAccessMode mod);
109
111
118 const std::string& nam,
119 const DbType& dbtyp);
120
122 bool isOpen() const;
129
136
139
143
144 DbStatus allocate(const void* object, ShapeH shape, Token::OID_t& oid);
146 DbStatus load(void** ptr, ShapeH shape, const Token::OID_t& lH);
148
153
154 DbStatus store(const void* object, const DbTypeInfo* typ);
156 };
157} // End namespace pool
158
159#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
DbStatus close()
Close the container the handle points to.
const DbTypeInfo * objectShape(const Guid &nam)
Retrieve persistent type information by name.
DbStatus next(Token::OID_t &linkH)
Access objects through select staements.
DbContainer & operator=(const int)
Assignment operator to reset the handle easily using 0.
Definition DbContainer.h:70
DbContainer(const DbType &typ=POOL_StorageType)
Constructor with initializing arguments.
Definition DbContainer.h:54
DbStatus getOption(DbOption &refOpt)
Access options.
const Token * token() const
Access the token of the container object.
DbStatus setOption(const DbOption &refOpt)
Pass options to the implementation.
DbAccessMode openMode() const
Mode of the handle (READ,WRITE,...)
DbStatus transAct(Transaction::Action action)
Execute Database Transaction Action.
int refCount() const
Access reference counter.
DbContainer(DbContainerObj *ptr)
Constructor taking transient object.
Definition DbContainer.h:58
uint64_t size()
Access to the size of the container.
IDbContainer * info()
const std::string & name() const
Name of the container the handle is supposed to point to.
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.
DbStatus load(void **ptr, ShapeH shape, const Token::OID_t &lH)
Select object in the container identified by its handle.
virtual ~DbContainer()
Standard Destructor.
Definition DbContainer.h:60
DbStatus allocate(const void *object, ShapeH shape, Token::OID_t &oid)
Access objects using pointer and shape.
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.
DbStatus store(const void *object, const DbTypeInfo *typ)
Access objects by handle directly.
const IDbContainer * info() const
Let the implementation access the internals.
DbContainer & operator=(const DbContainer &copy)
Assignment operator.
Definition DbContainer.h:62
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.
DbContainer(const DbContainer &c)
Copy constructor.
Definition DbContainer.h:56
Description: Handle managing a DbDatabaseObj, a generic Database object.
Definition DbDatabase.h:53
const DbContainerObj * ptr() const
DbHandleBase< _DataType > Base
Description: Definition an option to be supplied to database objects.
Definition DbOption.h:36
This class is highly inspired by the error code distribution system as it is used in DEC/VMS or MS/WN...
Definition DbStatus.h:64
Definition of class DbTypeInfo.
Definition DbTypeInfo.h:47
Description:
Definition Shape.h:35
pool namespace
Definition libname.h:15
const class Shape * ShapeH
static const DbType POOL_StorageType
Definition DbType.h:98