 |
Belle II Software
release-05-02-19
|
12 #include <framework/database/DBImportBase.h>
13 #include <framework/utilities/ArrayIterator.h>
14 #include <TClonesArray.h>
27 template<
class T>
class DBImportArray:
public DBImportBase {
31 typedef ObjArrayIterator<TClonesArray, T>
iterator;
33 typedef ObjArrayIterator<const TClonesArray, const T>
const_iterator;
42 m_object =
new TClonesArray(T::Class());
58 return static_cast<TClonesArray*
>(
m_object)->GetEntriesFast();
82 template<
class ...Args> T*
appendNew(Args&& ... params)
95 TObject* obj =
static_cast<TClonesArray*
>(
m_object)->At(i);
97 throw std::out_of_range(
"Out-of-range access in DBImportArray::operator[], for "
100 return static_cast<T*
>(obj);
130 m_object =
new TClonesArray(T::Class());
140 m_object =
new TClonesArray(T::Class());
150 m_object =
new TClonesArray(T::Class());
156 void clear()
override
159 m_object =
new TClonesArray(T::Class());
DBImportArray(const std::string &name="")
Constructor.
void addEventDependency(unsigned int eventNumber) override
add event dependency
T * appendNew()
Construct a new T object at the end of the array.
Base class for importing objects to the database.
int getEntries() const
Returns number of objects in the array.
ObjArrayIterator< const TClonesArray, const T > const_iterator
STL-like const_iterator over the T objects (not T* ).
void addIntraRunDependency(unsigned long long int tag, EIntraRunDependency type)
add intra run dependency
ObjArrayIterator< TClonesArray, T > iterator
STL-like iterator over the T objects (not T* ).
T * operator[](int i) const
Access to the stored objects.
Singleton class to cache database objects.
Abstract base class for different kinds of events.
~DBImportArray()
Destructor.
void addSubrunDependency(int subrun) override
add subrun dependency
iterator end()
Returns iterator to last entry +1.
iterator begin()
Returns iterator to first entry.
TObject * m_object
pointer to allocated object or array
T * nextFreeAdress()
Returns address of the next free position of the array.
void addTimeStampDependency(unsigned long long int timeStamp) override
add time stamp dependency
const std::string & getName() const
Returns the name under which the object will be stored in the database.
void clear() override
Clear the content, e.g.
virtual void clear()
Clear the content, e.g.