CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
edm::DetSetLazyVector< T > Class Template Reference

#include <DetSetLazyVector.h>

Public Types

typedef std::vector< value_typecollection_type
 
typedef
boost::transform_iterator
< dslv::LazyAdapter< T >
, typename
collection_type::const_iterator > 
const_iterator
 
typedef detset const & const_reference
 
typedef DetSet< Tdetset
 
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. More...
 
 DetSetLazyVector ()
 
 DetSetLazyVector (std::shared_ptr< dslv::LazyGetter< T > > iGetter, const std::vector< det_id_type > &iDets)
 
bool empty () const
 Return true if we contain no DetSets. More...
 
const_iterator end () const
 Return the off-the-end iterator. More...
 
const_iterator find (det_id_type id) const
 
const_reference operator[] (det_id_type i) const
 
size_type size () const
 Return the number of contained DetSets. More...
 
void swap (DetSetLazyVector &other)
 

Private Member Functions

 BOOST_CLASS_REQUIRE (T, boost, LessThanComparableConcept)
 

Private Attributes

std::shared_ptr
< dslv::LazyGetter< T > > 
getter_
 
collection_type sets_
 

Detailed Description

template<class T>
class edm::DetSetLazyVector< T >

Definition at line 44 of file DetSetLazyVector.h.

Member Typedef Documentation

template<class T>
typedef std::vector<value_type> edm::DetSetLazyVector< T >::collection_type

Definition at line 106 of file DetSetLazyVector.h.

template<class T>
typedef boost::transform_iterator< dslv::LazyAdapter<T>, typename collection_type::const_iterator > edm::DetSetLazyVector< T >::const_iterator

Definition at line 111 of file DetSetLazyVector.h.

template<class T>
typedef detset const& edm::DetSetLazyVector< T >::const_reference

Definition at line 108 of file DetSetLazyVector.h.

template<class T>
typedef DetSet<T> edm::DetSetLazyVector< T >::detset

Definition at line 104 of file DetSetLazyVector.h.

template<class T>
typedef collection_type::size_type edm::DetSetLazyVector< T >::size_type

Definition at line 112 of file DetSetLazyVector.h.

template<class T>
typedef detset edm::DetSetLazyVector< T >::value_type

Definition at line 105 of file DetSetLazyVector.h.

Constructor & Destructor Documentation

template<class T>
edm::DetSetLazyVector< T >::DetSetLazyVector ( )
inline

Compiler-generated default c'tor, copy c'tor, d'tor and assignment are correct.

Definition at line 121 of file DetSetLazyVector.h.

121 {}
template<class T>
edm::DetSetLazyVector< T >::DetSetLazyVector ( std::shared_ptr< dslv::LazyGetter< T > >  iGetter,
const std::vector< det_id_type > &  iDets 
)
inline

Definition at line 123 of file DetSetLazyVector.h.

References assert(), and edm::DetSetLazyVector< T >::sets_.

123  :
124  sets_(),
125  getter_(iGetter) {
126  sets_.reserve(iDets.size());
127  det_id_type sanityCheck = 0;
128  for(std::vector<det_id_type>::const_iterator itDetId = iDets.begin(), itDetIdEnd = iDets.end();
129  itDetId != itDetIdEnd;
130  ++itDetId) {
131  assert(sanityCheck <= *itDetId && "vector of det_id_type was not ordered");
132  sanityCheck = *itDetId;
133  sets_.push_back(DetSet<T>(*itDetId));
134  }
135  }
assert(m_qm.get())
std::shared_ptr< dslv::LazyGetter< T > > getter_
uint32_t det_id_type
Definition: DetSet.h:21

Member Function Documentation

template<class T >
DetSetLazyVector< T >::const_iterator edm::DetSetLazyVector< T >::begin ( void  ) const
inline

Return an iterator to the first DetSet.

Definition at line 239 of file DetSetLazyVector.h.

240  {
241  dslv::LazyAdapter<T> adapter(getter_);
242  return boost::make_transform_iterator(sets_.begin(),adapter);
243  }
std::shared_ptr< dslv::LazyGetter< T > > getter_
template<class T>
edm::DetSetLazyVector< T >::BOOST_CLASS_REQUIRE ( T  ,
boost  ,
LessThanComparableConcept   
)
private

