Belle II Software development
PyDBArray.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 {
43 class PyDBArray: private DBAccessorBase {
44 public:
46 explicit PyDBArray(const std::string& name, bool required = true);
49 explicit PyDBArray(const TClass* objClass, bool required = true);
52 explicit PyDBArray(const std::string& name, const TClass* objClass, bool required = true);
53
55 using DBAccessorBase::operator bool;
57
59 int getEntries() const;
61 int __len__() const { return getEntries(); }
62
67 const TObject* _get(int i) const;
68
70 PyObject* getIntraRunBoundariesList() const;
71 };
73}
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).
Class to access a DB Array from Python.
Definition: PyDBArray.h:43
PyObject * getIntraRunBoundariesList() const
Get the intra-run boundaries, if any, as a python list.
Definition: PyDBArray.cc:51
const TObject * _get(int i) const
Element access.
Definition: PyDBArray.cc:34
int __len__() const
Get the number of entries in a pythonic way to enable len(array)
Definition: PyDBArray.h:61
int getEntries() const
Get the number of entries.
Definition: PyDBArray.cc:39
Abstract base class for different kinds of events.