1 #ifndef DataFormats_Common_LazyGetter_h
2 #define DataFormats_Common_LazyGetter_h
6 #include "boost/concept_check.hpp"
7 #include "boost/iterator/transform_iterator.hpp"
28 namespace lazydetail {
34 "find(uint32_t,uint32_t) called with index not in collection;\n"
61 uint32_t
start()
const;
176 unpacked_=newunpacked;
185 return getter_->begin_record()+
start_;
194 return getter_->begin_record()+finish_;
211 return std::equal_range(
begin(),
end(),
id);
232 class LazyAdapter :
public std::unary_function<const RegionIndex<T>&, const RegionIndex<T>& > {
263 indexref.
start(record_->size());
264 unpacker_->fill(index.
region(),*record_);
266 indexref.
finish(record_->size());
274 template<
typename T>
class UpdateGetterAdapter :
public std::unary_function<const RegionIndex<T>&, const RegionIndex<T>& > {
316 typedef boost::transform_iterator< UpdateGetterAdapter<T>,
typename register_type::const_iterator >
register_iterator;
318 typedef boost::transform_iterator< LazyAdapter<T>,
typename register_type::const_iterator >
const_iterator;
359 uint32_t
size()
const;
395 for (uint32_t iregion=0;iregion<nregions;iregion++) {
415 return register_.size();
423 if (index>=regions())
return end();
424 typename register_type::const_iterator it = register_.begin()+
index;
426 return boost::make_transform_iterator(it,adapter);
435 typename register_type::const_iterator it = register_.begin()+
index;
437 return *(boost::make_transform_iterator(it,adapter));
446 return boost::make_transform_iterator(register_.begin(),adapter);
455 return boost::make_transform_iterator(register_.end(),adapter);
464 return boost::make_transform_iterator(register_.begin(),adapter);
473 return boost::make_transform_iterator(register_.end(),adapter);
481 return (index<regions()) ? register_[
index].unpacked() :
false;
489 return record_.begin();
497 return record_.end();
505 return record_.size();
513 return record_.empty();
529 template<
typename T>
struct FindRegion :
public std::binary_function< const LazyGetter<T>&, const uint32_t, const RegionIndex<T>* > {
538 template<
typename T>
struct FindValue :
public std::binary_function< const LazyGetter<T>&, const uint32_t, const T* > {
544 template<
typename T> Ref< LazyGetter<T>,
T, FindValue<T> >
uint32_t regions() const
Returns the size of LazyUnpacker::register_.
LazyGetter()
Default constructor.
RegionIndex()
Default constructor.
register_iterator end_nounpack() const
Returns the off-the-end iter.
UpdateGetterAdapter(const LazyGetter< T > *)
Constructor.
bool empty() const
Returns true if record_ is empty.
record_iterator end_record() const
Returns an off-the-end iterator.
const LazyGetter< T > * getter_
std::vector< T > record_type
FindValue< T >::result_type operator()(typename FindValue< T >::first_argument_type container, typename FindValue< T >::second_argument_type index) const
std::shared_ptr< LazyUnpacker< T > > unpacker_
const_iterator end() const
Get off the end iterator.
RegionIndex< T > & updateLazyGetter(const LazyGetter< T > *newLazyGetter)
Update the pointer to the lazyGetter.
record_iterator begin_record() const
Returns an iterator to the start of record_.
LazyUnpacker< T > * unpacker_
#define CMS_CLASS_VERSION(_version_)
bool unpacked(uint32_t) const
void swap(Association< C > &lhs, Association< C > &rhs)
const_iterator end() const
Returns the off-the-end iterator.
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
virtual void fill(const uint32_t &, record_type &)=0
std::vector< l1t::Jet >::iterator start_
record_type::const_iterator record_iterator
std::vector< RegionIndex< T > > register_
void setEvent(Event const &e) const
pair_iterator find(uint32_t id) const
Get range of T on on det.
std::vector< T > record_type
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
void _throw_range(uint32_t region)
const_iterator find(uint32_t index) const
Returns an iterator to the register_ for a given index.
std::vector< T > record_type
Ref< LazyGetter< T >, T, FindValue< T > > makeRefToLazyGetter(const Handle< LazyGetter< T > > &handle, const uint32_t index)
uint32_t finish() const
Get off-the-end finish index.
const LazyGetter< T > * getter_
Ref< LazyGetter< T >, T, FindValue< T > > value_ref
static unsigned int indexFor(const value_type *iElement, const edm::LazyGetter< T > *iContainer)
const_iterator begin() const
Get begin iterator.
std::pair< const_iterator, const_iterator > pair_iterator
const RegionIndex< T > & operator[](uint32_t index) const
Returns a reference to the register_ for a given index.
register_iterator begin_nounpack() const
Returns an iterator to the start of the register_ without unpacking.
std::vector< T >::const_iterator const_iterator
const RegionIndex< T > & operator()(const RegionIndex< T > ®ion) const
() operator for construction of iterator
FindRegion< T >::result_type operator()(typename FindRegion< T >::first_argument_type iContainer, typename FindRegion< T >::second_argument_type iIndex)
uint32_t size() const
Returns the size of the record_.
uint32_t region() const
Get region number.
std::vector< RegionIndex< T > > register_type
void swap(LazyGetter &other)
Swap contents of class.
uint32_t start() const
Get start index.
const RegionIndex< T > & operator()(const RegionIndex< T > &) const
() operator for construction of iterator
virtual void setEvent(edm::Event const &e) const
volatile std::atomic< bool > shutdown_flag false
boost::transform_iterator< UpdateGetterAdapter< T >, typename register_type::const_iterator > register_iterator
bool unpacked() const
Get unpacking status.
const LazyGetter< T > * getter_
static size_t size(const edm::LazyGetter< T > *iContainer)
boost::transform_iterator< LazyAdapter< T >, typename register_type::const_iterator > const_iterator
BOOST_CLASS_REQUIRE(T, boost, LessThanComparableConcept)
LazyAdapter(const LazyUnpacker< T > *, const record_type *, const LazyGetter< T > *)
Constructor.
const_iterator begin() const
Returns an iterator to the first register_.