Belle II Software  release-05-02-19
PyDBArray.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 {
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 }
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::PyDBArray::__len__
int __len__() const
Get the number of entries in a pythonic way to enable len(array)
Definition: PyDBArray.h:61
Belle2::PyDBArray::getEntries
int getEntries() const
Get the number of entries.
Definition: PyDBArray.cc:41
Belle2::DBAccessorBase
Base class for DBObjPtr and DBArray for easier common treatment.
Definition: DBAccessorBase.h:28
Belle2::PyDBArray::_get
const TObject * _get(int i) const
Element access.
Definition: PyDBArray.cc:36
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::DBAccessorBase::isValid
bool isValid() const
Check whether a valid object was obtained from the database.
Definition: DBAccessorBase.h:75
Belle2::PyDBArray
Class to access a DB Array from Python.
Definition: PyDBArray.h:43
Belle2::PyDBArray::PyDBArray
PyDBArray(const std::string &name, bool required=true)
Construct the array from the name of the payload.
Definition: PyDBArray.cc:46