ATLAS Offline Software
Loading...
Searching...
No Matches
DbHandleBase.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// Pool Handle Base class definitions
7//--------------------------------------------------------------------
8//
9// Package : StorageSvc (The POOL project)
10// @author M.Frank
11//====================================================================
12#ifndef POOL_DBHANDLEBASE_H
13#define POOL_DBHANDLEBASE_H 1
14
15// Framework include files
16#include "StorageSvc/DbType.h"
17
18/*
19 * POOL namespace declaration
20 */
21namespace pool {
22
31 template <class T> class DbHandleBase {
32 protected:
34 typedef T _DataType;
41
43 ~DbHandleBase() { m_type.check(); }
45 DbHandleBase() : m_ptr(0), m_type(0) { }
46
47 // Copy/move handled by derived classes.
48 DbHandleBase (const DbHandleBase&) = delete;
52
54 void setType(const DbType& typ) { m_type=typ; }
56 void setPtr(T* ptr) { m_ptr=ptr; }
57
58 public:
60 T* operator->() { return m_ptr; }
61 const T* operator->() const { return m_ptr; }
63 bool operator!() const { return !isValid(); }
65 const T* ptr() const { return m_ptr; }
66 T* ptr() { return m_ptr; }
68 bool isValid() const { return 0 != m_ptr; }
70 const DbType& type() const { return m_type; }
71 };
72} // End namespace pool
73#endif // POOL_DBHANDLEBASE_H
const _DataType * ptr() const
T _DataType
Data type definition.
~DbHandleBase()
Standard destructor.
bool isValid() const
Validity check (Objy like)
T * operator->()
Dereference operator.
void setPtr(T *ptr)
Set data pointer.
void setType(const DbType &typ)
Set handle type.
DbHandleBase & operator=(const DbHandleBase &)=delete
DbHandleBase(const DbHandleBase &)=delete
DbHandleBase()
Standard constructor.
const T * operator->() const
bool operator!() const
Validity check through operator NOT.
const DbType & type() const
Inquire storage type of the handle.
DbHandleBase(DbHandleBase &&)=delete
DbHandleBase< _DataType > Base
Data type definition.
pool namespace
Definition libname.h:15