forked from cms-patatrack/pixeltrack-standalone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HostProduct.h
29 lines (21 loc) · 834 Bytes
/
HostProduct.h
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
#ifndef CUDADataFormatsCommonHostProduct_H
#define CUDADataFormatsCommonHostProduct_H
#include "CUDACore/host_unique_ptr.h"
// a heterogeneous unique pointer...
template <typename T>
class HostProduct {
public:
HostProduct() = default; // make root happy
~HostProduct() = default;
HostProduct(HostProduct&&) = default;
HostProduct& operator=(HostProduct&&) = default;
explicit HostProduct(cms::cuda::host::unique_ptr<T>&& p) : hm_ptr(std::move(p)) {}
explicit HostProduct(std::unique_ptr<T>&& p) : std_ptr(std::move(p)) {}
auto const* get() const { return hm_ptr ? hm_ptr.get() : std_ptr.get(); }
auto const& operator*() const { return *get(); }
auto const* operator-> () const { return get(); }
private:
cms::cuda::host::unique_ptr<T> hm_ptr; //!
std::unique_ptr<T> std_ptr; //!
};
#endif