1 #ifndef DataFormats_Common_AssociationMap_h 2 #define DataFormats_Common_AssociationMap_h 41 #include "tbb/concurrent_unordered_map.h" 47 template<
typename Tag>
94 typename map_type::const_iterator
i;
141 template<
typename... Args>
151 void insert(
const key_type &
k,
const data_type &
v) {
163 if (
ref_.key.id() != k.id())
return end();
164 return find(k.key());
168 index_type
i = k.key();
175 return get(k.key()).
val;
181 return get(k.key()).
val;
186 if (
ref_.key.id() != k.id())
return 0;
187 typename map_type::const_iterator
f =
map_.
find(k.key());
194 if (
ref_.key.id() != k.id())
return 0;
195 typename map_type::const_iterator
f =
map_.
find(k.key());
205 typename Tag::transient_map_type
map() {
206 return Tag::transientMap(
ref_,
map_ );
210 typename Tag::transient_key_vector
keys() {
211 return Tag::transientKeyVector(
ref_,
map_ );
215 typename Tag::transient_val_vector
values() {
216 return Tag::transientValVector(
ref_,
map_ );
228 using result_type =
const value_type *;
231 return &(*c.
find(i));
247 typename map_type::const_iterator
f = map_.find(i);
248 if (f == map_.end())
return end();
252 const value_type &
get(size_type
i)
const {
253 typename internal_transient_map_type::const_iterator tf =
transientMap_.find(
i);
255 typename map_type::const_iterator
f =
map_.
find(
i);
259 std::pair<typename internal_transient_map_type::const_iterator, bool>
ins =
261 return ins.first->second;
269 template<
typename,
typename,
typename>
friend class OneToValue;
270 template<
typename,
typename,
typename>
friend class OneToOne;
271 template<
typename,
typename,
typename>
friend class OneToMany;
275 namespace refhelper {
276 template<
typename Tag>
const result_type operator()(first_argument_type c, second_argument_type i)
ptrdiff_t difference_type
AssociationMap< Tag >::Find value
Tag::index_type index_type
index type
const_iterator end() const
last iterator over the map (read only)
const result_type & operator[](const K &k) const
internal_transient_map_type transientMap_
transient reference map
bool empty() const
return true if empty
const_iterator find(const key_type &k) const
find element with specified reference key
tbb::concurrent_unordered_map< index_type, value_type > internal_transient_map_type
transient map type
Tag::data_type data_type
insert data type
const value_type * operator->() const
AssociationMap(const ref_type &ref)
helpers::KeyVal< key_type, internal_val_type > value_type
type returned by dereferenced iterator, also can be inserted
Tag::transient_val_vector values()
Tag::key_type key_type
insert key type
ref_type ref_
reference set
self::value_type value_type
#define CMS_CLASS_VERSION(_version_)
value_type::value_type result_type
type return by operator[]
size_type numberOfAssociations(const key_type &k) const
number of associations to a key
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
size_type erase(const key_type &k)
erase the element whose key is k
bool operator!=(const const_iterator &ci) const
const_iterator & operator++()
map_type::const_iterator i
const_iterator(const self *map, typename map_type::const_iterator mi)
const ref_type & refProd() const
return ref-prod structure
void post_insert()
post insert action
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Tag::transient_key_vector keys()
bool operator==(const const_iterator &ci) const
const_iterator operator++(int)
Tag::val_type internal_val_type
size_type size() const
map size
void insert(const key_type &k, const data_type &v)
insert an association
AssociationMap(Args...args)
AssociationMap(EDProductGetter const *getter)
const_iterator operator--(int)
map_type::const_iterator::iterator_category iterator_category
Tag::ref_type ref_type
Holds the RefProd or RefToBaseProd of 1 or 2 collections.
Tag::map_type map_type
map type
void insert(const value_type &kv)
AssociationMap()
default constructor
const_iterator begin() const
first iterator over the map (read only)
const result_type & operator[](const key_type &k) const
find element with specified reference key
size_type second_argument_type
void checkRef(const RP &rp, const R &r)
throw if r hasn't the same id as rp
size_type numberOfAssociations(const K &k) const
const_iterator & operator--()
const value_type & get(size_type i) const
return value_typeelement with key i
Tag::transient_map_type map()
const value_type & operator*() const
map_type::size_type size_type
size type