Belle II Software development
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#include <Python.h>
14
15class TClass;
16class TObject;
17
18namespace 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 PyObject* getIntraRunBoundariesList() const;
74 };
76}
Base class for DBObjPtr and DBArray for easier common treatment.
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).
const T * getObject() const
Return a pointer to the Object already cast to the correct type.
Class to access a DBObjPtr from Python.
Definition: PyDBObj.h:50
PyObject * getIntraRunBoundariesList() const
Get the intra-run boundaries, if any, as a python list.
Definition: PyDBObj.cc:38
bool isValid() const
Check whether a valid object was obtained from the database.
const TObject * _obj() const
Return the object.
Definition: PyDBObj.h:70
Abstract base class for different kinds of events.