Project
Loading...
Searching...
No Matches
CustomMergeableTObject.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
16
17#ifndef O2_CUSTOMMERGEABLETOBJECT_H
18#define O2_CUSTOMMERGEABLETOBJECT_H
19
20#include <TObject.h>
22
23namespace o2::mergers
24{
25
27{
28 public:
30 CustomMergeableTObject(std::string name, int secret = 9000)
31 : TObject(), MergeInterface(), mSecret(secret), mName(name)
32 {
33 }
34
35 ~CustomMergeableTObject() override = default;
36
37 void merge(MergeInterface* const other) override
38 {
39 mSecret += dynamic_cast<const CustomMergeableTObject* const>(other)->getSecret();
40 }
41
42 int getSecret() const
43 {
44 return mSecret;
45 }
46
47 const char* GetName() const override
48 {
49 return mName.c_str();
50 }
51
53 {
54 return new CustomMergeableTObject{mName + "_mw", mSecret};
55 }
56
57 private:
58 int mSecret = 0;
59 std::string mName;
60
61 ClassDefOverride(CustomMergeableTObject, 1);
62};
63
64} // namespace o2::mergers
65
66#endif //O2_CUSTOMMERGEABLETOBJECT_H
Definition of O2 Mergers merging interface, v0.1.
MergeInterface * cloneMovingWindow() const override
Should return an object subset which is supposed to take part in generating moving windows.
const char * GetName() const override
void merge(MergeInterface *const other) override
Custom merge method.
CustomMergeableTObject(std::string name, int secret=9000)
~CustomMergeableTObject() override=default
An interface which allows to merge custom objects.
GLuint const GLchar * name
Definition glcorearb.h:781
VectorOfTObjectPtrs other