ATLAS Offline Software
Loading...
Searching...
No Matches
DbHandleBase.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 DBHANDLEBASE_H
5#define DBHANDLEBASE_H 1
6
7// Framework include files
8#include "StorageSvc/DbType.h"
9
17template <class T> class DbHandleBase {
18 protected:
20 typedef T _DataType;
27
29 ~DbHandleBase() = default;
31 DbHandleBase() : m_ptr(0), m_type(0) { }
32
33 // Copy/move handled by derived classes.
34 DbHandleBase (const DbHandleBase&) = delete;
38
40 void setType(const DbType& typ) { m_type=typ; }
42 void setPtr(T* ptr) { m_ptr=ptr; }
43
44 public:
46 T* operator->() { return m_ptr; }
47 const T* operator->() const { return m_ptr; }
49 bool operator!() const { return !isValid(); }
51 const T* ptr() const { return m_ptr; }
52 T* ptr() { return m_ptr; }
54 bool isValid() const { return 0 != m_ptr; }
56 const DbType& type() const { return m_type; }
57};
58
59#endif
bool isValid() const
Validity check (Objy like).
DbHandleBase()
Standard constructor.
DbHandleBase(const DbHandleBase &)=delete
DbHandleBase< _DataType > Base
Data type definition.
T * operator->()
Dereference operator.
const DbType & type() const
Inquire storage type of the handle.
const _DataType * ptr() const
T _DataType
Data type definition.
DbHandleBase & operator=(const DbHandleBase &)=delete
bool operator!() const
Validity check through operator NOT.
const T * operator->() const
~DbHandleBase()=default
Standard destructor.
DbHandleBase(DbHandleBase &&)=delete
void setType(const DbType &typ)
Set handle type.
void setPtr(T *ptr)
Set data pointer.
Keeps information about storage technology.
Definition DbType.h:15