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
|
#ifndef DataFormats_Common_HolderToVectorTrait_h
#define DataFormats_Common_HolderToVectorTrait_h
#include "FWCore/Utilities/interface/EDMException.h"
#include <memory>
namespace edm {
namespace reftobase {
class RefVectorHolderBase;
template <typename T>
class BaseVectorHolder;
template <typename T, typename REF>
struct InvalidHolderToVector {
static std::unique_ptr<BaseVectorHolder<T> > makeVectorHolder() {
Exception::throwThis(errors::InvalidReference,
"InvalidHolderToVector: trying to use RefToBase built with "
"an internal type. RefToBase should be built passing an "
"object of type edm::Ref<C>. This exception should never "
"be thrown if a RefToBase was built from a RefProd<C>.");
return std::unique_ptr<BaseVectorHolder<T> >();
}
};
template <typename T, typename REF>
struct HolderToVectorTrait {
// static_assert(sizeof(REF) == 0);
typedef InvalidHolderToVector<T, REF> type;
};
template <typename REF>
struct InvalidRefHolderToRefVector {
static std::unique_ptr<RefVectorHolderBase> makeVectorHolder() {
Exception::throwThis(errors::InvalidReference,
"InvalidRefHolderToRefVector: trying to use RefToBaseVector built with "
"an internal type. RefToBase should be built passing an "
"object of type edm::RefVector<C>");
return std::unique_ptr<RefVectorHolderBase>();
}
};
template <typename REF>
struct RefHolderToRefVectorTrait {
// static_assert(sizeof(REF) == 0);
typedef InvalidRefHolderToRefVector<REF> type;
};
} // namespace reftobase
} // namespace edm
//Handle specialization here
#include "DataFormats/Common/interface/HolderToVectorTrait_Ref_specialization.h"
#include "DataFormats/Common/interface/HolderToVectorTrait_Ptr_specialization.h"
#include "DataFormats/Common/interface/HolderToVectorTrait_RefProd_specialization.h"
#endif
|