Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-30 04:10:32

0001 #ifndef HeterogeneousCore_AlpakaCore_interface_alpaka_EDMetadataSentry_h
0002 #define HeterogeneousCore_AlpakaCore_interface_alpaka_EDMetadataSentry_h
0003 
0004 #include "FWCore/Utilities/interface/StreamID.h"
0005 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/EDMetadata.h"
0006 
0007 namespace ALPAKA_ACCELERATOR_NAMESPACE {
0008   namespace detail {
0009     /**
0010      * Helper class to be used in produce()
0011      *
0012      * TODO: not really a sentry as it doesn't do anything special in its destructor. Better name?
0013      */
0014     class EDMetadataSentry {
0015     public:
0016       // For normal module
0017       EDMetadataSentry(edm::StreamID stream);
0018 
0019       // For ExternalWork-module's produce()
0020       EDMetadataSentry(std::shared_ptr<EDMetadata> metadata) : metadata_(std::move(metadata)) {}
0021 
0022       EDMetadataSentry(EDMetadataSentry const&) = delete;
0023       EDMetadataSentry& operator=(EDMetadataSentry const&) = delete;
0024       EDMetadataSentry(EDMetadataSentry&&) = delete;
0025       EDMetadataSentry& operator=(EDMetadataSentry&&) = delete;
0026 
0027       std::shared_ptr<EDMetadata> metadata() { return metadata_; }
0028 
0029       // true if asynchronous work was (possibly) launched
0030       void finish(bool launchedAsyncWork);
0031 
0032     private:
0033       std::shared_ptr<EDMetadata> metadata_;
0034     };
0035   }  // namespace detail
0036 }  // namespace ALPAKA_ACCELERATOR_NAMESPACE
0037 
0038 #endif