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]);
std::map< const typename CKey::value_type *, std::vector< const typename CVal::value_type * > > transient_map_type
transient map type
static void sort(map_type &)
sort
helpers::KeyVal< KeyRefProd, ValRefProd > ref_type
reference set type
static val_type val(const ref_type &ref, const map_assoc &iv)
return values collection
edm::Ref< CKey > key_type
insert key type
static void insert(ref_type &ref, map_type &m, const key_type &k, const data_type &v)
insert in the map
static void insert(ref_type &ref, map_type &m, const key_type &k, const val_type &v)
std::map< index_type, map_assoc > map_type
map type
edm::Ref< CVal > data_type
insert val type
static map_type::size_type size(const map_assoc &v)
size of data_type
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
index index_type
index type
edm::RefProd< CKey > KeyRefProd
reference to "key" collection
Container::value_type value_type
edm::RefProd< CVal > ValRefProd
reference to "value" collection
static transient_map_type transientMap(const ref_type &ref, const map_type &map)
fill transient map
std::vector< const typename CKey::value_type * > transient_key_vector
transient key vector
edm::RefVector< CVal > val_type
values reference collection type
static transient_val_vector transientValVector(const ref_type &ref, const map_type &map)
fill transient val vector
static transient_key_vector transientKeyVector(const ref_type &ref, const map_type &map)
fill transient key vector
void checkRef(const RP &rp, const R &r)
throw if r hasn't the same id as rp
std::vector< std::vector< const typename CVal::value_type * > > transient_val_vector
transient val vector
std::vector< index > map_assoc
internal map associated data