|
|
Go to the documentation of this file. 1 #ifndef DataFormats_Common_OneToMany_h
2 #define DataFormats_Common_OneToMany_h
11 template <
typename CKey,
typename CVal,
typename index =
unsigned int>
30 typedef std::map<index_type, map_assoc>
map_type;
34 typedef std::map<const typename CKey::value_type *, std::vector<const typename CVal::value_type *> >
42 if (
k.isNull() ||
v.isNull())
44 if (ref.
key.isNull()) {
45 if (
k.isTransient() ||
v.isTransient()) {
47 "can't insert transient references in uninitialized AssociationMap");
51 if (getter ==
nullptr) {
53 "Can't insert into AssociationMap unless it was properly initialized.\n"
54 "The most common fix for this is to add arguments to the call to the\n"
55 "AssociationMap constructor that are valid Handle's to the containers.\n"
56 "If you don't have valid handles or either template parameter to the\n"
57 "AssociationMap is a View, then see the comments in AssociationMap.h.\n"
58 "(note this was a new requirement added in the 7_5_X release series)\n");
75 for (
typename map_assoc::const_iterator
idx = iv.begin(), idxEnd = iv.end();
idx != idxEnd; ++
idx)
87 const CKey &ckey = *ref.
key;
88 const CVal &cval = *ref.
val;
89 for (
typename map_type::const_iterator
i =
map.begin();
i !=
map.end(); ++
i) {
92 std::vector<const typename CVal::value_type *>
v;
93 for (
typename map_assoc::const_iterator
j =
a.begin();
j !=
a.end(); ++
j) {
97 m.insert(std::make_pair(
k,
v));
106 const CKey &ckey = *ref.
key;
107 for (
typename map_type::const_iterator
i =
map.begin();
i !=
map.end(); ++
i)
108 m.push_back(&ckey[
i->first]);
116 const CVal &cval = *ref.
val;
117 for (
typename map_type::const_iterator
i =
map.begin();
i !=
map.end(); ++
i) {
119 std::vector<const typename CVal::value_type *>
v;
121 for (
typename map_assoc::const_iterator
j =
a.begin();
j !=
a.end(); ++
j)
122 m.back().push_back(&cval[*
j]);
edm::RefVector< CVal > val_type
values reference collection type
edm::RefProd< CKey > KeyRefProd
reference to "key" collection
edm::RefProd< CVal > ValRefProd
reference to "value" collection
static transient_key_vector transientKeyVector(const ref_type &ref, const map_type &map)
fill transient key vector
std::vector< const typename CKey::value_type * > transient_key_vector
transient key vector
static transient_map_type transientMap(const ref_type &ref, const map_type &map)
fill transient map
helpers::KeyVal< KeyRefProd, ValRefProd > ref_type
reference set type
std::vector< index > map_assoc
internal map associated data
edm::Ref< CKey > key_type
insert key type
static void sort(map_type &)
sort
void checkRef(const RP &rp, const R &r)
throw if r hasn't the same id as rp
static void insert(ref_type &ref, map_type &m, const key_type &k, const data_type &v)
insert in the map
static transient_val_vector transientValVector(const ref_type &ref, const map_type &map)
fill transient val vector
static map_type::size_type size(const map_assoc &v)
size of data_type
std::vector< std::vector< const typename CVal::value_type * > > transient_val_vector
transient val vector
static void insert(ref_type &ref, map_type &m, const key_type &k, const val_type &v)
Container::value_type value_type
std::map< const typename CKey::value_type *, std::vector< const typename CVal::value_type * > > transient_map_type
transient map type
index index_type
index type
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
static val_type val(const ref_type &ref, const map_assoc &iv)
return values collection
std::map< index_type, map_assoc > map_type
map type
edm::Ref< CVal > data_type
insert val type