ATLAS Offline Software
Loading...
Searching...
No Matches
DbDatabaseObj.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// DbDatabaseObj object definition
7//--------------------------------------------------------------------
8//
9// Package : System (The POOL project)
10//
11// Description: Generic data persistency
12//
13// @author M.Frank
14//====================================================================
15#ifndef POOL_DBDATABASEOBJ_H
16#define POOL_DBDATABASEOBJ_H 1
17
18// We need the definition of the domain for defining the Database
21#include "StorageSvc/DbDomain.h"
24#include "POOLCore/DbPrint.h"
25
26// STL include files
27#include <map>
28#include <string>
29#include <vector>
30
31
32/*
33 * POOL namespace declaration
34 */
35namespace pool {
36
47 class DbDatabaseObj : public DbAccessObj<std::string, DbContainerObj >, public APRMessaging {
48 private:
50 typedef RootType TypeH;
52 typedef std::pair<std::string, std::string> Parameter;
54 typedef std::vector< Parameter > Parameters;
56 typedef std::vector< DbContainerObj > Containers;
58 typedef std::map<std::string, std::string> ParamMap;
60 typedef std::map< Guid , Token* > LinkMap;
62 typedef std::vector<Token*> LinkVector;
64 typedef std::map< Guid , const DbTypeInfo* > ShapeMap;
66 typedef std::map< long long int , int > IndexMap;
69
91 std::map<TypeH, const DbTypeInfo*> m_classMap;
97 std::string m_logon;
102
103 private:
106 public:
109 const std::string& pfn,
110 const std::string& fid,
113 virtual ~DbDatabaseObj();
115 const std::string& logon() const { return m_logon; }
117 long long int size();
119 IDbDatabase* info() { return m_info; }
120 const IDbDatabase* info() const { return m_info; }
122 DbDomain& domain() { return m_dom; }
123 const DbDomain& domain() const { return m_dom; }
125 int age() const { return m_fileAge; }
127 const Token* token() const { return m_token; }
128
139
141 DbStatus read(const Token& token, ShapeH shape, void** object);
143 DbStatus getLink(const Token::OID_t& oid, Token* pTok);
145 std::string cntName(Token& token);
149 const DbTypeInfo* objectShape(const TypeH& classH);
151 const DbTypeInfo* objectShape(const Guid& nam);
153 const DbTypeInfo* contShape(const std::string& nam);
157 const Token* cntToken(const std::string& cntName);
159 DbStatus containers(std::vector<const Token*>& conts, bool intern);
160 DbStatus containers(std::vector<IDbContainer*>& conts, bool intern);
162 DbStatus associations(std::vector<const Token*>& conts);
164 DbStatus shapes(std::vector<const DbTypeInfo*>& shaps);
166 int nParam();
168 DbStatus addParam(const std::string& nam, const std::string& val);
170 DbStatus param(const std::string& nam, std::string& val);
172 DbStatus params(std::vector< std::pair<std::string, std::string> >& vals);
177
179 void setAge(int value);
180 };
181} // End namespace pool
182#endif // POOL_DBDATABASEOBJ_H
This file contains the class definition for the Guid class (migrated from POOL).
TTypeAdapter RootType
Definition RootType.h:211
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition Token.h:21
APRMessaging(const std::string &name)
DbAccessObj(const std::string &n, DbAccessMode m, const DbType &t, IOODatabase *s=0)
Definition DbAccessObj.h:70
Description: Definition of the object describing a database container Handle managing a DbContainerOb...
Definition DbContainer.h:48
IDbDatabase * info()
Access to technology dependent implementation.
DbStatus containers(std::vector< const Token * > &conts, bool intern)
Allow access to all known containers.
DbStatus getOption(DbOption &refOpt)
Access options.
DbStatus addParam(const std::string &nam, const std::string &val)
Add a persistent parameter to the file.
DbStatus retire()
End database access, but still leave database accessible.
int nParam()
Retrieve the number of user parameters.
std::vector< Token * > LinkVector
Definition of array with link elements.
Containers m_retiredConts
Collection of retired database containers.
DbDatabaseObj(DbDomain &dom, const std::string &pfn, const std::string &fid, DbAccessMode mode=pool::READ)
Standard constructor of a Database obejct.
int age() const
Access age value.
DbStatus cleanup()
Perform cleanup of internal data structures.
std::map< std::string, std::string > ParamMap
Parameter map definition.
DbStatus setOption(const DbOption &refOpt)
Set options.
DbStatus close()
Close database object.
LinkMap m_linkMap
Map containing all links.
ParamMap m_paramMap
Map with all cached file properties.
DbStatus makeLink(Token *pToken, Token::OID_t &refLink)
Add association link to link container.
int m_fileAge
File age counter.
long long int size()
Access the size of the database: May be undefined for some technologies.
const DbTypeInfo * contShape(const std::string &nam)
Retrieve persistent type information by container.
std::map< long long int, int > IndexMap
Definition of map with index elements.
IDbDatabase * m_info
Technology dependent implementation block.
std::string m_logon
Physical Database login.
virtual ~DbDatabaseObj()
Standard Destructor.
DbAccessObj< std::string, DbContainerObj > Base
Base class convenience typdef.
DbDomain m_dom
Handle to domain.
DbStatus params(std::vector< std::pair< std::string, std::string > > &vals)
Retrieve all parameters.
const Token * token() const
Access the token of the database object.
DbContainer m_params
Handle to the parameter container.
std::vector< DbContainerObj > Containers
Collection of retired database containers.
DbStatus shapes(std::vector< const DbTypeInfo * > &shaps)
Allow access to all known shapes used by the database.
const DbTypeInfo * m_string_t
Internal string representation type.
DbStatus reopen(DbAccessMode mode)
Re-open database with changing access permissions.
DbStatus open()
Open Database object.
DbStatus containers(std::vector< IDbContainer * > &conts, bool intern)
DbStatus associations(std::vector< const Token * > &conts)
Allow access to all known associations between containers.
std::map< TypeH, const DbTypeInfo * > m_classMap
Map with all cached mappings between known reflection classes.
DbDomain & domain()
Access to domain handle (CONST)
DbStatus transAct(Transaction::Action action)
Execute Database Transaction action.
std::map< Guid, const DbTypeInfo * > ShapeMap
Definition of map with shape elements.
LinkVector m_linkVec
Random access array containing all links.
ShapeMap m_shapeMap
Map containing all shapes.
const DbTypeInfo * objectShape(const TypeH &classH)
Retrieve persistent type information by class handle.
IndexMap m_indexMap
Map containing all index.
std::string cntName(Token &token)
Retrieve container name from link container (using token oid, rather than contID)
const IDbDatabase * info() const
const DbDomain & domain() const
std::vector< Parameter > Parameters
Database parameter container definition.
Token * m_token
Token describing the object.
std::map< Guid, Token * > LinkMap
Definition of map with link elements.
const DbTypeInfo * objectShape(const Guid &nam)
Retrieve persistent type information by shape identifier.
const std::string & logon() const
Access to the logon string.
DbStatus read(const Token &token, ShapeH shape, void **object)
read an object referenced by the token
std::pair< std::string, std::string > Parameter
Database parameter definition.
DbContainer m_links
Handle to link container.
DbStatus addShape(const DbTypeInfo *pType)
Add persistent type to the Database.
DbStatus getLink(const Token::OID_t &oid, Token *pTok)
Expand OID into a full Token, based on the Links table.
void setAge(int value)
Update database age.
const Token * cntToken(const std::string &cntName)
Access local container token (if container exists)
DbStatus param(const std::string &nam, std::string &val)
Retrieve existing parameter by name.
RootType TypeH
Reflection class identifier.
DbContainer m_shapes
Handle to shapes container.
Description:
Definition DbDomain.h:47
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
IDbDatabase interface.
Definition IDbDatabase.h:41
pool namespace
Definition libname.h:15
const class Shape * ShapeH