|
|
Go to the documentation of this file. 1 #ifndef DataFormats_Common_MultiAssociation_h
2 #define DataFormats_Common_MultiAssociation_h
54 #include <boost/utility.hpp>
55 #include <boost/range.hpp>
74 typedef std::pair<unsigned int, unsigned int>
range;
80 template <
typename RefKey>
82 return get(
r.id(),
r.key());
111 template <
typename RefKey>
112 void insert(
const RefKey &
r,
unsigned int startingOffset,
unsigned int size) {
150 template <
typename C>
155 typedef boost::sub_range<Collection>
range;
160 template <
typename RefKey>
162 return get(
r.id(),
r.key());
166 template <
typename RefKey>
168 return get(
r.id(),
r.key());
172 template <
typename RefKey>
209 template <
typename HandleType>
219 template <
typename KeyRef>
235 template <
typename HandleType>
247 template <
typename HandleType>
269 template <
typename KeyRef>
274 template <
typename KeyRef>
287 template <
typename HandleType>
309 template <
typename C>
315 template <
typename C>
318 return range(
data_.begin() + idxrange.first,
data_.begin() + idxrange.second);
321 template <
typename C>
323 unsigned int key)
const {
326 for (
typename const_range::const_iterator it =
values.begin(), ed =
values.end(); it != ed; ++it) {
332 template <
typename C>
334 indexFiller_->insert(
id,
key, assoc_.data_.size(), vals.size());
335 for (
typename Collection::const_iterator it = vals.begin(), ed = vals.end(); it != ed; ++it) {
336 assoc_.data_.push_back(*it);
340 template <
typename C>
341 template <
typename KeyRef>
345 (*tempValues_)[
k.key()] = vals;
348 template <
typename C>
349 template <
typename KeyRef>
353 vals.swap((*tempValues_)[
k.key()]);
356 template <
typename C>
360 for (
typename TempValues::const_iterator it = tempValues_->begin(), ed = tempValues_->end(); it != ed; ++it) {
361 filler.setValues(id_, it->first, it->second);
ret
prodAgent to be discontinued
std::pair< unsigned int, unsigned int > range
void swap(IndexRangeAssociation &lhs, IndexRangeAssociation &rhs)
~LazyFiller() noexcept(false)
Collection getValues(const RefKey &r) const
Get a copy of the values for this key (slow!)
int lastKey_
last key used to fill (to check that the new key must be strictly greater than lastKey_)
void swapValues(const KeyRef &k, Collection &refs)
std::pair< edm::ProductID, unsigned int > id_off_pair
LazyFiller lazyFiller(const HandleType &h, bool fillOnExit=false)
void swap(IndexRangeAssociation &other)
~FastFiller()
When the FastFiller goes out of scope, it unlocks the map so you can make a new one.
LazyFiller(MultiAssociation &assoc, const HandleType &handle, bool fillOnExit=false)
unsigned int dataSize() const
Returns the number of values.
id_offset_vector id_offsets_
boost::sub_range< Collection > range
void insert(const RefKey &r, unsigned int startingOffset, unsigned int size)
Sets the starting offset for this key.
static void throwUnexpectedProductID(ProductID found, ProductID expected, const char *where)
std::vector< id_off_pair > id_offset_vector
bool empty() const
True if it's empty (no keys)
std::map< unsigned int, Collection > TempValues
FastFiller(IndexRangeAssociation &assoc, ProductID id, unsigned int size)
Make a filler for a collection with a given product id and size.
#define CMS_CLASS_VERSION(_version_)
unsigned int size() const
Size of this collection (number of keys)
std::vector< int > offset_vector
void setValues(const KeyRef &k, const Collection &refs)
Sets the Collection values associated to this key, making copies of those in refs.
unsigned int size() const
Returns the number of keys.
FastFiller(MultiAssociation &assoc, const HandleType &handle)
FastFiller fastFiller(const HandleType &handle)
offset_vector ref_offsets_
MultiAssociation & assoc_
FastFiller(MultiAssociation &assoc, edm::ProductID id, unsigned int size)
def template(fileName, svg, replaceme="REPLACEME")
std::shared_ptr< TempValues > tempValues_
range operator[](const RefKey &r) const
bool operator()(const id_off_pair &p, const edm::ProductID &id) const
void setValues(const KeyRef &k, const Collection &refs)
Sets the Collection values associated to this key, making copies of those in refs.
void fill() noexcept(false)
void setFillOnExit(bool fillOnExit)
If set to true, the LazyFiller wil call 'fill()' when it goes out of scope.
edm::helper::IndexRangeAssociation::FastFiller IndexFiller
bool contains(const edm::ProductID &id) const
True if there are keys from this product id.
std::shared_ptr< IndexFiller > indexFiller_
IndexRangeAssociation & assoc_
const_range operator[](const RefKey &r) const
Get a range of values for this key (fast)
const_range get(const edm::ProductID &id, unsigned int t) const
Get a range of values for this product id and index (fast)
bool contains(ProductID id) const
True if this IndexRangeAssociation has info for this product id.
MultiAssociation & assoc_
void swap(MultiAssociation &other)
boost::sub_range< const Collection > const_range
range get(const edm::ProductID &id, unsigned int t) const
bool empty() const
Returns true if there are no keys.
range operator[](const RefKey &r)
Get a range of values for this key (fast)