CMS 3D CMS Logo

HostProduct.h
Go to the documentation of this file.
1 #ifndef CUDADataFormatsCommonHostProduct_H
2 #define CUDADataFormatsCommonHostProduct_H
3 
5 
6 // a heterogeneous unique pointer...
7 template <typename T>
8 class HostProduct {
9 public:
10  HostProduct() = default; // make root happy
11  ~HostProduct() = default;
12  HostProduct(HostProduct&&) = default;
13  HostProduct& operator=(HostProduct&&) = default;
14 
16  explicit HostProduct(std::unique_ptr<T>&& p) : std_ptr(std::move(p)) {}
17 
18  auto const* get() const { return hm_ptr ? hm_ptr.get() : std_ptr.get(); }
19 
20  auto const& operator*() const { return *get(); }
21 
22  auto const* operator->() const { return get(); }
23 
24 private:
26  std::unique_ptr<T> std_ptr;
27 };
28 
29 #endif
HostProduct::HostProduct
HostProduct()=default
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HostProduct::operator*
auto const & operator*() const
Definition: HostProduct.h:20
HostProduct::hm_ptr
cms::cuda::host::unique_ptr< T > hm_ptr
Definition: HostProduct.h:25
host_unique_ptr.h
HostProduct::operator=
HostProduct & operator=(HostProduct &&)=default
HostProduct::operator->
auto const * operator->() const
Definition: HostProduct.h:22
HostProduct
Definition: HostProduct.h:8
HostProduct::std_ptr
std::unique_ptr< T > std_ptr
Definition: HostProduct.h:26
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
HostProduct::HostProduct
HostProduct(cms::cuda::host::unique_ptr< T > &&p)
Definition: HostProduct.h:15
cms::cuda::host::unique_ptr
std::unique_ptr< T, impl::HostDeleter > unique_ptr
Definition: host_unique_ptr.h:21
HostProduct::~HostProduct
~HostProduct()=default
HostProduct::HostProduct
HostProduct(std::unique_ptr< T > &&p)
Definition: HostProduct.h:16
HostProduct::get
auto const * get() const
Definition: HostProduct.h:18