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 45 of file DetSetLazyVector.h.

Member Typedef Documentation

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

Definition at line 107 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 112 of file DetSetLazyVector.h.

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

Definition at line 109 of file DetSetLazyVector.h.

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

Definition at line 105 of file DetSetLazyVector.h.

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

Definition at line 113 of file DetSetLazyVector.h.

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

Definition at line 106 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 122 of file DetSetLazyVector.h.

122 {}
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 124 of file DetSetLazyVector.h.

References edm::DetSetLazyVector< T >::sets_.

124  :
125  sets_(),
126  getter_(iGetter) {
127  sets_.reserve(iDets.size());
128  det_id_type sanityCheck = 0;
129  for(std::vector<det_id_type>::const_iterator itDetId = iDets.begin(), itDetIdEnd = iDets.end();
130  itDetId != itDetIdEnd;
131  ++itDetId) {
132  assert(sanityCheck <= *itDetId && "vector of det_id_type was not ordered");
133  sanityCheck = *itDetId;
134  sets_.push_back(DetSet<T>(*itDetId));
135  }
136  }
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 240 of file DetSetLazyVector.h.

241  {
242  dslv::LazyAdapter<T> adapter(getter_);
243  return boost::make_transform_iterator(sets_.begin(),adapter);
244  }
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 188 of file DetSetLazyVector.h.

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

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

Return the off-the-end iterator.

Definition at line 249 of file DetSetLazyVector.h.

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

250  {
251  dslv::LazyAdapter<T> adapter(getter_);
252  return boost::make_transform_iterator(sets_.end(),adapter);
253  }
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 204 of file DetSetLazyVector.h.

References relativeConstraints::empty, and AlCaHLTBitMon_ParallelJobs::p.

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

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

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

229  {
230  // Find the right DetSet, and return a reference to it. Throw if
231  // there is none.
232  const_iterator it = this->find(i);
233  if (it == this->end()) dslvdetail::_throw_range(i);
234  return *it;
235  }
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 196 of file DetSetLazyVector.h.

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

Definition at line 179 of file DetSetLazyVector.h.

References std::swap().

180  {
181  sets_.swap(other.sets_);
182  std::swap(getter_,other.getter_);
183  }
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 173 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 172 of file DetSetLazyVector.h.

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