STXXL  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
leaf.h
Go to the documentation of this file.
1 /***************************************************************************
2  * include/stxxl/bits/containers/btree/leaf.h
3  *
4  * Part of the STXXL. See http://stxxl.sourceforge.net
5  *
6  * Copyright (C) 2006 Roman Dementiev <[email protected]>
7  *
8  * Distributed under the Boost Software License, Version 1.0.
9  * (See accompanying file LICENSE_1_0.txt or copy at
10  * http://www.boost.org/LICENSE_1_0.txt)
11  **************************************************************************/
12 
13 #ifndef STXXL_CONTAINERS_BTREE_LEAF_HEADER
14 #define STXXL_CONTAINERS_BTREE_LEAF_HEADER
15 
18 
19 
21 
22 namespace btree {
23 
24 template <class NodeType, class BTreeType>
25 class node_cache;
26 
27 template <class KeyType_, class DataType_, class KeyCmp_, unsigned RawSize_, class BTreeType>
28 class normal_leaf : private noncopyable
29 {
30 public:
32 
33  friend class node_cache<SelfType, BTreeType>;
34 
35  typedef KeyType_ key_type;
36  typedef DataType_ data_type;
37  typedef KeyCmp_ key_compare;
38  typedef std::pair<key_type, data_type> value_type;
40  typedef const value_type& const_reference;
41 
42  enum {
43  raw_size = RawSize_
44  };
46  struct InfoType
47  {
48  bid_type me, pred, succ;
49  unsigned cur_size;
50  };
51 
53  enum {
54  nelements = block_type::size - 1,
55  max_size = nelements,
56  min_size = nelements / 2
57  };
58 
59  typedef BTreeType btree_type;
60  typedef typename btree_type::size_type size_type;
64 
66 
67 public:
68  struct value_compare : public std::binary_function<value_type, value_type, bool>
69  {
71 
72  value_compare(key_compare c) : comp(c) { }
73 
74  bool operator () (const value_type& x, const value_type& y) const
75  {
76  return comp(x.first, y.first);
77  }
78  };
79 
80 private:
83 
86 
87  void split(std::pair<key_type, bid_type>& splitter)
88  {
89  bid_type NewBid;
90  btree_->leaf_cache_.get_new_node(NewBid); // new (left) leaf
91  normal_leaf* NewLeaf = btree_->leaf_cache_.get_node(NewBid, true);
92  assert(NewLeaf);
93 
94  // update links
95  NewLeaf->succ() = my_bid();
96  normal_leaf* PredLeaf = NULL;
97  if (pred().valid())
98  {
99  NewLeaf->pred() = pred();
100  PredLeaf = btree_->leaf_cache_.get_node(pred());
101  assert(PredLeaf);
102  assert(vcmp_(PredLeaf->back(), front()));
103  PredLeaf->succ() = NewBid;
104  }
105  pred() = NewBid;
106 
107  std::vector<iterator_base*> Iterators2Fix;
108  btree_->iterator_map_.find(my_bid(), 0, size(), Iterators2Fix);
109 
110  const unsigned end_of_smaller_part = size() / 2;
111 
112  splitter.first = ((*block_)[end_of_smaller_part - 1]).first;
113  splitter.second = NewBid;
114 
115  const unsigned old_size = size();
116  // copy the smaller part
117  std::copy(block_->begin(), block_->begin() + end_of_smaller_part, NewLeaf->block_->begin());
118  NewLeaf->block_->info.cur_size = end_of_smaller_part;
119  // copy the larger part
120  std::copy(block_->begin() + end_of_smaller_part,
121  block_->begin() + old_size, block_->begin());
122  block_->info.cur_size = old_size - end_of_smaller_part;
123  assert(size() + NewLeaf->size() == old_size);
124 
125  // fix iterators
126  typename std::vector<iterator_base*>::iterator it2fix = Iterators2Fix.begin();
127  for ( ; it2fix != Iterators2Fix.end(); ++it2fix)
128  {
129  btree_->iterator_map_.unregister_iterator(**it2fix);
130 
131  if ((*it2fix)->pos < end_of_smaller_part) // belongs to the smaller part
132  (*it2fix)->bid = NewBid;
133 
134  else
135  (*it2fix)->pos -= end_of_smaller_part;
136 
137 
138  btree_->iterator_map_.register_iterator(**it2fix);
139  }
140 
141 
142  STXXL_VERBOSE1("btree::normal_leaf split leaf " << this
143  << " splitter: " << splitter.first);
144 
145 #if STXXL_VERBOSE_LEVEL >= 1
146  if (PredLeaf)
147  {
148  STXXL_VERBOSE1("btree::normal_leaf pred_part.smallest = " << PredLeaf->front().first);
149  STXXL_VERBOSE1("btree::normal_leaf pred_part.largest = " << PredLeaf->back().first);
150  }
151 #endif
152  STXXL_VERBOSE1("btree::normal_leaf smaller_part.smallest = " << NewLeaf->front().first);
153  STXXL_VERBOSE1("btree::normal_leaf smaller_part.largest = " << NewLeaf->back().first);
154  STXXL_VERBOSE1("btree::normal_leaf larger_part.smallest = " << front().first);
155  STXXL_VERBOSE1("btree::normal_leaf larger_part.largest = " << back().first);
156 
157  btree_->leaf_cache_.unfix_node(NewBid);
158  }
159 
160 public:
161  virtual ~normal_leaf()
162  {
163  delete block_;
164  }
165 
167  key_compare cmp) :
168  block_(new block_type),
169  btree_(btree__),
170  cmp_(cmp),
171  vcmp_(cmp)
172  {
173  assert(min_nelements() >= 2);
174  assert(2 * min_nelements() - 1 <= max_nelements());
175  assert(max_nelements() <= nelements);
176  assert(unsigned(block_type::size) >= nelements + 1); // extra space for an overflow
177  }
178 
179  bool overflows() const { return block_->info.cur_size > max_nelements(); }
180  bool underflows() const { return block_->info.cur_size < min_nelements(); }
181 
182  unsigned max_nelements() const { return max_size; }
183  unsigned min_nelements() const { return min_size; }
184 
185 
187  {
188  return block_->info.succ;
189  }
191  {
192  return block_->info.pred;
193  }
194 
195  const bid_type & succ() const
196  {
197  return block_->info.succ;
198  }
199  const bid_type & pred() const
200  {
201  return block_->info.pred;
202  }
203 
204  /*
205  template <class InputIterator>
206  normal_leaf(InputIterator begin_, InputIterator end_,
207  btree_type * btree__,
208  key_compare cmp):
209  block_(new block_type),
210  btree_(btree__),
211  cmp_(cmp),
212  vcmp_(cmp)
213  {
214  assert(min_nelements() >=2);
215  assert(2*min_nelements() - 1 <= max_nelements());
216  assert(max_nelements() <= nelements);
217  assert(unsigned(block_type::size) >= nelements +1); // extra space for an overflow element
218 
219  unsigned new_size = end_ - begin_;
220  assert(new_size <= max_nelements());
221  assert(new_size >= min_nelements());
222 
223  std::copy(begin_,end_,block_->begin());
224  assert(stxxl::is_sorted(block_->begin(),block_->begin() + new_size, vcmp_));
225  block_->info.cur_size = new_size;
226  }*/
227 
228  unsigned size() const
229  {
230  return block_->info.cur_size;
231  }
232 
233  const bid_type & my_bid() const
234  {
235  return block_->info.me;
236  }
237 
238  void save()
239  {
240  request_ptr req = block_->write(my_bid());
241  req->wait();
242  }
243 
245  {
246  request_ptr req = block_->read(bid);
247  req->wait();
248  assert(bid == my_bid());
249  return req;
250  }
251 
253  {
254  return block_->read(bid);
255  }
256 
257  void init(const bid_type& my_bid_)
258  {
259  block_->info.me = my_bid_;
260  block_->info.succ = bid_type();
261  block_->info.pred = bid_type();
262  block_->info.cur_size = 0;
263  }
264 
265  reference operator [] (int i)
266  {
267  return (*block_)[i];
268  }
269 
270  const_reference operator [] (int i) const
271  {
272  return (*block_)[i];
273  }
274 
276  {
277  return (*block_)[size() - 1];
278  }
279 
281  {
282  return *(block_->begin());
283  }
284 
286  {
287  return (*block_)[size() - 1];
288  }
289 
291  {
292  return *(block_->begin());
293  }
294 
295  void dump()
296  {
297  STXXL_VERBOSE2("Dump of leaf " << this);
298  for (unsigned i = 0; i < size(); ++i)
299  STXXL_VERBOSE2((*this)[i].first << " " << (*this)[i].second);
300  }
301 
302  std::pair<iterator, bool> insert(
303  const value_type& x,
304  std::pair<key_type, bid_type>& splitter)
305  {
306  assert(size() <= max_nelements());
307  splitter.first = key_compare::max_value();
308 
309  typename block_type::iterator it =
310  std::lower_bound(block_->begin(), block_->begin() + size(), x, vcmp_);
311 
312  if (!(vcmp_(*it, x) || vcmp_(x, *it)) && it != (block_->begin() + size())) // *it == x
313  {
314  // already exists
315  return std::pair<iterator, bool>(
316  iterator(btree_, my_bid(), unsigned(it - block_->begin())),
317  false);
318  }
319 
320  typename block_type::iterator cur = block_->begin() + size() - 1;
321 
322  for ( ; cur >= it; --cur)
323  *(cur + 1) = *cur;
324  // move elements to make space for the new element
325 
326  *it = x;
327 
328  std::vector<iterator_base*> Iterators2Fix;
329  btree_->iterator_map_.find(my_bid(), unsigned(it - block_->begin()), size(), Iterators2Fix);
330  typename std::vector<iterator_base*>::iterator it2fix = Iterators2Fix.begin();
331  for ( ; it2fix != Iterators2Fix.end(); ++it2fix)
332  {
333  btree_->iterator_map_.unregister_iterator(**it2fix);
334  ++((*it2fix)->pos); // fixing iterators
335  btree_->iterator_map_.register_iterator(**it2fix);
336  }
337 
338  ++(block_->info.cur_size);
339 
340  std::pair<iterator, bool> result(iterator(btree_, my_bid(), unsigned(it - block_->begin())), true);
341 
342  if (size() <= max_nelements())
343  {
344  // no overflow
345  dump();
346  return result;
347  }
348 
349  // overflow
350 
351  split(splitter);
352 
353  return result;
354  }
355 
357  {
358  return iterator(btree_, my_bid(), 0);
359  }
360 
362  {
363  return const_iterator(btree_, my_bid(), 0);
364  }
365 
367  {
368  return iterator(btree_, my_bid(), size());
369  }
370 
372  {
373  assert(it.bid == my_bid());
374  assert(it.pos != size());
375 
376  btree_->iterator_map_.unregister_iterator(it);
377 
378  ++(it.pos);
379  if (it.pos == size() && succ().valid())
380  {
381  // run to the end of the leaf
382  STXXL_VERBOSE1("btree::normal_leaf jumping to the next block");
383  it.pos = 0;
384  it.bid = succ();
385  } else if (it.pos == 1 && btree_->prefetching_enabled_) // increment of pos from 0 to 1
386  {
387  // prefetch the succ leaf
388  if (succ().valid())
389  btree_->leaf_cache_.prefetch_node(succ());
390  }
391  btree_->iterator_map_.register_iterator(it);
392  }
393 
395  {
396  assert(it.bid == my_bid());
397 
398  btree_->iterator_map_.unregister_iterator(it);
399 
400  if (it.pos == 0)
401  {
402  assert(pred().valid());
403 
404  it.bid = pred();
405  normal_leaf const* PredLeaf = btree_->leaf_cache_.get_const_node(pred(), true);
406  assert(PredLeaf);
407  it.pos = PredLeaf->size() - 1;
408 
409  // prefetch the pred leaf of PredLeaf
410  if (btree_->prefetching_enabled_ && PredLeaf->pred().valid())
411  btree_->leaf_cache_.prefetch_node(PredLeaf->pred());
412 
413 
414  btree_->leaf_cache_.unfix_node(pred());
415  }
416  else
417  --it.pos;
418 
419 
420  btree_->iterator_map_.register_iterator(it);
421  }
422 
424  {
425  value_type searchVal(k, data_type());
426  typename block_type::iterator lb =
427  std::lower_bound(block_->begin(), block_->begin() + size(), searchVal, vcmp_);
428  if (lb == block_->begin() + size() || lb->first != k)
429  return btree_->end();
430 
431 
432  return iterator(btree_, my_bid(), unsigned(lb - block_->begin()));
433  }
434 
435  const_iterator find(const key_type& k) const
436  {
437  value_type searchVal(k, data_type());
438  typename block_type::iterator lb =
439  std::lower_bound(block_->begin(), block_->begin() + size(), searchVal, vcmp_);
440  if (lb == block_->begin() + size() || lb->first != k)
441  return btree_->end();
442 
443 
444  return const_iterator(btree_, my_bid(), unsigned(lb - block_->begin()));
445  }
446 
448  {
449  value_type searchVal(k, data_type());
450 
451  typename block_type::iterator lb =
452  std::lower_bound(block_->begin(), block_->begin() + size(), searchVal, vcmp_);
453 
454  // lower_bound is in the succ block
455  if (lb == block_->begin() + size() && succ().valid())
456  {
457  return iterator(btree_, succ(), 0);
458  }
459 
460  return iterator(btree_, my_bid(), unsigned(lb - block_->begin()));
461  }
462 
464  {
465  value_type searchVal(k, data_type());
466  typename block_type::iterator lb =
467  std::lower_bound(block_->begin(), block_->begin() + size(), searchVal, vcmp_);
468 
469  // lower_bound is in the succ block
470  if (lb == block_->begin() + size() && succ().valid())
471  {
472  return iterator(btree_, succ(), 0);
473  }
474 
475  return const_iterator(btree_, my_bid(), unsigned(lb - block_->begin()));
476  }
477 
479  {
480  value_type searchVal(k, data_type());
481  typename block_type::iterator lb =
482  std::upper_bound(block_->begin(), block_->begin() + size(), searchVal, vcmp_);
483 
484  // upper_bound is in the succ block
485  if (lb == block_->begin() + size() && succ().valid())
486  {
487  return iterator(btree_, succ(), 0);
488  }
489 
490  return iterator(btree_, my_bid(), unsigned(lb - block_->begin()));
491  }
492 
494  {
495  value_type searchVal(k, data_type());
496  typename block_type::iterator lb =
497  std::upper_bound(block_->begin(), block_->begin() + size(), searchVal, vcmp_);
498 
499  // upper_bound is in the succ block
500  if (lb == block_->begin() + size() && succ().valid())
501  {
502  return const_iterator(btree_, succ(), 0);
503  }
504 
505  return const_iterator(btree_, my_bid(), unsigned(lb - block_->begin()));
506  }
507 
509  {
510  value_type searchVal(k, data_type());
511  typename block_type::iterator it =
512  std::lower_bound(block_->begin(), block_->begin() + size(), searchVal, vcmp_);
513 
514  if (it == block_->begin() + size() || it->first != k)
515  return 0;
516  // no such element
517 
518  // move elements one position left
519  std::copy(it + 1, block_->begin() + size(), it);
520 
521  std::vector<iterator_base*> Iterators2Fix;
522  btree_->iterator_map_.find(my_bid(), unsigned(it + 1 - block_->begin()), size(), Iterators2Fix);
523  typename std::vector<iterator_base*>::iterator it2fix = Iterators2Fix.begin();
524  for ( ; it2fix != Iterators2Fix.end(); ++it2fix)
525  {
526  STXXL_VERBOSE2("btree::normal_leaf updating iterator " << (*it2fix) << " (pos--)");
527  btree_->iterator_map_.unregister_iterator(**it2fix);
528  --((*it2fix)->pos); // fixing iterators
529  btree_->iterator_map_.register_iterator(**it2fix);
530  }
531 
532  --(block_->info.cur_size);
533 
534  return 1;
535  }
536 
537  void fuse(const normal_leaf& Src)
538  {
539  STXXL_VERBOSE1("btree::normal_leaf Fusing");
540  assert(vcmp_(Src.back(), front()));
541  const unsigned SrcSize = Src.size();
542 
543  typename block_type::iterator cur = block_->begin() + size() - 1;
544  typename block_type::const_iterator begin = block_->begin();
545 
546  for ( ; cur >= begin; --cur)
547  *(cur + SrcSize) = *cur;
548  // move elements to make space for Src elements
549 
550  // copy Src to *this leaf
551  std::copy(Src.block_->begin(), Src.block_->begin() + SrcSize, block_->begin());
552 
553 
554  std::vector<iterator_base*> Iterators2Fix;
555  btree_->iterator_map_.find(my_bid(), 0, size(), Iterators2Fix);
556  typename std::vector<iterator_base*>::iterator it2fix = Iterators2Fix.begin();
557  for ( ; it2fix != Iterators2Fix.end(); ++it2fix)
558  {
559  STXXL_VERBOSE2("btree::normal_leaf updating iterator " << (*it2fix) <<
560  " (pos+" << SrcSize << ")");
561  btree_->iterator_map_.unregister_iterator(**it2fix);
562  ((*it2fix)->pos) += SrcSize; // fixing iterators
563  btree_->iterator_map_.register_iterator(**it2fix);
564  }
565 
566  Iterators2Fix.clear();
567  btree_->iterator_map_.find(Src.my_bid(), 0, SrcSize, Iterators2Fix);
568  it2fix = Iterators2Fix.begin();
569  for ( ; it2fix != Iterators2Fix.end(); ++it2fix)
570  {
571  STXXL_VERBOSE2("btree::normal_leaf updating iterator " << (*it2fix) <<
572  " (bid=" << my_bid() << ")");
573  btree_->iterator_map_.unregister_iterator(**it2fix);
574  ((*it2fix)->bid) = my_bid(); // fixing iterators
575  btree_->iterator_map_.register_iterator(**it2fix);
576  }
577 
578  block_->info.cur_size += SrcSize;
579 
580  // update links
581  pred() = Src.pred();
582  if (pred().valid())
583  { // update successor link
584  normal_leaf* NewPred = btree_->leaf_cache_.get_node(pred());
585  assert(NewPred);
586  NewPred->succ() = my_bid();
587  }
588  }
589 
591  {
592  STXXL_VERBOSE1("btree::normal_leaf Balancing leaves with bids " <<
593  Left.my_bid() << " and " << my_bid());
594  const unsigned TotalSize = Left.size() + size();
595  unsigned newLeftSize = TotalSize / 2;
596  assert(newLeftSize <= Left.max_nelements());
597  assert(newLeftSize >= Left.min_nelements());
598  unsigned newRightSize = TotalSize - newLeftSize;
599  assert(newRightSize <= max_nelements());
600  assert(newRightSize >= min_nelements());
601 
602  assert(vcmp_(Left.back(), front()) || size() == 0);
603 
604  if (newLeftSize < Left.size())
605  {
606  const unsigned nEl2Move = Left.size() - newLeftSize; // #elements to move from Left to *this
607 
608  typename block_type::iterator cur = block_->begin() + size() - 1;
609  typename block_type::const_iterator begin = block_->begin();
610 
611  for ( ; cur >= begin; --cur)
612  *(cur + nEl2Move) = *cur;
613  // move elements to make space for Src elements
614 
615  // copy Left to *this leaf
616  std::copy(Left.block_->begin() + newLeftSize,
617  Left.block_->begin() + Left.size(), block_->begin());
618 
619  std::vector<iterator_base*> Iterators2Fix1;
620  std::vector<iterator_base*> Iterators2Fix2;
621  btree_->iterator_map_.find(my_bid(), 0, size(), Iterators2Fix1);
622  btree_->iterator_map_.find(Left.my_bid(), newLeftSize, Left.size(), Iterators2Fix2);
623 
624  typename std::vector<iterator_base*>::iterator it2fix = Iterators2Fix1.begin();
625  for ( ; it2fix != Iterators2Fix1.end(); ++it2fix)
626  {
627  STXXL_VERBOSE2("btree::normal_leaf updating iterator " << (*it2fix) <<
628  " (pos+" << nEl2Move << ")");
629  btree_->iterator_map_.unregister_iterator(**it2fix);
630  ((*it2fix)->pos) += nEl2Move; // fixing iterators
631  btree_->iterator_map_.register_iterator(**it2fix);
632  }
633 
634 
635  it2fix = Iterators2Fix2.begin();
636  for ( ; it2fix != Iterators2Fix2.end(); ++it2fix)
637  {
638  STXXL_VERBOSE2("btree::normal_leaf updating iterator " << (*it2fix) <<
639  " (pos-" << newLeftSize << " bid=" << my_bid() << ")");
640  btree_->iterator_map_.unregister_iterator(**it2fix);
641  ((*it2fix)->bid) = my_bid(); // fixing iterators
642  ((*it2fix)->pos) -= newLeftSize; // fixing iterators
643  btree_->iterator_map_.register_iterator(**it2fix);
644  }
645  }
646  else
647  {
648  assert(newRightSize < size());
649 
650  const unsigned nEl2Move = size() - newRightSize; // #elements to move from *this to Left
651 
652  // copy *this to Left
653  std::copy(block_->begin(),
654  block_->begin() + nEl2Move, Left.block_->begin() + Left.size());
655  // move elements in *this
656  std::copy(block_->begin() + nEl2Move,
657  block_->begin() + size(), block_->begin());
658 
659  std::vector<iterator_base*> Iterators2Fix1;
660  std::vector<iterator_base*> Iterators2Fix2;
661  btree_->iterator_map_.find(my_bid(), nEl2Move, size(), Iterators2Fix1);
662  btree_->iterator_map_.find(my_bid(), 0, nEl2Move - 1, Iterators2Fix2);
663 
664  typename std::vector<iterator_base*>::iterator it2fix = Iterators2Fix1.begin();
665  for ( ; it2fix != Iterators2Fix1.end(); ++it2fix)
666  {
667  STXXL_VERBOSE2("btree::normal_leaf updating iterator " << (*it2fix) <<
668  " (pos-" << nEl2Move << ")");
669  btree_->iterator_map_.unregister_iterator(**it2fix);
670  ((*it2fix)->pos) -= nEl2Move; // fixing iterators
671  btree_->iterator_map_.register_iterator(**it2fix);
672  }
673 
674 
675  it2fix = Iterators2Fix2.begin();
676  for ( ; it2fix != Iterators2Fix2.end(); ++it2fix)
677  {
678  STXXL_VERBOSE2("btree::normal_leaf updating iterator " << (*it2fix) <<
679  " (pos+" << Left.size() << " bid=" << Left.my_bid() << ")");
680  btree_->iterator_map_.unregister_iterator(**it2fix);
681  ((*it2fix)->bid) = Left.my_bid(); // fixing iterators
682  ((*it2fix)->pos) += Left.size(); // fixing iterators
683  btree_->iterator_map_.register_iterator(**it2fix);
684  }
685  }
686 
687  block_->info.cur_size = newRightSize; // update size
688  Left.block_->info.cur_size = newLeftSize; // update size
689 
690  return Left.back().first;
691  }
692 
693  void push_back(const value_type& x)
694  {
695  (*this)[size()] = x;
696  ++(block_->info.cur_size);
697  }
698 };
699 
700 } // namespace btree
701 
702 
704 
705 #endif // !STXXL_CONTAINERS_BTREE_LEAF_HEADER
normal_leaf(btree_type *btree__, key_compare cmp)
Definition: leaf.h:166
void increment_iterator(iterator_base &it) const
Definition: leaf.h:371
std::pair< iterator, bool > insert(const value_type &x, std::pair< key_type, bid_type > &splitter)
Definition: leaf.h:302
const bid_type & my_bid() const
Definition: leaf.h:233
const_iterator upper_bound(const key_type &k) const
Definition: leaf.h:493
request_ptr load(const bid_type &bid)
Definition: leaf.h:244
info_type info
Per block information element.
Definition: typed_block.h:180
const value_type & const_reference
Definition: leaf.h:40
bool valid() const
Definition: bid.h:56
btree_const_iterator< btree_type > const_iterator
Definition: leaf.h:63
void split(std::pair< key_type, bid_type > &splitter)
Definition: leaf.h:87
const_reference back() const
Definition: leaf.h:285
#define STXXL_VERBOSE2(x)
Definition: verbose.h:107
std::pair< key_type, data_type > value_type
Definition: leaf.h:38
unsigned min_nelements() const
Definition: leaf.h:183
iterator upper_bound(const key_type &k)
Definition: leaf.h:478
key_compare cmp_
Definition: leaf.h:84
size_type erase(const key_type &k)
Definition: leaf.h:508
normal_leaf< KeyType_, DataType_, KeyCmp_, RawSize_, BTreeType > SelfType
Definition: leaf.h:31
key_type balance(normal_leaf &Left)
Definition: leaf.h:590
typed_block< raw_size, value_type, 0, InfoType > block_type
Definition: leaf.h:52
Block containing elements of fixed length.
Definition: typed_block.h:238
virtual void wait(bool measure_time=true)=0
Suspends calling thread until completion of the request.
value_compare vcmp_
Definition: leaf.h:85
btree_iterator< btree_type > iterator
Definition: leaf.h:62
request_ptr prefetch(const bid_type &bid)
Definition: leaf.h:252
const_reference front() const
Definition: leaf.h:290
reference back()
Definition: leaf.h:275
bool underflows() const
Definition: leaf.h:180
static std::vector< std::string > split(const std::string &str, const std::string &sep, unsigned int min_fields=0, unsigned int limit_fields=std::numeric_limits< unsigned int >::max())
Split a string by given separator string. Returns a vector of strings with at least min_fields and at...
Definition: utils.h:57
const_pointer const_iterator
Definition: typed_block.h:250
const_iterator begin() const
Definition: leaf.h:361
#define STXXL_BEGIN_NAMESPACE
Definition: namespace.h:16
iterator lower_bound(const key_type &k)
Definition: leaf.h:447
#define STXXL_VERBOSE1(x)
Definition: verbose.h:99
BID< raw_size > bid_type
Definition: leaf.h:45
iterator begin()
Returns iterator pointing to the first element.
Definition: typed_block.h:93
const bid_type & pred() const
Definition: leaf.h:199
iterator begin()
Definition: leaf.h:356
btree_type::size_type size_type
Definition: leaf.h:60
btree_iterator_base< btree_type > iterator_base
Definition: leaf.h:61
iterator find(const key_type &k)
Definition: leaf.h:423
node_cache< normal_leaf, btree_type > leaf_cache_type
Definition: leaf.h:65
void push_back(const value_type &x)
Definition: leaf.h:693
const_iterator find(const key_type &k) const
Definition: leaf.h:435
bid_type & succ()
Definition: leaf.h:186
virtual ~normal_leaf()
Definition: leaf.h:161
unsigned max_nelements() const
Definition: leaf.h:182
value_type & reference
Definition: leaf.h:39
block_type * block_
Definition: leaf.h:81
bool overflows() const
Definition: leaf.h:179
void init(const bid_type &my_bid_)
Definition: leaf.h:257
BTreeType btree_type
Definition: leaf.h:59
void decrement_iterator(iterator_base &it) const
Definition: leaf.h:394
const_iterator lower_bound(const key_type &k) const
Definition: leaf.h:463
btree_type * btree_
Definition: leaf.h:82
reference front()
Definition: leaf.h:280
DataType_ data_type
Definition: leaf.h:36
void fuse(const normal_leaf &Src)
Definition: leaf.h:537
#define STXXL_END_NAMESPACE
Definition: namespace.h:17
unsigned size() const
Definition: leaf.h:228
const bid_type & succ() const
Definition: leaf.h:195
bid_type & pred()
Definition: leaf.h:190