1 #ifndef DataFormats_Common_OneToMany_h
2 #define DataFormats_Common_OneToMany_h
11 template<
typename CKey,
typename CVal,
typename index =
unsigned int>
29 typedef std::map<index_type, map_assoc >
map_type;
34 std::vector<const typename CVal::value_type *>
45 "can't insert null references in AssociationMap");
46 if (ref.
key.isNull()) {
52 m[ ik ].push_back(iv);
61 for(
typename map_assoc::const_iterator idx = iv.begin(), idxEnd = iv.end(); idx != idxEnd; ++idx)
72 const CKey & ckey = * ref.
key;
73 const CVal & cval = * ref.
val;
74 for(
typename map_type::const_iterator
i = map.begin();
i != map.end(); ++
i) {
77 std::vector<const typename CVal::value_type *>
v;
78 for(
typename map_assoc::const_iterator
j = a.begin();
j != a.end(); ++
j) {
82 m.insert(std::make_pair(k, v));
89 const CKey & ckey = * ref.
key;
90 for(
typename map_type::const_iterator
i = map.begin();
i != map.end(); ++
i)
91 m.push_back(& ckey[
i->first]);
97 const CVal & cval = * ref.
val;
98 for(
typename map_type::const_iterator
i = map.begin();
i != map.end(); ++
i) {
100 std::vector<const typename CVal::value_type *>
v;
102 for(
typename map_assoc::const_iterator
j = a.begin();
j != a.end(); ++
j)
103 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)
const_iterator end() const
Termination of iteration.
edm::Ref< CVal > data_type
insert val type
static map_type::size_type size(const map_assoc &v)
size of data_type
const_iterator begin() const
Initialize an iterator over the RefVector.
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
std::map< index_type, map_assoc > map_type
map type
index index_type
index type
edm::RefProd< CKey > KeyRefProd
reference to "key" collection
bool isNull() const
Checks for null.
edm::RefProd< CVal > ValRefProd
reference to "value" collection
static transient_map_type transientMap(const ref_type &ref, const map_type &map)
fill transient map
Container::value_type value_type
std::vector< const typename CKey::value_type * > transient_key_vector
transient key vector
key_type key() const
Accessor for product key.
edm::RefVector< CVal > val_type
values reference collection type
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
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