DetSetVector requires that T objects can be compared with operator<.

template<class T >
bool edm::DetSetLazyVector< T >::empty ( ) const
inline

Return true if we contain no DetSets.

Definition at line 187 of file DetSetLazyVector.h.

Referenced by Vispa.Gui.VispaWidget.TextField::setAutosizeFont(), and Vispa.Gui.VispaWidget.TextField::setAutotruncate().

188  {
189  return sets_.empty();
190  }
template<class T >
DetSetLazyVector< T >::const_iterator edm::DetSetLazyVector< T >::end ( void  ) const
inline

Return the off-the-end iterator.

Definition at line 248 of file DetSetLazyVector.h.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

249  {
250  dslv::LazyAdapter<T> adapter(getter_);
251  return boost::make_transform_iterator(sets_.end(),adapter);
252  }
std::shared_ptr< dslv::LazyGetter< T > > getter_
template<class T >
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 203 of file DetSetLazyVector.h.

References assert(), HLT_25ns14e33_v1_cff::distance, relativeConstraints::empty, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by BeautifulSoup.Tag::__getattr__(), and BeautifulSoup.Tag::firstText().

204  {
205  if(empty()) {
206  dslv::LazyAdapter<T> adapter(getter_);
207  return boost::make_transform_iterator(sets_.end(),adapter);
208  }
209  //NOTE: using collection_type::const_iterator and NOT const_iterator. We do this to avoid calling the
210  // dereferencing operation on const_iterator which would cause the 'lazy update' to happen
211  std::pair<typename collection_type::const_iterator,typename collection_type::const_iterator> p =
212  std::equal_range(sets_.begin(), sets_.end(), id);
213  if (p.first == p.second) {
214  dslv::LazyAdapter<T> adapter(getter_);
215  return boost::make_transform_iterator(sets_.end(),adapter);
216  }
217  // The range indicated by [p.first, p.second) should be exactly of
218  // length 1.
219  assert(std::distance(p.first, p.second) == 1);
220  dslv::LazyAdapter<T> adapter(getter_);
221  return boost::make_transform_iterator(p.first,adapter);
222  }
assert(m_qm.get())
std::shared_ptr< dslv::LazyGetter< T > > getter_
bool empty() const
Return true if we contain no DetSets.
template<class T >
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 227 of file DetSetLazyVector.h.

References edm::dslvdetail::_throw_range(), end, and spr::find().

228  {
229  // Find the right DetSet, and return a reference to it. Throw if
230  // there is none.
231  const_iterator it = this->find(i);
232  if (it == this->end()) dslvdetail::_throw_range(i);
233  return *it;
234  }
int i
Definition: DBlmapReader.cc:9
void _throw_range(det_id_type i)
const_iterator find(det_id_type id) const
const_iterator end() const
Return the off-the-end iterator.
boost::transform_iterator< dslv::LazyAdapter< T >, typename collection_type::const_iterator > const_iterator
template<class T >
DetSetLazyVector< T >::size_type edm::DetSetLazyVector< T >::size ( void  ) const
inline

Return the number of contained DetSets.

Definition at line 195 of file DetSetLazyVector.h.

196  {
197  return sets_.size();
198  }
template<class T>
void edm::DetSetLazyVector< T >::swap ( DetSetLazyVector< T > &  other)
inline

Definition at line 178 of file DetSetLazyVector.h.

References std::swap().

179  {
180  sets_.swap(other.sets_);
181  std::swap(getter_,other.getter_);
182  }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
std::shared_ptr< dslv::LazyGetter< T > > getter_

Member Data Documentation

template<class T>
std::shared_ptr<dslv::LazyGetter<T> > edm::DetSetLazyVector< T >::getter_
private

Definition at line 172 of file DetSetLazyVector.h.

template<class T>
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 171 of file DetSetLazyVector.h.

Referenced by edm::DetSetLazyVector< T >::DetSetLazyVector().