Belle II Software  release-05-02-19
PyDBObj.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2012-2017 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Martin Ritter *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <framework/database/DBAccessorBase.h>
14 
15 class TClass;
16 class TObject;
17 
18 namespace Belle2 {
50  class PyDBObj: private DBAccessorBase {
51  public:
53  explicit PyDBObj(const std::string& name, bool required = true);
56  explicit PyDBObj(const TClass* objClass, bool required = true);
59  explicit PyDBObj(const std::string& name, const TClass* objClass, bool required = true);
60 
62  using DBAccessorBase::operator bool;
64 
70  const TObject* _obj() const { return isValid() ? getObject() : nullptr; }
71  };
73 }
Belle2::DBAccessorBase::hasChanged
bool hasChanged()
Check whether the object has changed since the last call to hasChanged of the accessor).
Definition: DBAccessorBase.h:92
Belle2::DBAccessorBase::getObject
const T * getObject() const
Return a pointer to the Object already cast to the correct type.
Definition: DBAccessorBase.h:155
Belle2::PyDBObj::_obj
const TObject * _obj() const
Return the object.
Definition: PyDBObj.h:70
Belle2::DBAccessorBase
Base class for DBObjPtr and DBArray for easier common treatment.
Definition: DBAccessorBase.h:28
Belle2::PyDBObj::PyDBObj
PyDBObj(const std::string &name, bool required=true)
Construct the object from the name of the payload.
Definition: PyDBObj.cc:34
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::PyDBObj
Class to access a DBObjPtr from Python.
Definition: PyDBObj.h:50
Belle2::DBAccessorBase::isValid
bool isValid() const
Check whether a valid object was obtained from the database.
Definition: DBAccessorBase.h:75