Belle II Software  release-06-00-14
PyDBObj.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 
11 #include <framework/database/DBAccessorBase.h>
12 
13 class TClass;
14 class TObject;
15 
16 namespace Belle2 {
48  class PyDBObj: private DBAccessorBase {
49  public:
51  explicit PyDBObj(const std::string& name, bool required = true);
54  explicit PyDBObj(const TClass* objClass, bool required = true);
57  explicit PyDBObj(const std::string& name, const TClass* objClass, bool required = true);
58 
60  using DBAccessorBase::operator bool;
62 
68  const TObject* _obj() const { return isValid() ? getObject() : nullptr; }
69  };
71 }
Base class for DBObjPtr and DBArray for easier common treatment.
const T * getObject() const
Return a pointer to the Object already cast to the correct type.
bool isValid() const
Check whether a valid object was obtained from the database.
bool hasChanged()
Check whether the object has changed since the last call to hasChanged of the accessor).
Class to access a DBObjPtr from Python.
Definition: PyDBObj.h:48
bool isValid() const
Check whether a valid object was obtained from the database.
PyDBObj(const std::string &name, bool required=true)
Construct the object from the name of the payload.
Definition: PyDBObj.cc:32
const TObject * _obj() const
Return the object.
Definition: PyDBObj.h:68
Abstract base class for different kinds of events.