1 #ifndef DataFormats_Common_AssociationVector_h
2 #define DataFormats_Common_AssociationVector_h
25 #include "boost/static_assert.hpp"
40 template<
typename REFPROD>
54 template<
typename KeyRefProd,
typename CVal,
56 typename SizeType =
unsigned int,
64 typedef typename KeyRefProd::product_type
CKey;
67 typedef typename std::pair<KeyRef, typename CVal::value_type>
value_type;
78 typename CVal::const_reference
operator[](KeyRef
const&
k)
const;
84 void swap(
self& other);
90 std::vector<void const*>& pointers,
110 template<
typename KeyRefProd,
typename CVal,
typename KeyRef,
typename SizeType,
typename KeyReferenceHelper>
112 data_(), ref_(), transientVector_(), fixed_(
false) { }
114 template<
typename KeyRefProd,
typename CVal,
typename KeyRef,
typename SizeType,
typename KeyReferenceHelper>
117 data_(coll == 0 ? ref->
size() : coll->
size()), ref_(ref),
118 transientVector_(coll == 0 ? ref->
size() : coll->
size()), fixed_(
true) { }
120 template<
typename KeyRefProd,
typename CVal,
typename KeyRef,
typename SizeType,
typename KeyReferenceHelper>
123 data_(o.data_), ref_(o.ref_), transientVector_(o.transientVector_), fixed_(o.fixed_) { }
125 template<
typename KeyRefProd,
typename CVal,
typename KeyRef,
typename SizeType,
typename KeyReferenceHelper>
128 template<
typename KeyRefProd,
typename CVal,
typename KeyRef,
typename SizeType,
typename KeyReferenceHelper>
131 return transientVector()[
n ];
134 template<
typename KeyRefProd,
typename CVal,
typename KeyRef,
typename SizeType,
typename KeyReferenceHelper>
135 inline typename CVal::const_reference
139 return data_[ keyRef.key() ];
143 template<
typename KeyRefProd,
typename CVal,
typename KeyRef,
typename SizeType,
typename KeyReferenceHelper>
149 return data_[ keyRef.key() ];
152 template<
typename KeyRefProd,
typename CVal,
typename KeyRef,
typename SizeType,
typename KeyReferenceHelper>
164 template<
typename KeyRefProd,
typename CVal,
typename KeyRef,
typename SizeType,
typename KeyReferenceHelper>
168 transientVector_[
i ].first = ref;
169 transientVector_[
i ].second = data_[
i ];
172 template<
typename KeyRefProd,
typename CVal,
typename KeyRef,
typename SizeType,
typename KeyReferenceHelper>
178 template<
typename KeyRefProd,
typename CVal,
typename KeyRef,
typename SizeType,
typename KeyReferenceHelper>
180 return data_.empty();
183 template<
typename KeyRefProd,
typename CVal,
typename KeyRef,
typename SizeType,
typename KeyReferenceHelper>
186 transientVector_.clear();
191 template<
typename KeyRefProd,
typename CVal,
typename KeyRef,
typename SizeType,
typename KeyReferenceHelper>
193 data_.swap(other.data_);
194 transientVector_.swap(other.transientVector_);
195 ref_.swap(other.ref_);
199 template<
typename KeyRefProd,
typename CVal,
typename KeyRef,
typename SizeType,
typename KeyReferenceHelper>
203 transientVector_.resize(
size());
205 transientVector_[
i ] = std::make_pair(KeyRef(ref_,
i), data_[
i ]);
210 template<
typename KeyRefProd,
typename CVal,
typename KeyRef,
typename SizeType,
typename KeyReferenceHelper>
212 std::vector<void const*>& pointers,
223 template<
typename KeyRefProd,
typename CVal,
typename KeyRef,
typename SizeType,
typename KeyReferenceHelper>
233 template <
typename KeyRefProd,
typename CVal,
typename KeyRef,
typename SizeType,
typename KeyReferenceHelper>
238 std::vector<void const*>& pointers,
240 obj.
fillView(
id, pointers, helpers);
243 template <
typename KeyRefProd,
typename CVal,
typename KeyRef,
typename SizeType,
typename KeyReferenceHelper>
void checkForWrongProduct(ProductID const &keyID, ProductID const &refID)
void fillView(AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper > const &obj, ProductID const &id, std::vector< void const * > &pointers, helper_vector &helpers)
transient_vector_type::const_iterator const_iterator
Ref< typename RefProd< C >::product_type > ref_type
void reallyFillView(COLLECTION const &coll, ProductID const &id, std::vector< void const * > &ptrs, helper_vector &helpers)
void fillView(ProductID const &id, std::vector< void const * > &pointers, helper_vector &helpers) const
self & operator=(self const &)
const_iterator end() const
std::vector< value_type > transient_vector_type
#define CMS_CLASS_VERSION(_version_)
void swap(Association< C > &lhs, Association< C > &rhs)
AssociationIdenticalKeyReference type
transient_vector_type const & transientVector() const
value_type const & const_reference
const_reference operator[](size_type n) const
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
std::pair< KeyRef, typename CVal::value_type > value_type
BOOST_STATIC_ASSERT((boost::is_convertible< SizeType, typename CVal::size_type >::value))
transient_vector_type transientVector_
CVal::value_type const value(size_type i) const
KeyRefProd::product_type CKey
Container::value_type value_type
KeyRef key(size_type i) const
KeyRef::value_type key_type
KeyRefProd const & keyProduct() const
void setValue(size_type i, typename CVal::value_type const &val)
const_iterator begin() const
tuple size
Write out results.
T get(const Candidate &c)