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_Ptr_h
0003 
0004 #ifndef DataFormats_Common_HolderToVectorTrait_Ptr_specialization_h
0005 #define DataFormats_Common_HolderToVectorTrait_Ptr_specialization_h
0006 // -*- C++ -*-
0007 //
0008 // Package:     DataFormats/Common
0009 //
0010 /**
0011 
0012  Description: Specialization of HolderToVectorTrait for edm::Ptr
0013 
0014  Usage:
0015     Only if both DataFormats/Common/interface/HolderToVectorTrait.h and
0016  DataFormats/Common/interface/Ptr.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 #include "DataFormats/Common/interface/PtrVector.h"
0027 #include "DataFormats/Common/interface/RefVectorHolder.h"
0028 #include "DataFormats/Common/interface/VectorHolder.h"
0029 
0030 namespace edm {
0031   template <typename T>
0032   class PtrVector;
0033   namespace reftobase {
0034 
0035     template <typename T, typename U>
0036     struct PtrHolderToVector {
0037       static std::unique_ptr<BaseVectorHolder<T> > makeVectorHolder() {
0038         return std::unique_ptr<BaseVectorHolder<T> >(new VectorHolder<T, edm::PtrVector<U> >);
0039       }
0040     };
0041 
0042     template <typename T, typename U>
0043     struct HolderToVectorTrait<T, Ptr<U> > {
0044       typedef PtrHolderToVector<T, U> type;
0045     };
0046 
0047     template <typename T>
0048     struct PtrRefHolderToRefVector {
0049       static std::unique_ptr<RefVectorHolderBase> makeVectorHolder() {
0050         return std::unique_ptr<RefVectorHolderBase>(new RefVectorHolder<edm::PtrVector<T> >);
0051       }
0052     };
0053 
0054     template <typename T>
0055     struct RefHolderToRefVectorTrait<Ptr<T> > {
0056       typedef PtrRefHolderToRefVector<T> type;
0057     };
0058   }  // namespace reftobase
0059 }  // namespace edm
0060 
0061 #endif
0062 #endif
0063 #endif