File indexing completed on 2025-03-05 03:13:49
0001 #ifndef DataFormats_Common_interface_OrphanHandle_h
0002 #define DataFormats_Common_interface_OrphanHandle_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include "DataFormats/Common/interface/OrphanHandleBase.h"
0023
0024 namespace edm {
0025
0026 template <typename T>
0027 class OrphanHandle : public OrphanHandleBase {
0028 public:
0029 using element_type = T;
0030
0031
0032 OrphanHandle();
0033
0034 OrphanHandle(T const* prod, ProductID const& id);
0035
0036 T const* product() const;
0037 T const* operator->() const;
0038 T const& operator*() const;
0039 };
0040
0041 template <class T>
0042 OrphanHandle<T>::OrphanHandle() : OrphanHandleBase() {}
0043
0044 template <class T>
0045 OrphanHandle<T>::OrphanHandle(T const* prod, ProductID const& theId) : OrphanHandleBase(prod, theId) {}
0046
0047 template <class T>
0048 T const* OrphanHandle<T>::product() const {
0049 return static_cast<T const*>(productStorage());
0050 }
0051
0052 template <class T>
0053 T const* OrphanHandle<T>::operator->() const {
0054 return product();
0055 }
0056
0057 template <class T>
0058 T const& OrphanHandle<T>::operator*() const {
0059 return *product();
0060 }
0061
0062 }
0063
0064 #endif