1 #ifndef _snl_fei_MapContig_hpp_
2 #define _snl_fei_MapContig_hpp_
18 template<
typename VAL_TYPE>
58 int* keysPtr =
mapPtr_->keysPtr_;
63 if (keysPtr[
offset_] >= first)
break;
138 template<
typename VAL_TYPE>
140 : keys_(lastKey-firstKey+1),
142 values_(lastKey-firstKey+1),
144 len_(lastKey-firstKey+1)
147 for(
int i=0; i<
len_; ++i) {
155 template<
typename VAL_TYPE>
159 values_(src.values_),
168 template<
typename VAL_TYPE>
173 template<
typename VAL_TYPE>
179 template<
typename VAL_TYPE>
185 template<
typename VAL_TYPE>
186 inline std::pair<typename MapContig<VAL_TYPE>::iterator,
bool>
189 int localkey = val.first - first_;
190 if (localkey < 0 || localkey >= len_) {
191 return( std::pair<iterator,bool>(m_end_,
false) );
194 valuesPtr_[localkey] = val.second;
196 return( std::pair<iterator,bool>(iterator(localkey,
this),
true));
199 template<
typename VAL_TYPE>
200 inline typename MapContig<VAL_TYPE>::iterator
202 typename MapContig<VAL_TYPE>::value_type val)
204 int offset = pos.offset_;
205 if (offset < 0 || offset >=len_ || pos == m_end_) {
206 offset = val.first - first_;
207 if (offset < 0 || offset >= len_) {
212 valuesPtr_[offset] = val.second;
214 return( iterator(offset,
this) );
217 template<
typename VAL_TYPE>
220 int localkey = key - first_;
221 if (localkey < 0 || localkey >= len_) {
228 template<
typename VAL_TYPE>
231 int localkey = key - first_;
232 if (localkey < 0 || localkey >= len_) {
239 template<
typename VAL_TYPE>
std::pair< int, VAL_TYPE > value_type
iterator(int offset, MapContig< VAL_TYPE > *mapPtr)
MapContig< VAL_TYPE > * mapPtr_
std::pair< iterator, bool > insert(value_type val)
iterator & operator=(const iterator &src)
bool operator==(const iterator &rhs)
std::vector< VAL_TYPE > values_
iterator lower_bound(int key)
bool operator!=(const iterator &rhs)
MapContig(int firstKey, int lastKey)