Project
Loading...
Searching...
No Matches
GPUROOTDumpCore.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
14
15#ifndef GPUROOTDUMPCORE_H
16#define GPUROOTDUMPCORE_H
17
18#include "GPUCommonDef.h"
19#include "utils/stdspinlock.h"
20#include <memory>
21#include <vector>
22#include <string>
23
24class TFile;
25
26namespace o2::gpu
27{
28class GPUROOTDumpCore;
29
31{
32 public:
33 virtual void write() = 0;
34
35 protected:
37 static std::atomic_flag mMutex;
38 std::weak_ptr<GPUROOTDumpCore> mCore;
39};
40
42{
43#if !defined(GPUCA_NO_ROOT) && !defined(GPUCA_GPUCODE)
44 friend class GPUReconstruction;
45 friend class GPUROOTDumpBase;
46
47 private:
48 struct GPUROOTDumpCorePrivate {
49 };
50
51 public:
54 GPUROOTDumpCore(GPUROOTDumpCorePrivate); // Cannot be declared private directly since used with new
56
57 private:
58 static std::shared_ptr<GPUROOTDumpCore> getAndCreate(const char* filename);
59 static std::weak_ptr<GPUROOTDumpCore> get() { return sInstance; }
60 static std::weak_ptr<GPUROOTDumpCore> sInstance;
61 std::string mFileName;
62 std::unique_ptr<TFile> mFile;
63 std::vector<GPUROOTDumpBase*> mBranches;
64#endif
65};
66} // namespace o2::gpu
67
68#endif
std::weak_ptr< GPUROOTDumpCore > mCore
virtual void write()=0
static std::atomic_flag mMutex
GPUROOTDumpCore operator=(const GPUROOTDumpCore &)=delete
GPUROOTDumpCore(const GPUROOTDumpCore &)=delete
std::string filename()