Belle II Software  release-06-02-00
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 class TClass;
14 class TObject;
15 
16 namespace Belle2 {
41  class PyDBArray: private DBAccessorBase {
42  public:
44  explicit PyDBArray(const std::string& name, bool required = true);
47  explicit PyDBArray(const TClass* objClass, bool required = true);
50  explicit PyDBArray(const std::string& name, const TClass* objClass, bool required = true);
51 
53  using DBAccessorBase::operator bool;
55 
57  int getEntries() const;
59  int __len__() const { return getEntries(); }
60 
65  const TObject* _get(int i) const;
66  };
68 }
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:41
PyDBArray(const std::string &name, bool required=true)
Construct the array from the name of the payload.
Definition: PyDBArray.cc:44
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:59
int getEntries() const
Get the number of entries.
Definition: PyDBArray.cc:39
Abstract base class for different kinds of events.