|
|
Go to the documentation of this file. 1 #ifndef DataFormats_Common_ValueMap_h
2 #define DataFormats_Common_ValueMap_h
21 template <
typename Map>
26 typedef std::map<ProductID, value_vector>
value_map;
35 typename id_offset_vector::const_iterator
j =
map.ids_.begin();
36 const typename id_offset_vector::const_iterator
end =
map.ids_.end();
38 const size_t size =
map.values_.size();
44 typename value_map::iterator
f =
values_.find(
id);
52 template <
typename H,
typename I>
55 size_t size =
h->size(), sizeIt =
end - begin;
58 typename value_map::const_iterator
f =
values_.find(
id);
70 for (
typename value_map::const_iterator
i =
values_.begin();
i !=
values_.end(); ++
i) {
72 map_.ids_.push_back(std::make_pair(
id, off));
74 for (
typename value_vector::const_iterator
j =
values.begin();
j !=
values.end(); ++
j) {
75 map_.values_.push_back(*
j);
91 "ValueMap::Filler: handle and reference "
92 "collections should the same size\n");
96 e <<
"index map has already been filled for id: " <<
id <<
"\n";
101 "ValueMap: trying to add entries for an already existing product\n");
106 template <
typename T>
129 template <
typename RefKey>
131 return get(
r.id(),
r.key());
135 typename id_offset_vector::const_iterator
f =
getIdOffset(
id);
139 size_t j = off +
idx;
145 template <
typename RefKey>
147 return get(
r.id(),
r.key());
164 ids_.shrink_to_fit();
174 typename container::const_iterator
begin()
const {
return values_->begin() +
i_->second; }
175 typename container::const_iterator
end()
const {
178 id_offset_vector::const_iterator
end =
i_;
221 const id_offset_vector::const_iterator&
end,
225 id_offset_vector::const_iterator
i_,
end_;
248 return i->first ==
id ?
i :
ids_.end();
272 template <
typename T>
280 template <
typename T>
Map::id_offset_vector id_offset_vector
void insert(const H &h, I begin, I end)
void throwNotExisting() const
ValueMap & operator=(ValueMap const &rhs)
reference_type get(ProductID id, size_t idx)
EventID const & max(EventID const &lh, EventID const &rh)
void swap(Association< C > &lhs, Association< C > &rhs)
const_iterator & operator+=(difference_type d)
difference_type operator-(const const_iterator &o) const
const_iterator & operator-=(difference_type d)
void throwFillID(ProductID id) const
id_offset_vector::const_iterator i_
const_iterator & operator++()
std::vector< value_type > container
const_reference_type get(size_t idx) const
meant to be used in AssociativeIterator, not by the ordinary user
ValueMap< T > & operator+=(const ValueMap< T > &o)
const id_offset_vector & ids() const
meant to be used in AssociativeIterator, not by the ordinary user
const std::complex< double > I
ptrdiff_t difference_type
#define CMS_CLASS_VERSION(_version_)
bool operator==(const const_iterator &ci) const
const_iterator & operator--()
const_iterator end() const
const_iterator operator--(int)
reference_type operator[](const RefKey &r)
container::reference reference_type
const_iterator begin() const
void swap(ValueMap &other)
void throwFillSize() const
const_iterator operator+(difference_type n) const
container::const_iterator end() const
container::const_reference const_reference_type
helper::Filler< ValueMap< T > > Filler
std::map< ProductID, value_vector > value_map
const_iterator operator-(difference_type n) const
void throwIndexBound() const
const container * values_
id_offset_vector::const_iterator end_
const_reference_type get(ProductID id, size_t idx) const
container::const_iterator begin() const
std::vector< std::pair< ProductID, offset > > id_offset_vector
const T & operator[](size_t i)
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
bool operator()(const std::pair< ProductID, offset > &p, const ProductID &id)
const_iterator operator++(int)
std::vector< size_t > index_vector
bool operator<(const const_iterator &o) const
size_t rawIndexOf(ProductID id, size_t idx) const
void add(const ValueMap< T > &o)
std::vector< typename Map::value_type > value_vector
bool contains(ProductID id) const
Association< C > operator+(const Association< C > &a1, const Association< C > &a2)
const_reference_type operator[](const RefKey &r) const
const_iterator(const id_offset_vector::const_iterator &i_, const id_offset_vector::const_iterator &end, const container *values)
bool operator!=(const const_iterator &ci) const
id_offset_vector::const_iterator getIdOffset(ProductID id) const