#include <DataFormats/Common/interface/DetSetLazyVector.h>
Public Types | |
typedef std::vector< value_type > | collection_type |
typedef boost::transform_iterator < dslv::LazyAdapter< T >, typename collection_type::const_iterator > | const_iterator |
typedef detset const & | const_reference |
typedef DetSet< T > | detset |
typedef collection_type::size_type | size_type |
typedef detset | value_type |
Public Member Functions | |
const_iterator | begin () const |
Return an iterator to the first DetSet. | |
DetSetLazyVector (boost::shared_ptr< dslv::LazyGetter< T > > iGetter, const std::vector< det_id_type > &iDets) | |
DetSetLazyVector () | |
Compiler-generated default c'tor, copy c'tor, d'tor and assignment are correct. | |
bool | empty () const |
Return true if we contain no DetSets. | |
const_iterator | end () const |
Return the off-the-end iterator. | |
const_iterator | find (det_id_type id) const |
Return an iterator to the DetSet with the given id, or end() if there is no such DetSet. | |
const_reference | operator[] (det_id_type i) const |
Return a reference to the DetSet with the given detector ID. | |
size_type | size () const |
Return the number of contained DetSets. | |
void | swap (DetSetLazyVector &other) |
Private Member Functions | |
BOOST_CLASS_REQUIRE (T, boost, LessThanComparableConcept) | |
DetSetVector requires that T objects can be compared with operator<. | |
Private Attributes | |
boost::shared_ptr < dslv::LazyGetter< T > > | getter_ |
collection_type | sets_ |
This function will be called by the edm::Event after the DetSetVector has been inserted into the Event. |
Definition at line 100 of file DetSetLazyVector.h.
typedef std::vector<value_type> edm::DetSetLazyVector< T >::collection_type |
Definition at line 109 of file DetSetLazyVector.h.
typedef boost::transform_iterator< dslv::LazyAdapter<T>, typename collection_type::const_iterator > edm::DetSetLazyVector< T >::const_iterator |
Definition at line 114 of file DetSetLazyVector.h.
typedef detset const& edm::DetSetLazyVector< T >::const_reference |
Definition at line 111 of file DetSetLazyVector.h.
typedef DetSet<T> edm::DetSetLazyVector< T >::detset |
Definition at line 107 of file DetSetLazyVector.h.
typedef collection_type::size_type edm::DetSetLazyVector< T >::size_type |
Definition at line 115 of file DetSetLazyVector.h.
typedef detset edm::DetSetLazyVector< T >::value_type |
Definition at line 108 of file DetSetLazyVector.h.
edm::DetSetLazyVector< T >::DetSetLazyVector | ( | ) | [inline] |
Compiler-generated default c'tor, copy c'tor, d'tor and assignment are correct.
Definition at line 124 of file DetSetLazyVector.h.
edm::DetSetLazyVector< T >::DetSetLazyVector | ( | boost::shared_ptr< dslv::LazyGetter< T > > | iGetter, | |
const std::vector< det_id_type > & | iDets | |||
) | [inline] |
Definition at line 126 of file DetSetLazyVector.h.
References edm::DetSetLazyVector< T >::sets_.
00126 : 00127 sets_(), 00128 getter_(iGetter) { 00129 sets_.reserve(iDets.size()); 00130 det_id_type sanityCheck = 0; 00131 for(std::vector<det_id_type>::const_iterator itDetId = iDets.begin(), itDetIdEnd = iDets.end(); 00132 itDetId != itDetIdEnd; 00133 ++itDetId) { 00134 assert(sanityCheck <= *itDetId && "vector of det_id_type was not ordered"); 00135 sanityCheck = *itDetId; 00136 sets_.push_back(DetSet<T>(*itDetId)); 00137 } 00138 }
DetSetLazyVector< T >::const_iterator edm::DetSetLazyVector< T >::begin | ( | ) | const [inline] |
Return an iterator to the first DetSet.
Definition at line 242 of file DetSetLazyVector.h.
References edm::DetSetLazyVector< T >::getter_, and edm::DetSetLazyVector< T >::sets_.
00243 { 00244 dslv::LazyAdapter<T> adapter(getter_); 00245 return boost::make_transform_iterator(sets_.begin(),adapter); 00246 }
edm::DetSetLazyVector< T >::BOOST_CLASS_REQUIRE | ( | T | , | |
boost | , | |||
LessThanComparableConcept | ||||
) | [private] |
DetSetVector requires that T objects can be compared with operator<.
bool edm::DetSetLazyVector< T >::empty | ( | ) | const [inline] |
Return true if we contain no DetSets.
Definition at line 190 of file DetSetLazyVector.h.
References edm::DetSetLazyVector< T >::sets_.
Referenced by edm::DetSetLazyVector< T >::find().
00191 { 00192 return sets_.empty(); 00193 }
DetSetLazyVector< T >::const_iterator edm::DetSetLazyVector< T >::end | ( | ) | const [inline] |
Return the off-the-end iterator.
Definition at line 251 of file DetSetLazyVector.h.
References edm::DetSetLazyVector< T >::getter_, and edm::DetSetLazyVector< T >::sets_.
00252 { 00253 dslv::LazyAdapter<T> adapter(getter_); 00254 return boost::make_transform_iterator(sets_.end(),adapter); 00255 }
DetSetLazyVector< T >::const_iterator edm::DetSetLazyVector< T >::find | ( | det_id_type | id | ) | const [inline] |
Return an iterator to the DetSet with the given id, or end() if there is no such DetSet.
Definition at line 206 of file DetSetLazyVector.h.
References edm::DetSetLazyVector< T >::empty(), edm::DetSetLazyVector< T >::getter_, p, and edm::DetSetLazyVector< T >::sets_.
Referenced by edm::DetSetLazyVector< T >::operator[]().
00207 { 00208 if(empty()) { 00209 dslv::LazyAdapter<T> adapter(getter_); 00210 return boost::make_transform_iterator(sets_.end(),adapter); 00211 } 00212 //NOTE: using collection_type::const_iterator and NOT const_iterator. We do this to avoid calling the 00213 // dereferencing operation on const_iterator which would cause the 'lazy update' to happen 00214 std::pair<typename collection_type::const_iterator,typename collection_type::const_iterator> p = 00215 std::equal_range(sets_.begin(), sets_.end(), id); 00216 if (p.first == p.second) { 00217 dslv::LazyAdapter<T> adapter(getter_); 00218 return boost::make_transform_iterator(sets_.end(),adapter); 00219 } 00220 // The range indicated by [p.first, p.second) should be exactly of 00221 // length 1. 00222 assert(std::distance(p.first, p.second) == 1); 00223 dslv::LazyAdapter<T> adapter(getter_); 00224 return boost::make_transform_iterator(p.first,adapter); 00225 }
DetSetLazyVector< T >::const_reference edm::DetSetLazyVector< T >::operator[] | ( | det_id_type | i | ) | const [inline] |
Return a reference to the DetSet with the given detector ID.
If there is no such DetSet, we throw an edm::Exception. DO NOT MODIFY THE id DATA MEMBER OF THE REFERENCED DetSet!**
Definition at line 230 of file DetSetLazyVector.h.
References edm::dslvdetail::_throw_range(), edm::DetSetLazyVector< T >::find(), and it.
00231 { 00232 // Find the right DetSet, and return a reference to it. Throw if 00233 // there is none. 00234 const_iterator it = this->find(i); 00235 if (it == this->end()) dslvdetail::_throw_range(i); 00236 return *it; 00237 }
DetSetLazyVector< T >::size_type edm::DetSetLazyVector< T >::size | ( | void | ) | const [inline] |
Return the number of contained DetSets.
Definition at line 198 of file DetSetLazyVector.h.
References edm::DetSetLazyVector< T >::sets_.
00199 { 00200 return sets_.size(); 00201 }
void edm::DetSetLazyVector< T >::swap | ( | DetSetLazyVector< T > & | other | ) | [inline] |
Definition at line 181 of file DetSetLazyVector.h.
References edm::DetSetLazyVector< T >::getter_, edm::DetSetLazyVector< T >::sets_, and std::swap().
Referenced by edm::swap().
boost::shared_ptr<dslv::LazyGetter<T> > edm::DetSetLazyVector< T >::getter_ [private] |
Definition at line 175 of file DetSetLazyVector.h.
Referenced by edm::DetSetLazyVector< T >::begin(), edm::DetSetLazyVector< T >::end(), edm::DetSetLazyVector< T >::find(), and edm::DetSetLazyVector< T >::swap().
collection_type edm::DetSetLazyVector< T >::sets_ [private] |
This function will be called by the edm::Event after the DetSetVector has been inserted into the Event.
Definition at line 174 of file DetSetLazyVector.h.
Referenced by edm::DetSetLazyVector< T >::begin(), edm::DetSetLazyVector< T >::DetSetLazyVector(), edm::DetSetLazyVector< T >::empty(), edm::DetSetLazyVector< T >::end(), edm::DetSetLazyVector< T >::find(), edm::DetSetLazyVector< T >::size(), and edm::DetSetLazyVector< T >::swap().