HolderToVectorTrait

RefHolderToRefVectorTrait

RefProdHolderToVector

RefProdRefHolderToRefVector

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
#ifdef DataFormats_Common_HolderToVectorTrait_h
#ifdef DataFormats_Common_RefProd_h

#ifndef DataFormats_Common_HolderToVectorTrait_RefProd_specialization_h
#define DataFormats_Common_HolderToVectorTrait_RefProd_specialization_h
// -*- C++ -*-
//
// Package:     DataFormats/Common
//
/**

 Description: Specialization of HolderToVectorTrait for edm::RefProd

 Usage:
    Only if both DataFormats/Common/interface/HolderToVectorTrait.h and
 DataFormats/Common/interface/RefProd.h are include in a file will this code
 be seen.

*/
//
// Original Author:  Chris Jones
//         Created:  Thu, 20 Nov 2014 21:44:59 GMT
//
#include <memory>

namespace edm {
  namespace reftobase {

    template <typename T>
    struct RefProdHolderToVector {
      static std::unique_ptr<BaseVectorHolder<T> > makeVectorHolder() {
        Exception::throwThis(errors::InvalidReference, "attempting to make a BaseVectorHolder<T> from a RefProd<C>.\n");
        return std::unique_ptr<BaseVectorHolder<T> >();
      }
    };

    template <typename C, typename T>
    struct HolderToVectorTrait<T, RefProd<C> > {
      typedef RefProdHolderToVector<T> type;
    };

    struct RefProdRefHolderToRefVector {
      static std::unique_ptr<RefVectorHolderBase> makeVectorHolder() {
        Exception::throwThis(errors::InvalidReference, "attempting to make a BaseVectorHolder<T> from a RefProd<C>.\n");
        return std::unique_ptr<RefVectorHolderBase>();
      }
    };

    template <typename C>
    struct RefHolderToRefVectorTrait<RefProd<C> > {
      typedef RefProdRefHolderToRefVector type;
    };
  }  // namespace reftobase
}  // namespace edm

#endif
#endif
#endif