1 #ifndef DataFormats_Common_OneToValue_h
2 #define DataFormats_Common_OneToValue_h
11 template <
typename CKey,
typename Val,
typename index =
unsigned int>
28 typedef std::map<index_type, map_assoc>
map_type;
42 if (ref.
key.isNull()) {
45 "can't insert transient references in uninitialized AssociationMap");
48 auto getter = ref.
key.productGetter();
49 if (getter ==
nullptr) {
51 "Can't insert into AssociationMap unless it was properly initialized.\n"
52 "The most common fix for this is to add an argument to the call to the\n"
53 "AssociationMap constructor that is a valid Handle to the container.\n"
54 "If you don't have a valid handle or the template parameter to the\n"
55 "AssociationMap is a View, then see the comments in AssociationMap.h.\n"
56 "(note this was a new requirement added in the 7_5_X release series)\n");
74 CKey
const& ckey = *ref.
key;
75 for (
typename map_type::const_iterator
i = map.begin();
i != map.end(); ++
i) {
77 m.insert(std::make_pair(k,
i->second));
86 CKey
const& ckey = *ref.
key;
87 for (
typename map_type::const_iterator
i = map.begin();
i != map.end(); ++
i) {
88 m.push_back(&ckey[
i->first]);
97 for (
typename map_type::const_iterator
i = map.begin();
i != map.end(); ++
i) {
98 m.push_back(
i->second);
Val map_assoc
internal map associated data
std::map< typename CKey::value_type const *, Val > transient_map_type
transient map type
helpers::Key< KeyRefProd > ref_type
reference set type
static transient_map_type transientMap(ref_type const &ref, map_type const &map)
fill transient map
bool isTransient() const
Checks if this ref is transient (i.e. not persistable).
static map_type::size_type size(map_assoc const &)
size of data_type
index index_type
index type
static void sort(map_type &)
sort
Val val_type
values reference collection type
static val_type val(ref_type const &, map_assoc const &v)
return values collection
key_type key() const
Accessor for product key.
ProductID id() const
Accessor for product ID.
Ref< CKey > key_type
insert key type
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
std::vector< typename CKey::value_type const * > transient_key_vector
transient key vector
Container::value_type value_type
bool isNull() const
Checks for null.
Val data_type
insert val type
std::map< index_type, map_assoc > map_type
map type
RefProd< CKey > KeyRefProd
reference to "key" collection
std::vector< Val > transient_val_vector
transient val vector
static transient_key_vector transientKeyVector(ref_type const &ref, map_type const &map)
fill transient key vector
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, key_type const &k, data_type const &v)
insert in the map
static transient_val_vector transientValVector(ref_type const &ref, map_type const &map)
fill transient val vector