1 #ifndef DataFormats_Common_MultiAssociation_h 2 #define DataFormats_Common_MultiAssociation_h 54 #include <boost/range.hpp> 73 typedef std::pair<unsigned int, unsigned int>
range;
79 template <
typename RefKey>
81 return get(
r.id(),
r.key());
113 template <
typename RefKey>
114 void insert(
const RefKey &
r,
unsigned int startingOffset,
unsigned int size) {
152 template <
typename C>
157 typedef boost::sub_range<Collection>
range;
162 template <
typename RefKey>
164 return get(
r.id(),
r.key());
168 template <
typename RefKey>
170 return get(
r.id(),
r.key());
174 template <
typename RefKey>
211 template <
typename HandleType>
221 template <
typename KeyRef>
237 template <
typename HandleType>
249 template <
typename HandleType>
271 template <
typename KeyRef>
276 template <
typename KeyRef>
289 template <
typename HandleType>
311 template <
typename C>
317 template <
typename C>
320 return range(
data_.begin() + idxrange.first,
data_.begin() + idxrange.second);
323 template <
typename C>
325 unsigned int key)
const {
328 for (
typename const_range::const_iterator it =
values.begin(), ed =
values.end(); it != ed; ++it) {
334 template <
typename C>
336 indexFiller_->insert(
id,
key, assoc_.data_.size(), vals.size());
337 for (
typename Collection::const_iterator it = vals.begin(), ed = vals.end(); it != ed; ++it) {
338 assoc_.data_.push_back(*it);
342 template <
typename C>
343 template <
typename KeyRef>
347 (*tempValues_)[
k.key()] = vals;
350 template <
typename C>
351 template <
typename KeyRef>
355 vals.swap((*tempValues_)[
k.key()]);
358 template <
typename C>
362 for (
typename TempValues::const_iterator it = tempValues_->begin(), ed = tempValues_->end(); it != ed; ++it) {
363 filler.setValues(id_, it->first, it->second);
static void throwUnexpectedProductID(ProductID found, ProductID expected, const char *where)
boost::sub_range< const Collection > const_range
const_range get(const edm::ProductID &id, unsigned int t) const
Get a range of values for this product id and index (fast)
bool empty() const
Returns true if there are no keys.
range operator[](const RefKey &r)
Get a range of values for this key (fast)
FastFiller(MultiAssociation &assoc, edm::ProductID id, unsigned int size)
void swapValues(const KeyRef &k, Collection &refs)
unsigned int size() const
Size of this collection (number of keys)
offset_vector ref_offsets_
FastFiller & operator=(const FastFiller &)=delete
ret
prodAgent to be discontinued
LazyFiller(MultiAssociation &assoc, const HandleType &handle, bool fillOnExit=false)
std::map< unsigned int, Collection > TempValues
LazyFiller lazyFiller(const HandleType &h, bool fillOnExit=false)
#define CMS_CLASS_VERSION(_version_)
bool contains(ProductID id) const
True if this IndexRangeAssociation has info for this product id.
boost::sub_range< Collection > range
bool operator()(const id_off_pair &p, const edm::ProductID &id) const
void swap(IndexRangeAssociation &other)
unsigned int dataSize() const
Returns the number of values.
std::shared_ptr< TempValues > tempValues_
edm::helper::IndexRangeAssociation::FastFiller IndexFiller
~LazyFiller() noexcept(false)
MultiAssociation & assoc_
void swap(IndexRangeAssociation &lhs, IndexRangeAssociation &rhs)
int lastKey_
last key used to fill (to check that the new key must be strictly greater than lastKey_) ...
~FastFiller()
When the FastFiller goes out of scope, it unlocks the map so you can make a new one.
IndexRangeAssociation & assoc_
FastFiller(const FastFiller &)=delete
range get(const edm::ProductID &id, unsigned int t) const
def template(fileName, svg, replaceme="REPLACEME")
std::pair< unsigned int, unsigned int > range
void insert(const RefKey &r, unsigned int startingOffset, unsigned int size)
Sets the starting offset for this key.
std::shared_ptr< IndexFiller > indexFiller_
void fill() noexcept(false)
FastFiller fastFiller(const HandleType &handle)
std::pair< edm::ProductID, unsigned int > id_off_pair
void setFillOnExit(bool fillOnExit)
If set to true, the LazyFiller wil call 'fill()' when it goes out of scope.
bool empty() const
True if it's empty (no keys)
unsigned int size() const
Returns the number of keys.
const_range operator[](const RefKey &r) const
Get a range of values for this key (fast)
std::vector< int > offset_vector
id_offset_vector id_offsets_
FastFiller(MultiAssociation &assoc, const HandleType &handle)
void swap(MultiAssociation &other)
MultiAssociation & assoc_
bool contains(const edm::ProductID &id) const
True if there are keys from this product id.
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
std::vector< id_off_pair > id_offset_vector
range operator[](const RefKey &r) const
Collection getValues(const RefKey &r) const
Get a copy of the values for this key (slow!)
void setValues(const KeyRef &k, const Collection &refs)
Sets the Collection values associated to this key, making copies of those in refs.
void setValues(const KeyRef &k, const Collection &refs)
Sets the Collection values associated to this key, making copies of those in refs.