Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:52:59

0001 #ifdef DataFormats_Common_HolderToVectorTrait_h
0002 #ifdef DataFormats_Common_RefProd_h
0003 
0004 #ifndef DataFormats_Common_HolderToVectorTrait_RefProd_specialization_h
0005 #define DataFormats_Common_HolderToVectorTrait_RefProd_specialization_h
0006 // -*- C++ -*-
0007 //
0008 // Package:     DataFormats/Common
0009 //
0010 /**
0011 
0012  Description: Specialization of HolderToVectorTrait for edm::RefProd
0013 
0014  Usage:
0015     Only if both DataFormats/Common/interface/HolderToVectorTrait.h and
0016  DataFormats/Common/interface/RefProd.h are include in a file will this code
0017  be seen.
0018 
0019 */
0020 //
0021 // Original Author:  Chris Jones
0022 //         Created:  Thu, 20 Nov 2014 21:44:59 GMT
0023 //
0024 #include <memory>
0025 
0026 namespace edm {
0027   namespace reftobase {
0028 
0029     template <typename T>
0030     struct RefProdHolderToVector {
0031       static std::unique_ptr<BaseVectorHolder<T> > makeVectorHolder() {
0032         Exception::throwThis(errors::InvalidReference, "attempting to make a BaseVectorHolder<T> from a RefProd<C>.\n");
0033         return std::unique_ptr<BaseVectorHolder<T> >();
0034       }
0035     };
0036 
0037     template <typename C, typename T>
0038     struct HolderToVectorTrait<T, RefProd<C> > {
0039       typedef RefProdHolderToVector<T> type;
0040     };
0041 
0042     struct RefProdRefHolderToRefVector {
0043       static std::unique_ptr<RefVectorHolderBase> makeVectorHolder() {
0044         Exception::throwThis(errors::InvalidReference, "attempting to make a BaseVectorHolder<T> from a RefProd<C>.\n");
0045         return std::unique_ptr<RefVectorHolderBase>();
0046       }
0047     };
0048 
0049     template <typename C>
0050     struct RefHolderToRefVectorTrait<RefProd<C> > {
0051       typedef RefProdRefHolderToRefVector type;
0052     };
0053   }  // namespace reftobase
0054 }  // namespace edm
0055 
0056 #endif
0057 #endif
0058 #endif