#include <RangeMap.h>
Classes | |
struct | comp |
comparator helper class More... | |
struct | id_iterator |
identifier iterator More... | |
Public Types | |
typedef C::const_iterator | const_iterator |
constant access iterator type | |
typedef std::map< ID, pairType > | mapType |
map of identifier to index range | |
typedef std::pair< unsigned int, unsigned int > | pairType |
index range | |
typedef C::pointer | pointer |
pointer type | |
typedef std::pair < const_iterator, const_iterator > | range |
iterator range | |
typedef C::reference | reference |
reference type | |
typedef C::size_type | size_type |
collection size type | |
typedef C::value_type | value_type |
contained object type | |
Public Member Functions | |
C::const_iterator | begin () const |
first collection iterator | |
C::const_iterator | end () const |
last collection iterator | |
range | get (ID id) const |
get a range of objects with specified identifier | |
template<typename CMP > | |
range | get (ID id, CMP comparator) const |
template<typename CMP > | |
range | get (std::pair< ID, CMP > p) const |
get range of objects matching a specified identifier with a specified comparator. | |
id_iterator | id_begin () const |
first identifier iterator | |
id_iterator | id_end () const |
last identifier iterator | |
size_t | id_size () const |
number of contained identifiers | |
std::vector< ID > | ids () const |
indentifier vector | |
RangeMap & | operator= (RangeMap const &rhs) |
copy assignment | |
reference | operator[] (size_type i) |
direct access to an object in the collection | |
void | post_insert () |
perfor post insert action | |
template<typename CI > | |
void | put (ID id, CI begin, CI end) |
insert an object range with specified identifier | |
RangeMap () | |
default constructor | |
size_t | size () const |
return number of contained object | |
void | swap (RangeMap< ID, C, P > &other) |
swap member function | |
Private Attributes | |
C | collection_ |
stored collection | |
mapType | map_ |
identifier map |
Definition at line 34 of file RangeMap.h.
typedef C::const_iterator edm::RangeMap< ID, C, P >::const_iterator |
constant access iterator type
Definition at line 45 of file RangeMap.h.
typedef std::map<ID, pairType> edm::RangeMap< ID, C, P >::mapType |
map of identifier to index range
Definition at line 50 of file RangeMap.h.
typedef std::pair<unsigned int, unsigned int> edm::RangeMap< ID, C, P >::pairType |
index range
Definition at line 48 of file RangeMap.h.
typedef C::pointer edm::RangeMap< ID, C, P >::pointer |
pointer type
Definition at line 43 of file RangeMap.h.
typedef std::pair<const_iterator, const_iterator> edm::RangeMap< ID, C, P >::range |
iterator range
Definition at line 52 of file RangeMap.h.
typedef C::reference edm::RangeMap< ID, C, P >::reference |
reference type
Definition at line 41 of file RangeMap.h.
typedef C::size_type edm::RangeMap< ID, C, P >::size_type |
collection size type
Definition at line 39 of file RangeMap.h.
typedef C::value_type edm::RangeMap< ID, C, P >::value_type |
contained object type
Definition at line 37 of file RangeMap.h.
edm::RangeMap< ID, C, P >::RangeMap | ( | ) | [inline] |
C::const_iterator edm::RangeMap< ID, C, P >::begin | ( | void | ) | const [inline] |
first collection iterator
Definition at line 134 of file RangeMap.h.
Referenced by edm::RangeMap< det_id_type, edm::OwnVector< B > >::get().
{ return collection_.begin(); }
C::const_iterator edm::RangeMap< ID, C, P >::end | ( | void | ) | const [inline] |
last collection iterator
Definition at line 136 of file RangeMap.h.
Referenced by edm::RangeMap< det_id_type, edm::OwnVector< B > >::get(), and edm::RangeMap< det_id_type, edm::OwnVector< B > >::put().
{ return collection_.end(); }
range edm::RangeMap< ID, C, P >::get | ( | std::pair< ID, CMP > | p | ) | const [inline] |
get range of objects matching a specified identifier with a specified comparator.
Definition at line 102 of file RangeMap.h.
range edm::RangeMap< ID, C, P >::get | ( | ID | id | ) | const [inline] |
get a range of objects with specified identifier
Definition at line 106 of file RangeMap.h.
{ const_iterator begin, end; typename mapType::const_iterator i = map_.find(id); if (i != map_.end()) { begin = collection_.begin() + i->second.first; end = collection_.begin() + i->second.second; } else { begin = end = collection_.end(); } return std::make_pair(begin, end); }
range edm::RangeMap< ID, C, P >::get | ( | ID | id, |
CMP | comparator | ||
) | const [inline] |
get range of objects matching a specified identifier with a specified comparator. WARNING: the comparator has to be written in such a way that the std::equal_range function returns a meaningful range. Not properly written comparators may return an unpredictable range. It is recommended to use only comparators provided with CMSSW release.
Definition at line 81 of file RangeMap.h.
Referenced by FastElectronSeedGenerator::run().
{ using namespace __gnu_cxx; std::pair<typename mapType::const_iterator, typename mapType::const_iterator> r = std::equal_range(map_.begin(), map_.end(), id, comp<CMP>(comparator)); const_iterator begin, end; if ((r.first) == map_.end()){ begin = end = collection_.end(); return std::make_pair(begin,end); } else { begin = collection_.begin() + (r.first)->second.first; } if ((r.second) == map_.end()){ end = collection_.end(); }else{ end = collection_.begin() + (r.second)->second.first; } return std::make_pair(begin,end); }
id_iterator edm::RangeMap< ID, C, P >::id_begin | ( | ) | const [inline] |
first identifier iterator
Definition at line 173 of file RangeMap.h.
Referenced by edm::RangeMap< det_id_type, edm::OwnVector< B > >::ids().
{ return id_iterator(map_.begin()); }
id_iterator edm::RangeMap< ID, C, P >::id_end | ( | ) | const [inline] |
last identifier iterator
Definition at line 175 of file RangeMap.h.
Referenced by edm::RangeMap< det_id_type, edm::OwnVector< B > >::ids().
{ return id_iterator(map_.end()); }
size_t edm::RangeMap< ID, C, P >::id_size | ( | ) | const [inline] |
number of contained identifiers
Definition at line 177 of file RangeMap.h.
Referenced by edm::RangeMap< det_id_type, edm::OwnVector< B > >::ids().
{ return map_.size(); }
std::vector<ID> edm::RangeMap< ID, C, P >::ids | ( | ) | const [inline] |
indentifier vector
Definition at line 179 of file RangeMap.h.
Referenced by FastElectronSeedGenerator::run().
RangeMap< ID, C, P > & edm::RangeMap< ID, C, P >::operator= | ( | RangeMap< ID, C, P > const & | rhs | ) | [inline] |
copy assignment
Definition at line 214 of file RangeMap.h.
References edm::RangeMap< ID, C, P >::swap(), and groupFilesInBlocks::temp.
reference edm::RangeMap< ID, C, P >::operator[] | ( | size_type | i | ) | [inline] |
direct access to an object in the collection
Definition at line 185 of file RangeMap.h.
{ return collection_[ i ]; }
void edm::RangeMap< ID, C, P >::post_insert | ( | ) | [inline] |
perfor post insert action
Definition at line 158 of file RangeMap.h.
{ // sorts the container via ID C tmp; for (typename mapType::iterator it = map_.begin(), itEnd = map_.end(); it != itEnd; it ++) { range r = get((*it).first); //do cast to acknowledge that we may be going from a larger type to a smaller type but we are OK unsigned int begIt = static_cast<unsigned int>(tmp.size()); for(const_iterator i = r.first; i != r.second; ++i) tmp.push_back(P::clone(*i)); unsigned int endIt = static_cast<unsigned int>(tmp.size()); it->second = pairType(begIt, endIt); } collection_ = tmp; }
void edm::RangeMap< ID, C, P >::put | ( | ID | id, |
CI | begin, | ||
CI | end | ||
) | [inline] |
insert an object range with specified identifier
Definition at line 119 of file RangeMap.h.
Referenced by CSCMake2DRecHit::hitFromStripAndWire(), SiTrackerGaussianSmearingRecHitConverter::loadClusters(), SiTrackerGaussianSmearingRecHitConverter::loadMatchedRecHits(), TrackingRecHitTranslator::loadRecHits(), SiTrackerGaussianSmearingRecHitConverter::loadRecHits(), and edmNew::dstvdetails::ToRM< B >::operator()().
{ typename mapType::const_iterator i = map_.find(id); if(i != map_.end()) { throw Exception(errors::LogicError, "trying to insert duplicate entry"); } assert(i == map_.end()); pairType & p = map_[ id ]; p.first = collection_.size(); for(CI i = begin; i != end; ++i) collection_.push_back(P::clone(*i)); p.second = collection_.size(); }
size_t edm::RangeMap< ID, C, P >::size | ( | void | ) | const [inline] |
return number of contained object
Definition at line 132 of file RangeMap.h.
Referenced by CSCRecHit2D::CSCRecHit2D(), CSCMake2DRecHit::hitFromStripAndWire(), and FastElectronSeedGenerator::run().
{ return collection_.size(); }
void edm::RangeMap< ID, C, P >::swap | ( | RangeMap< ID, C, P > & | other | ) | [inline] |
swap member function
Definition at line 206 of file RangeMap.h.
Referenced by edm::RangeMap< ID, C, P >::operator=(), and edm::swap().
{ collection_.swap(other.collection_); map_.swap(other.map_); }
C edm::RangeMap< ID, C, P >::collection_ [private] |
stored collection
Definition at line 198 of file RangeMap.h.
Referenced by edm::RangeMap< det_id_type, edm::OwnVector< B > >::begin(), edm::RangeMap< det_id_type, edm::OwnVector< B > >::end(), edm::RangeMap< det_id_type, edm::OwnVector< B > >::get(), edm::RangeMap< det_id_type, edm::OwnVector< B > >::operator[](), edm::RangeMap< det_id_type, edm::OwnVector< B > >::post_insert(), edm::RangeMap< det_id_type, edm::OwnVector< B > >::put(), and edm::RangeMap< det_id_type, edm::OwnVector< B > >::size().
mapType edm::RangeMap< ID, C, P >::map_ [private] |
identifier map
Definition at line 200 of file RangeMap.h.
Referenced by edm::RangeMap< det_id_type, edm::OwnVector< B > >::get(), edm::RangeMap< det_id_type, edm::OwnVector< B > >::id_begin(), edm::RangeMap< det_id_type, edm::OwnVector< B > >::id_end(), edm::RangeMap< det_id_type, edm::OwnVector< B > >::id_size(), edm::RangeMap< det_id_type, edm::OwnVector< B > >::post_insert(), and edm::RangeMap< det_id_type, edm::OwnVector< B > >::put().