forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathGPUROOTDumpCore.h
More file actions
68 lines (56 loc) · 1.74 KB
/
Copy pathGPUROOTDumpCore.h
File metadata and controls
68 lines (56 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \file GPUROOTDumpCore.h
/// \author David Rohr
#ifndef GPUROOTDUMPCORE_H
#define GPUROOTDUMPCORE_H
#include "GPUCommonDef.h"
#include "utils/stdspinlock.h"
#include <memory>
#include <vector>
#include <string>
class TFile;
namespace o2::gpu
{
class GPUROOTDumpCore;
class GPUROOTDumpBase
{
public:
virtual void write() = 0;
protected:
GPUROOTDumpBase();
static std::atomic_flag mMutex;
std::weak_ptr<GPUROOTDumpCore> mCore;
};
class GPUROOTDumpCore
{
#if !defined(GPUCA_NO_ROOT) && !defined(GPUCA_GPUCODE)
friend class GPUReconstruction;
friend class GPUROOTDumpBase;
private:
struct GPUROOTDumpCorePrivate {
};
public:
GPUROOTDumpCore(const GPUROOTDumpCore&) = delete;
GPUROOTDumpCore operator=(const GPUROOTDumpCore&) = delete;
GPUROOTDumpCore(GPUROOTDumpCorePrivate); // Cannot be declared private directly since used with new
~GPUROOTDumpCore();
private:
static std::shared_ptr<GPUROOTDumpCore> getAndCreate(const char* filename);
static std::weak_ptr<GPUROOTDumpCore> get() { return sInstance; }
static std::weak_ptr<GPUROOTDumpCore> sInstance;
std::string mFileName;
std::unique_ptr<TFile> mFile;
std::vector<GPUROOTDumpBase*> mBranches;
#endif
};
} // namespace o2::gpu
#endif