1 #ifndef DataFormats_Common_RangeMap_h
2 #define DataFormats_Common_RangeMap_h
25 #include <ext/functional>
48 typedef std::pair<unsigned int, unsigned int>
pairType;
52 typedef std::pair<const_iterator, const_iterator>
range;
56 template<
typename CMP>
60 return cmp(
id, p.first);
63 return cmp(p.first,
id);
80 template<
typename CMP>
82 using namespace __gnu_cxx;
83 std::pair<
typename mapType::const_iterator,
84 typename mapType::const_iterator>
r =
85 std::equal_range(
map_.begin(),
map_.end(), id, comp<CMP>(comparator));
87 if ((
r.first) ==
map_.end()){
93 if ((
r.second) ==
map_.end()){
101 template<
typename CMP>
103 return get(
p.first,
p.second);
108 typename mapType::const_iterator
i =
map_.find(
id);
109 if (i !=
map_.end()) {
115 return std::make_pair(begin, end);
118 template<
typename CI>
120 typename mapType::const_iterator
i =
map_.find(
id);
121 if(i !=
map_.end()) {
124 assert(i ==
map_.end());
127 for(CI i = begin; i !=
end; ++
i)
161 for (
typename mapType::iterator it =
map_.begin(), itEnd =
map_.end(); it != itEnd; it ++) {
162 range r =
get((*it).first);
164 unsigned int begIt =
static_cast<unsigned int>(tmp.size());
167 unsigned int endIt =
static_cast<unsigned int>(tmp.size());
168 it->second =
pairType(begIt, endIt);
175 id_iterator
id_end()
const {
return id_iterator(
map_.end()); }
179 std::vector<ID>
ids()
const {
207 collection_.swap(other.collection_);
208 map_.swap(other.map_);
211 template <
typename ID,
typename C,
typename P>
221 template <
typename ID,
typename C,
typename P>
C collection_
stored collection
void post_insert()
perfor post insert action
std::pair< const_iterator, const_iterator > range
iterator range
id_iterator & operator++()
id_iterator id_begin() const
first identifier iterator
mapType map_
identifier map
void swap(RangeMap< ID, C, P > &other)
swap member function
size_t size() const
return number of contained object
C::const_iterator begin() const
first collection iterator
bool operator==(const id_iterator &ci) const
reference operator[](size_type i)
direct access to an object in the collection
id_iterator id_end() const
last identifier iterator
#define CMS_CLASS_VERSION(_version_)
mapType::const_iterator::iterator_category iterator_category
id_iterator & operator--()
const ID operator*() const
U second(std::pair< T, U > const &p)
C::const_iterator const_iterator
constant access iterator type
std::pair< unsigned int, unsigned int > pairType
index range
id_iterator operator++(int)
bool operator()(ID id, const typename mapType::value_type &p)
Container::value_type value_type
void put(ID id, CI begin, CI end)
insert an object range with specified identifier
ptrdiff_t difference_type
C::reference reference
reference type
std::map< ID, pairType > mapType
map of identifier to index range
id_iterator(const_iterator o)
mapType::const_iterator const_iterator
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
size_t id_size() const
number of contained identifiers
std::vector< std::vector< double > > tmp
bool operator!=(const id_iterator &ci) const
RangeMap()
default constructor
C::value_type value_type
contained object type
std::vector< ID > ids() const
indentifier vector
bool operator()(const typename mapType::value_type &p, ID id)
RangeMap & operator=(RangeMap const &rhs)
copy assignment
C::const_iterator end() const
last collection iterator
C::pointer pointer
pointer type
id_iterator operator--(int)
C::size_type size_type
collection size type