CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
edm::DeviceProductBase Class Reference

#include <DeviceProduct.h>

Inheritance diagram for edm::DeviceProductBase:
edm::DeviceProduct< T >

Public Member Functions

 DeviceProductBase ()=default
 
template<typename M >
M const & metadata () const
 
 ~DeviceProductBase ()=default
 

Protected Member Functions

template<typename M >
 DeviceProductBase (std::shared_ptr< M > metadata)
 

Private Attributes

std::shared_ptr< void const > metadata_
 
std::type_info const * metadataType_
 

Detailed Description

Definition at line 8 of file DeviceProduct.h.

Constructor & Destructor Documentation

◆ DeviceProductBase() [1/2]

edm::DeviceProductBase::DeviceProductBase ( )
default

◆ ~DeviceProductBase()

edm::DeviceProductBase::~DeviceProductBase ( )
default

◆ DeviceProductBase() [2/2]

template<typename M >
edm::DeviceProductBase::DeviceProductBase ( std::shared_ptr< M >  metadata)
inlineexplicitprotected

Definition at line 31 of file DeviceProduct.h.

32  : metadata_(std::move(metadata)), metadataType_(&typeid(M)) {}
std::shared_ptr< void const > metadata_
Definition: DeviceProduct.h:35
std::type_info const * metadataType_
Definition: DeviceProduct.h:36
M const & metadata() const
Definition: DeviceProduct.h:15
def move(src, dest)
Definition: eostools.py:511

Member Function Documentation

◆ metadata()

template<typename M >
M const& edm::DeviceProductBase::metadata ( ) const
inline

Definition at line 15 of file DeviceProduct.h.

References cms::cuda::assert(), runTheMatrix::const, metadata_, and metadataType_.

15  {
16  // TODO: I believe the assertion could be removed safely after
17  // the data dependence and scheduling systems would guarantee
18  // that the an EDModule in a given execution space can access
19  // only to the EDProducts in a memory space compatible with the
20  // execution space.
21  //
22  // On the other hand, with Alpaka (likely with others) the
23  // getSynchronized() does additional checks so the added cost is
24  // probably not that much?
25  assert(typeid(M) == *metadataType_);
26  return *static_cast<M const*>(metadata_.get());
27  }
std::shared_ptr< void const > metadata_
Definition: DeviceProduct.h:35
assert(be >=bs)
std::type_info const * metadataType_
Definition: DeviceProduct.h:36

Member Data Documentation

◆ metadata_

std::shared_ptr<void const> edm::DeviceProductBase::metadata_
private

Definition at line 35 of file DeviceProduct.h.

Referenced by metadata().

◆ metadataType_

std::type_info const* edm::DeviceProductBase::metadataType_
private

Definition at line 36 of file DeviceProduct.h.

Referenced by metadata().