ATLAS Offline Software
Loading...
Searching...
No Matches
DbContainerImp.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5//====================================================================
6//
7// Package : StorageSvc (The POOL project)
8//
9// @author M.Frank
10//====================================================================
11#ifndef POOL_DBCONTAINERIMP_H
12#define POOL_DBCONTAINERIMP_H 1
13
16#include "StorageSvc/pool.h"
18#include "POOLCore/DbPrint.h"
19#include "GaudiKernel/StatusCode.h"
20
21// STL include files
22#include <map>
23#include <vector>
24#include <utility>
25
26/*
27 * POOL namespace declaration
28 */
29namespace pool {
30
31 // Forward declarations
32 class IDbContainer;
33
45 class DbContainerImp : virtual public IDbContainer, public APRMessaging
46 {
47 protected:
48
50 struct DbAction {
51 const void* object;
52 const Shape* shape;
54
55 DbAction() : object(nullptr), shape(nullptr) { }
56 DbAction(const void* obj, const Shape* s, const Token::OID_t& l)
57 : object(obj), shape(s), link(l) { }
58
59 const void* dataAtOffset(size_t offset) {
60 return static_cast<const char*>(object) + offset;
61 }
62 };
63
64 typedef std::vector< DbAction > ActionList;
65
66 private:
70 size_t m_size;
71 protected:
73 std::string m_name;
74
76 virtual ~DbContainerImp();
78 virtual StatusCode writeObject(ActionList::value_type& /* entry */)
79 { return StatusCode::FAILURE; }
80
81 virtual StatusCode commitTransaction();
82
83 public:
84 explicit DbContainerImp(const std::string& name);
86 virtual void release() override { delete this; }
88 virtual uint64_t size() override;
90 virtual std::string name() const override
91 { return m_name; }
92
93 virtual uint64_t nextRecordId() override;
95 virtual void useNextRecordId(uint64_t) override {};
97 virtual StatusCode close() override;
98
100
104 virtual StatusCode getOption(DbOption& opt) override;
105
107
111 virtual StatusCode setOption(const DbOption& opt) override;
112
114 virtual StatusCode transAct(Transaction::Action) override;
116 virtual StatusCode store( const void* object,
117 DbContainer& cntH,
118 ShapeH shape) override;
120 virtual StatusCode allocate(DbContainer& cntH,
121 const void* object,
122 ShapeH shape,
123 Token::OID_t& oid) override;
125 virtual StatusCode next(Token::OID_t& linkH) override;
126
128
137 virtual StatusCode load( void** ptr, ShapeH shape,
138 const Token::OID_t& lnkH,
139 Token::OID_t& oid,
140 bool any_next) override;
141
143
149 virtual StatusCode loadObject(void** ptr, ShapeH shape, Token::OID_t& oid) = 0;
150
151 };
152} // End namespace pool
153#endif // POOL_DBCONTAINERIMP_H
This file contains the class definition for the Token class (migrated from POOL).
APRMessaging(const std::string &name)
virtual StatusCode writeObject(ActionList::value_type &)
Commit single entry to container.
virtual StatusCode load(void **ptr, ShapeH shape, const Token::OID_t &lnkH, Token::OID_t &oid, bool any_next) override
Find object within the container and load it into memory.
virtual StatusCode loadObject(void **ptr, ShapeH shape, Token::OID_t &oid)=0
Find object by object identifier and load it into memory.
ActionList m_writeStack
Transaction fifo storage for writing.
virtual StatusCode next(Token::OID_t &linkH) override
Fetch next object address to set token.
virtual StatusCode setOption(const DbOption &opt) override
Set options.
virtual StatusCode transAct(Transaction::Action) override
Execute Transaction Action.
virtual uint64_t size() override
Size of the container.
virtual void useNextRecordId(uint64_t) override
Suggest next Record ID for tbe next object written - used only with synced indexes.
virtual StatusCode close() override
Close the container and deallocate resources.
virtual StatusCode allocate(DbContainer &cntH, const void *object, ShapeH shape, Token::OID_t &oid) override
In place allocation of object location.
virtual StatusCode getOption(DbOption &opt) override
Access options.
std::string m_name
Container name.
size_t m_size
Current size of the transaction stack.
virtual uint64_t nextRecordId() override
Number of next record in the container (=size if no delete is allowed)
virtual void release() override
Release instance (Abstract interfaces do not expose destructor!)
virtual StatusCode store(const void *object, DbContainer &cntH, ShapeH shape) override
Store object in location.
virtual StatusCode commitTransaction()
Execute object modification requests during a transaction.
virtual std::string name() const override
Get container name.
DbContainerImp(const std::string &name)
virtual ~DbContainerImp()
Standard destructor.
std::vector< DbAction > ActionList
Description: Definition of the object describing a database container Handle managing a DbContainerOb...
Definition DbContainer.h:49
Description: Definition an option to be supplied to database objects.
Definition DbOption.h:37
Description:
Definition Shape.h:35
pool namespace
Definition libname.h:15
const class Shape * ShapeH
DbAction(const void *obj, const Shape *s, const Token::OID_t &l)
const void * dataAtOffset(size_t offset)