Belle II Software development
Mergeable.cc
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#include <framework/pcore/Mergeable.h>
9
10#include <TCollection.h>
11
12using namespace Belle2;
13
14Long64_t Mergeable::Merge(TCollection* hlist)
15{
16 Long64_t nMerged = 0;
17 if (hlist) {
18 const Mergeable* xh = nullptr;
19 TIter nxh(hlist);
20 while ((xh = dynamic_cast<Mergeable*>(nxh()))) {
21 // Add xh to me
22 merge(xh);
23 ++nMerged;
24 }
25 }
26 return nMerged;
27}
Abstract base class for objects that can be merged.
Definition: Mergeable.h:31
virtual Long64_t Merge(TCollection *hlist)
Allow merging using TFileMerger if saved directly to a file.
Definition: Mergeable.cc:14
virtual void merge(const Mergeable *other)=0
Merge object 'other' into this one.
Abstract base class for different kinds of events.