Belle II Software development
MergeableNamed Class Referenceabstract

Abstract base class for objects that can be merged but also named. More...

#include <MergeableNamed.h>

Inheritance diagram for MergeableNamed:
MilleData

Public Member Functions

virtual void merge (const MergeableNamed *other)=0
 Merge object 'other' into this one.
 
virtual void clear ()=0
 Clear content of this object (e.g. set to zeroes). Called by the Reset() function.
 
virtual Long64_t Merge (TCollection *hlist)
 Allow merging using TFileMerger if saved directly to a file.
 
virtual void Reset ()
 Root-like Reset function for "template compatibility" with ROOT objects.
 
virtual void SetDirectory (TDirectory *)
 Root-like Clone function for "template compatibility" with ROOT objects.
 

Private Member Functions

 ClassDef (MergeableNamed, 0)
 Abstract base class for objects that can be merged and named.
 

Detailed Description

Abstract base class for objects that can be merged but also named.

Mostly copied from framework/pcore/Mergeable.h

This is mainly intended to be a base class for custom objects we save via the CAF. We do less TDirectory/TFile management here compared to Mergeable since we aren't using the datastore and don't need to disconnect from TFiles etc. We'll be explicitly managing that in the CAF (see CalibObjManager).

Definition at line 29 of file MergeableNamed.h.

Constructor & Destructor Documentation

◆ MergeableNamed()

MergeableNamed ( )
inline

Definition at line 31 of file MergeableNamed.h.

31: TNamed() { }

◆ ~MergeableNamed()

virtual ~MergeableNamed ( )
inlinevirtual

Definition at line 32 of file MergeableNamed.h.

32{ }

Member Function Documentation

◆ clear()

virtual void clear ( )
pure virtual

Clear content of this object (e.g. set to zeroes). Called by the Reset() function.

Implemented in MilleData.

◆ merge()

virtual void merge ( const MergeableNamed other)
pure virtual

Merge object 'other' into this one.

Your derived class must implement this function. You can static_cast 'other' to your own type (when called, this and other are guaranteed to point to objects of the same type).

Note that 'other' will be deleted after the merge, so make sure you copy all data from it that you will need.

Implemented in MilleData.

◆ Merge()

Long64_t Merge ( TCollection *  hlist)
virtual

Allow merging using TFileMerger if saved directly to a file.

Definition at line 14 of file MergeableNamed.cc.

15{
16 Long64_t nMerged = 0;
17 if (hlist) {
18 const MergeableNamed* xh = 0;
19 TIter nxh(hlist);
20 while ((xh = dynamic_cast<MergeableNamed*>(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 but also named.
virtual void merge(const MergeableNamed *other)=0
Merge object 'other' into this one.

◆ Reset()

virtual void Reset ( )
inlinevirtual

Root-like Reset function for "template compatibility" with ROOT objects.

Alias for clear().

Definition at line 52 of file MergeableNamed.h.

52{clear();}
virtual void clear()=0
Clear content of this object (e.g. set to zeroes). Called by the Reset() function.

◆ SetDirectory()

virtual void SetDirectory ( TDirectory *  )
inlinevirtual

Root-like Clone function for "template compatibility" with ROOT objects.

Calls clone() Root-like SetDirectory function for "template compatibility" with ROOT objects. Does nothing.

Definition at line 56 of file MergeableNamed.h.

56{}

The documentation for this class was generated from the following files: