|
|
Go to the documentation of this file. 1 #ifndef DataFormats_Common_OneToOneGeneric_h
2 #define DataFormats_Common_OneToOneGeneric_h
10 template <
typename CKey,
35 typedef std::map<index_type, map_assoc>
map_type;
39 typedef std::map<typename CKey::value_type const*, typename CVal::value_type const*>
transient_map_type;
46 if (
k.isNull() ||
v.isNull()) {
49 if (ref.
key.isNull()) {
50 if (
k.isTransient() ||
v.isTransient()) {
52 "can't insert transient references in uninitialized AssociationMap");
55 auto getter = ref.
key.productGetter();
56 if (getter ==
nullptr) {
58 "Can't insert into AssociationMap unless it was properly initialized.\n"
59 "The most common fix for this is to add arguments to the call to the\n"
60 "AssociationMap constructor that are valid Handle's to the containers.\n"
61 "If you don't have valid handles or either template parameter to the\n"
62 "AssociationMap is a View, then see the comments in AssociationMap.h.\n"
63 "(note this was a new requirement added in the 7_5_X release series)\n");
65 ref.
key = KeyRefProd(
k.id(), getter);
66 ref.
val = ValRefProd(
v.id(), ref.
val.productGetter());
83 CKey
const& ckey = *ref.
key;
84 CVal
const& cval = *ref.
val;
85 for (
typename map_type::const_iterator
i =
map.begin();
i !=
map.end(); ++
i) {
88 m.insert(std::make_pair(
k,
v));
97 CKey
const& ckey = *ref.
key;
98 for (
typename map_type::const_iterator
i =
map.begin();
i !=
map.end(); ++
i)
99 m.push_back(&ckey[
i->first]);
107 CVal
const& cval = *ref.
val;
108 for (
typename map_type::const_iterator
i =
map.begin();
i !=
map.end(); ++
i) {
109 m.push_back(&cval[
i->second]);
static transient_map_type transientMap(ref_type const &ref, map_type const &map)
fill transient map
std::map< index_type, map_assoc > map_type
map type
ValRefProd valrefprod_type
reference to "value" collection
RefProd< C > refprod_type
index map_assoc
internal map associated data
std::vector< typename CVal::value_type const * > transient_val_vector
transient val vector
static void sort(map_type &)
sort
static transient_key_vector transientKeyVector(ref_type const &ref, map_type const &map)
fill transient key vector
std::vector< typename CKey::value_type const * > transient_key_vector
transient key vector
ValRef data_type
insert val type
void checkRef(const RP &rp, const R &r)
throw if r hasn't the same id as rp
static transient_val_vector transientValVector(ref_type const &ref, map_type const &map)
fill transient val vector
ValRef val_type
values reference collection type
static void insert(ref_type &ref, map_type &m, key_type const &k, data_type const &v)
insert in the map
helpers::KeyVal< keyrefprod_type, valrefprod_type > ref_type
reference set type
static val_type val(ref_type const &ref, map_assoc iv)
return values collection
KeyRef key_type
insert key type
static map_type::size_type size(map_assoc const &)
size of data_type
Container::value_type value_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="")
std::map< typename CKey::value_type const *, typename CVal::value_type const * > transient_map_type
transient map type
KeyRefProd keyrefprod_type
reference to "key" collection